var jD=t=>{throw TypeError(t)};var CE=(t,e,n)=>e.has(t)||jD("Cannot "+n);var ot=(t,e,n)=>(CE(t,e,"read from private field"),n?n.call(t):e.get(t)),jn=(t,e,n)=>e.has(t)?jD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pn=(t,e,n,r)=>(CE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),mr=(t,e,n)=>(CE(t,e,"access private method"),n);var $3=(t,e,n,r)=>({set _(i){pn(t,e,i,n)},get _(){return ot(t,e,r)}});function uQ(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function xy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var EE={exports:{}},Wb={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var zD;function dQ(){if(zD)return Wb;zD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Wb.Fragment=e,Wb.jsx=n,Wb.jsxs=n,Wb}var FD;function fQ(){return FD||(FD=1,EE.exports=dQ()),EE.exports}var f=fQ(),AE={exports:{}},_r={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var UD;function hQ(){if(UD)return _r;UD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function x(B){return B===null||typeof B!="object"?null:(B=m&&B[m]||B["@@iterator"],typeof B=="function"?B:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function w(B,G,j){this.props=B,this.context=G,this.refs=S,this.updater=j||b}w.prototype.isReactComponent={},w.prototype.setState=function(B,G){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,G,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function C(){}C.prototype=w.prototype;function A(B,G,j){this.props=B,this.context=G,this.refs=S,this.updater=j||b}var N=A.prototype=new C;N.constructor=A,_(N,w.prototype),N.isPureReactComponent=!0;var D=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function L(B,G,j){var ie=j.ref;return{$$typeof:t,type:B,key:G,ref:ie!==void 0?ie:null,props:j}}function V(B,G){return L(B.type,G,B.props)}function F(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function U(B){var G={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(j){return G[j]})}var W=/\/+/g;function Y(B,G){return typeof B=="object"&&B!==null&&B.key!=null?U(""+B.key):G.toString(36)}function $(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(P,P):(B.status="pending",B.then(function(G){B.status==="pending"&&(B.status="fulfilled",B.value=G)},function(G){B.status==="pending"&&(B.status="rejected",B.reason=G)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function X(B,G,j,ie,ce){var te=typeof B;(te==="undefined"||te==="boolean")&&(B=null);var se=!1;if(B===null)se=!0;else switch(te){case"bigint":case"string":case"number":se=!0;break;case"object":switch(B.$$typeof){case t:case e:se=!0;break;case d:return se=B._init,X(se(B._payload),G,j,ie,ce)}}if(se)return ce=ce(B),se=ie===""?"."+Y(B,0):ie,D(ce)?(j="",se!=null&&(j=se.replace(W,"$&/")+"/"),X(ce,G,j,"",function(pe){return pe})):ce!=null&&(F(ce)&&(ce=V(ce,j+(ce.key==null||B&&B.key===ce.key?"":(""+ce.key).replace(W,"$&/")+"/")+se)),G.push(ce)),1;se=0;var le=ie===""?".":ie+":";if(D(B))for(var re=0;re<B.length;re++)ie=B[re],te=le+Y(ie,re),se+=X(ie,G,j,te,ce);else if(re=x(B),typeof re=="function")for(B=re.call(B),re=0;!(ie=B.next()).done;)ie=ie.value,te=le+Y(ie,re++),se+=X(ie,G,j,te,ce);else if(te==="object"){if(typeof B.then=="function")return X($(B),G,j,ie,ce);throw G=String(B),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return se}function Z(B,G,j){if(B==null)return B;var ie=[],ce=0;return X(B,ie,"","",function(te){return G.call(j,te,ce++)}),ie}function K(B){if(B._status===-1){var G=B._result;G=G(),G.then(function(j){(B._status===0||B._status===-1)&&(B._status=1,B._result=j)},function(j){(B._status===0||B._status===-1)&&(B._status=2,B._result=j)}),B._status===-1&&(B._status=0,B._result=G)}if(B._status===1)return B._result.default;throw B._result}var ne=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},H={map:Z,forEach:function(B,G,j){Z(B,function(){G.apply(this,arguments)},j)},count:function(B){var G=0;return Z(B,function(){G++}),G},toArray:function(B){return Z(B,function(G){return G})||[]},only:function(B){if(!F(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return _r.Activity=p,_r.Children=H,_r.Component=w,_r.Fragment=n,_r.Profiler=i,_r.PureComponent=A,_r.StrictMode=r,_r.Suspense=l,_r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,_r.__COMPILER_RUNTIME={__proto__:null,c:function(B){return O.H.useMemoCache(B)}},_r.cache=function(B){return function(){return B.apply(null,arguments)}},_r.cacheSignal=function(){return null},_r.cloneElement=function(B,G,j){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ie=_({},B.props),ce=B.key;if(G!=null)for(te in G.key!==void 0&&(ce=""+G.key),G)!R.call(G,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&G.ref===void 0||(ie[te]=G[te]);var te=arguments.length-2;if(te===1)ie.children=j;else if(1<te){for(var se=Array(te),le=0;le<te;le++)se[le]=arguments[le+2];ie.children=se}return L(B.type,ce,ie)},_r.createContext=function(B){return B={$$typeof:o,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:s,_context:B},B},_r.createElement=function(B,G,j){var ie,ce={},te=null;if(G!=null)for(ie in G.key!==void 0&&(te=""+G.key),G)R.call(G,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(ce[ie]=G[ie]);var se=arguments.length-2;if(se===1)ce.children=j;else if(1<se){for(var le=Array(se),re=0;re<se;re++)le[re]=arguments[re+2];ce.children=le}if(B&&B.defaultProps)for(ie in se=B.defaultProps,se)ce[ie]===void 0&&(ce[ie]=se[ie]);return L(B,te,ce)},_r.createRef=function(){return{current:null}},_r.forwardRef=function(B){return{$$typeof:a,render:B}},_r.isValidElement=F,_r.lazy=function(B){return{$$typeof:d,_payload:{_status:-1,_result:B},_init:K}},_r.memo=function(B,G){return{$$typeof:c,type:B,compare:G===void 0?null:G}},_r.startTransition=function(B){var G=O.T,j={};O.T=j;try{var ie=B(),ce=O.S;ce!==null&&ce(j,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(P,ne)}catch(te){ne(te)}finally{G!==null&&j.types!==null&&(G.types=j.types),O.T=G}},_r.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},_r.use=function(B){return O.H.use(B)},_r.useActionState=function(B,G,j){return O.H.useActionState(B,G,j)},_r.useCallback=function(B,G){return O.H.useCallback(B,G)},_r.useContext=function(B){return O.H.useContext(B)},_r.useDebugValue=function(){},_r.useDeferredValue=function(B,G){return O.H.useDeferredValue(B,G)},_r.useEffect=function(B,G){return O.H.useEffect(B,G)},_r.useEffectEvent=function(B){return O.H.useEffectEvent(B)},_r.useId=function(){return O.H.useId()},_r.useImperativeHandle=function(B,G,j){return O.H.useImperativeHandle(B,G,j)},_r.useInsertionEffect=function(B,G){return O.H.useInsertionEffect(B,G)},_r.useLayoutEffect=function(B,G){return O.H.useLayoutEffect(B,G)},_r.useMemo=function(B,G){return O.H.useMemo(B,G)},_r.useOptimistic=function(B,G){return O.H.useOptimistic(B,G)},_r.useReducer=function(B,G,j){return O.H.useReducer(B,G,j)},_r.useRef=function(B){return O.H.useRef(B)},_r.useState=function(B){return O.H.useState(B)},_r.useSyncExternalStore=function(B,G,j){return O.H.useSyncExternalStore(B,G,j)},_r.useTransition=function(){return O.H.useTransition()},_r.version="19.2.1",_r}var BD;function KS(){return BD||(BD=1,AE.exports=hQ()),AE.exports}var M=KS();const ei=xy(M),HF=uQ({__proto__:null,default:ei},[M]);var NE={exports:{}},$b={},RE={exports:{}},kE={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var HD;function pQ(){return HD||(HD=1,(function(t){function e(X,Z){var K=X.length;X.push(Z);e:for(;0<K;){var ne=K-1>>>1,H=X[ne];if(0<i(H,Z))X[ne]=Z,X[K]=H,K=ne;else break e}}function n(X){return X.length===0?null:X[0]}function r(X){if(X.length===0)return null;var Z=X[0],K=X.pop();if(K!==Z){X[0]=K;e:for(var ne=0,H=X.length,B=H>>>1;ne<B;){var G=2*(ne+1)-1,j=X[G],ie=G+1,ce=X[ie];if(0>i(j,K))ie<H&&0>i(ce,j)?(X[ne]=ce,X[ie]=K,ne=ie):(X[ne]=j,X[G]=K,ne=G);else if(ie<H&&0>i(ce,K))X[ne]=ce,X[ie]=K,ne=ie;else break e}}return Z}function i(X,Z){var K=X.sortIndex-Z.sortIndex;return K!==0?K:X.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,p=null,m=3,x=!1,b=!1,_=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(X){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=X)r(c),Z.sortIndex=Z.expirationTime,e(l,Z);else break;Z=n(c)}}function D(X){if(_=!1,N(X),!b)if(n(l)!==null)b=!0,P||(P=!0,U());else{var Z=n(c);Z!==null&&$(D,Z.startTime-X)}}var P=!1,O=-1,R=5,L=-1;function V(){return S?!0:!(t.unstable_now()-L<R)}function F(){if(S=!1,P){var X=t.unstable_now();L=X;var Z=!0;try{e:{b=!1,_&&(_=!1,C(O),O=-1),x=!0;var K=m;try{t:{for(N(X),p=n(l);p!==null&&!(p.expirationTime>X&&V());){var ne=p.callback;if(typeof ne=="function"){p.callback=null,m=p.priorityLevel;var H=ne(p.expirationTime<=X);if(X=t.unstable_now(),typeof H=="function"){p.callback=H,N(X),Z=!0;break t}p===n(l)&&r(l),N(X)}else r(l);p=n(l)}if(p!==null)Z=!0;else{var B=n(c);B!==null&&$(D,B.startTime-X),Z=!1}}break e}finally{p=null,m=K,x=!1}Z=void 0}}finally{Z?U():P=!1}}}var U;if(typeof A=="function")U=function(){A(F)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Y=W.port2;W.port1.onmessage=F,U=function(){Y.postMessage(null)}}else U=function(){w(F,0)};function $(X,Z){O=w(function(){X(t.unstable_now())},Z)}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(X){X.callback=null},t.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<X?Math.floor(1e3/X):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(X){switch(m){case 1:case 2:case 3:var Z=3;break;default:Z=m}var K=m;m=Z;try{return X()}finally{m=K}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(X,Z){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var K=m;m=X;try{return Z()}finally{m=K}},t.unstable_scheduleCallback=function(X,Z,K){var ne=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ne+K:ne):K=ne,X){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=K+H,X={id:d++,callback:Z,priorityLevel:X,startTime:K,expirationTime:H,sortIndex:-1},K>ne?(X.sortIndex=K,e(c,X),n(l)===null&&X===n(c)&&(_?(C(O),O=-1):_=!0,$(D,K-ne))):(X.sortIndex=H,e(l,X),b||x||(b=!0,P||(P=!0,U()))),X},t.unstable_shouldYield=V,t.unstable_wrapCallback=function(X){var Z=m;return function(){var K=m;m=Z;try{return X.apply(this,arguments)}finally{m=K}}}})(kE)),kE}var VD;function VF(){return VD||(VD=1,RE.exports=pQ()),RE.exports}var DE={exports:{}},ll={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var GD;function mQ(){if(GD)return ll;GD=1;var t=KS();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(l,c,d){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:l,containerInfo:c,implementation:d}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return ll.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ll.createPortal=function(l,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(e(299));return s(l,c,null,d)},ll.flushSync=function(l){var c=o.T,d=r.p;try{if(o.T=null,r.p=2,l)return l()}finally{o.T=c,r.p=d,r.d.f()}},ll.preconnect=function(l,c){typeof l=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,r.d.C(l,c))},ll.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},ll.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,p=a(d,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,x=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:x}):d==="script"&&r.d.X(l,{crossOrigin:p,integrity:m,fetchPriority:x,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},ll.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=a(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(l)},ll.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,p=a(d,c.crossOrigin);r.d.L(l,d,{crossOrigin:p,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},ll.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=a(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(l)},ll.requestFormReset=function(l){r.d.r(l)},ll.unstable_batchedUpdates=function(l,c){return l(c)},ll.useFormState=function(l,c,d){return o.H.useFormState(l,c,d)},ll.useFormStatus=function(){return o.H.useHostTransitionStatus()},ll.version="19.2.1",ll}var WD;function GF(){if(WD)return DE.exports;WD=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(),DE.exports=mQ(),DE.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $D;function gQ(){if($D)return $b;$D=1;var t=VF(),e=KS(),n=GF();function r(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)h+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function s(u){var h=u,y=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(y=h.return),u=h.return;while(u)}return h.tag===3?y:null}function o(u){if(u.tag===13){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function a(u){if(u.tag===31){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function l(u){if(s(u)!==u)throw Error(r(188))}function c(u){var h=u.alternate;if(!h){if(h=s(u),h===null)throw Error(r(188));return h!==u?null:u}for(var y=u,T=h;;){var I=y.return;if(I===null)break;var z=I.alternate;if(z===null){if(T=I.return,T!==null){y=T;continue}break}if(I.child===z.child){for(z=I.child;z;){if(z===y)return l(I),u;if(z===T)return l(I),h;z=z.sibling}throw Error(r(188))}if(y.return!==T.return)y=I,T=z;else{for(var de=!1,Ie=I.child;Ie;){if(Ie===y){de=!0,y=I,T=z;break}if(Ie===T){de=!0,T=I,y=z;break}Ie=Ie.sibling}if(!de){for(Ie=z.child;Ie;){if(Ie===y){de=!0,y=z,T=I;break}if(Ie===T){de=!0,T=z,y=I;break}Ie=Ie.sibling}if(!de)throw Error(r(189))}}if(y.alternate!==T)throw Error(r(190))}if(y.tag!==3)throw Error(r(188));return y.stateNode.current===y?u:h}function d(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(h=d(u),h!==null)return h;u=u.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function U(u){return u===null||typeof u!="object"?null:(u=F&&u[F]||u["@@iterator"],typeof u=="function"?u:null)}var W=Symbol.for("react.client.reference");function Y(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===W?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case w:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case P:return"SuspenseList";case L:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case C:return(u._context.displayName||"Context")+".Consumer";case N:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case O:return h=u.displayName||null,h!==null?h:Y(u.type)||"Memo";case R:h=u._payload,u=u._init;try{return Y(u(h))}catch{}}return null}var $=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},ne=[],H=-1;function B(u){return{current:u}}function G(u){0>H||(u.current=ne[H],ne[H]=null,H--)}function j(u,h){H++,ne[H]=u.current,u.current=h}var ie=B(null),ce=B(null),te=B(null),se=B(null);function le(u,h){switch(j(te,h),j(ce,u),j(ie,null),h.nodeType){case 9:case 11:u=(u=h.documentElement)&&(u=u.namespaceURI)?oD(u):0;break;default:if(u=h.tagName,h=h.namespaceURI)h=oD(h),u=aD(h,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(ie),j(ie,u)}function re(){G(ie),G(ce),G(te)}function pe(u){u.memoizedState!==null&&j(se,u);var h=ie.current,y=aD(h,u.type);h!==y&&(j(ce,u),j(ie,y))}function be(u){ce.current===u&&(G(ie),G(ce)),se.current===u&&(G(se),Bb._currentValue=K)}var xe,Pe;function me(u){if(xe===void 0)try{throw Error()}catch(y){var h=y.stack.trim().match(/\n( *(at )?)/);xe=h&&h[1]||"",Pe=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+xe+u+Pe}var ke=!1;function we(u,h){if(!u||ke)return"";ke=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var T={DetermineComponentFrameRoot:function(){try{if(h){var $t=function(){throw Error()};if(Object.defineProperty($t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($t,[])}catch(Ft){var kt=Ft}Reflect.construct(u,[],$t)}else{try{$t.call()}catch(Ft){kt=Ft}u.call($t.prototype)}}else{try{throw Error()}catch(Ft){kt=Ft}($t=u())&&typeof $t.catch=="function"&&$t.catch(function(){})}}catch(Ft){if(Ft&&kt&&typeof Ft.stack=="string")return[Ft.stack,kt.stack]}return[null,null]}};T.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var I=Object.getOwnPropertyDescriptor(T.DetermineComponentFrameRoot,"name");I&&I.configurable&&Object.defineProperty(T.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var z=T.DetermineComponentFrameRoot(),de=z[0],Ie=z[1];if(de&&Ie){var st=de.split(`
`),At=Ie.split(`
`);for(I=T=0;T<st.length&&!st[T].includes("DetermineComponentFrameRoot");)T++;for(;I<At.length&&!At[I].includes("DetermineComponentFrameRoot");)I++;if(T===st.length||I===At.length)for(T=st.length-1,I=At.length-1;1<=T&&0<=I&&st[T]!==At[I];)I--;for(;1<=T&&0<=I;T--,I--)if(st[T]!==At[I]){if(T!==1||I!==1)do if(T--,I--,0>I||st[T]!==At[I]){var Bt=`
`+st[T].replace(" at new "," at ");return u.displayName&&Bt.includes("<anonymous>")&&(Bt=Bt.replace("<anonymous>",u.displayName)),Bt}while(1<=T&&0<=I);break}}}finally{ke=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?me(y):""}function Te(u,h){switch(u.tag){case 26:case 27:case 5:return me(u.type);case 16:return me("Lazy");case 13:return u.child!==h&&h!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return we(u.type,!1);case 11:return we(u.type.render,!1);case 1:return we(u.type,!0);case 31:return me("Activity");default:return""}}function oe(u){try{var h="",y=null;do h+=Te(u,y),y=u,u=u.return;while(u);return h}catch(T){return`
Error generating stack: `+T.message+`
`+T.stack}}var _e=Object.prototype.hasOwnProperty,Fe=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,Oe=t.unstable_shouldYield,ue=t.unstable_requestPaint,Q=t.unstable_now,fe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,qe=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,Ce=t.log,Ye=t.unstable_setDisableYieldValue,Ze=null,it=null;function ut(u){if(typeof Ce=="function"&&Ye(u),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(Ze,u)}catch{}}var De=Math.clz32?Math.clz32:Le,Ve=Math.log,lt=Math.LN2;function Le(u){return u>>>=0,u===0?32:31-(Ve(u)/lt|0)|0}var Ne=256,$e=262144,ft=4194304;function nt(u){var h=u&42;if(h!==0)return h;switch(u&-u){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function We(u,h,y){var T=u.pendingLanes;if(T===0)return 0;var I=0,z=u.suspendedLanes,de=u.pingedLanes;u=u.warmLanes;var Ie=T&134217727;return Ie!==0?(T=Ie&~z,T!==0?I=nt(T):(de&=Ie,de!==0?I=nt(de):y||(y=Ie&~u,y!==0&&(I=nt(y))))):(Ie=T&~z,Ie!==0?I=nt(Ie):de!==0?I=nt(de):y||(y=T&~u,y!==0&&(I=nt(y)))),I===0?0:h!==0&&h!==I&&(h&z)===0&&(z=I&-I,y=h&-h,z>=y||z===32&&(y&4194048)!==0)?h:I}function Ke(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function je(u,h){switch(u){case 1:case 2:case 4:case 8:case 64:return h+250;case 16:case 32: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 h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function et(){var u=ft;return ft<<=1,(ft&62914560)===0&&(ft=4194304),u}function pt(u){for(var h=[],y=0;31>y;y++)h.push(u);return h}function Lt(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function wt(u,h,y,T,I,z){var de=u.pendingLanes;u.pendingLanes=y,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=y,u.entangledLanes&=y,u.errorRecoveryDisabledLanes&=y,u.shellSuspendCounter=0;var Ie=u.entanglements,st=u.expirationTimes,At=u.hiddenUpdates;for(y=de&~y;0<y;){var Bt=31-De(y),$t=1<<Bt;Ie[Bt]=0,st[Bt]=-1;var kt=At[Bt];if(kt!==null)for(At[Bt]=null,Bt=0;Bt<kt.length;Bt++){var Ft=kt[Bt];Ft!==null&&(Ft.lane&=-536870913)}y&=~$t}T!==0&&yt(u,T,0),z!==0&&I===0&&u.tag!==0&&(u.suspendedLanes|=z&~(de&~h))}function yt(u,h,y){u.pendingLanes|=h,u.suspendedLanes&=~h;var T=31-De(h);u.entangledLanes|=h,u.entanglements[T]=u.entanglements[T]|1073741824|y&261930}function Pt(u,h){var y=u.entangledLanes|=h;for(u=u.entanglements;y;){var T=31-De(y),I=1<<T;I&h|u[T]&h&&(u[T]|=h),y&=~I}}function zt(u,h){var y=h&-h;return y=(y&42)!==0?1:Dt(y),(y&(u.suspendedLanes|h))!==0?0:y}function Dt(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=16;break;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:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function Et(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Be(){var u=Z.p;return u!==0?u:(u=window.event,u===void 0?32:RD(u.type))}function Qe(u,h){var y=Z.p;try{return Z.p=u,h()}finally{Z.p=y}}var ht=Math.random().toString(36).slice(2),It="__reactFiber$"+ht,Tt="__reactProps$"+ht,ct="__reactContainer$"+ht,Ut="__reactEvents$"+ht,Gt="__reactListeners$"+ht,sn="__reactHandles$"+ht,nn="__reactResources$"+ht,En="__reactMarker$"+ht;function Hn(u){delete u[It],delete u[Tt],delete u[Ut],delete u[Gt],delete u[sn]}function Nn(u){var h=u[It];if(h)return h;for(var y=u.parentNode;y;){if(h=y[ct]||y[It]){if(y=h.alternate,h.child!==null||y!==null&&y.child!==null)for(u=pD(u);u!==null;){if(y=u[It])return y;u=pD(u)}return h}u=y,y=u.parentNode}return null}function Br(u){if(u=u[It]||u[ct]){var h=u.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return u}return null}function er(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(r(33))}function ge(u){var h=u[nn];return h||(h=u[nn]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function rt(u){u[En]=!0}var bt=new Set,vt={};function gt(u,h){Xt(u,h),Xt(u+"Capture",h)}function Xt(u,h){for(vt[u]=h,u=0;u<h.length;u++)bt.add(h[u])}var Jt=RegExp("^[: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]*$"),Kt={},Zt={};function xn(u){return _e.call(Zt,u)?!0:_e.call(Kt,u)?!1:Jt.test(u)?Zt[u]=!0:(Kt[u]=!0,!1)}function On(u,h,y){if(xn(h))if(y===null)u.removeAttribute(h);else{switch(typeof y){case"undefined":case"function":case"symbol":u.removeAttribute(h);return;case"boolean":var T=h.toLowerCase().slice(0,5);if(T!=="data-"&&T!=="aria-"){u.removeAttribute(h);return}}u.setAttribute(h,""+y)}}function Wn(u,h,y){if(y===null)u.removeAttribute(h);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(h);return}u.setAttribute(h,""+y)}}function fn(u,h,y,T){if(T===null)u.removeAttribute(y);else{switch(typeof T){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(y);return}u.setAttributeNS(h,y,""+T)}}function or(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Kr(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function ni(u,h,y){var T=Object.getOwnPropertyDescriptor(u.constructor.prototype,h);if(!u.hasOwnProperty(h)&&typeof T<"u"&&typeof T.get=="function"&&typeof T.set=="function"){var I=T.get,z=T.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(de){y=""+de,z.call(this,de)}}),Object.defineProperty(u,h,{enumerable:T.enumerable}),{getValue:function(){return y},setValue:function(de){y=""+de},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function fr(u){if(!u._valueTracker){var h=Kr(u)?"checked":"value";u._valueTracker=ni(u,h,""+u[h])}}function kr(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var y=h.getValue(),T="";return u&&(T=Kr(u)?u.checked?"true":"false":u.value),u=T,u!==y?(h.setValue(u),!0):!1}function ln(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var ss=/[\n"\\]/g;function Dn(u){return u.replace(ss,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function ms(u,h,y,T,I,z,de,Ie){u.name="",de!=null&&typeof de!="function"&&typeof de!="symbol"&&typeof de!="boolean"?u.type=de:u.removeAttribute("type"),h!=null?de==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+or(h)):u.value!==""+or(h)&&(u.value=""+or(h)):de!=="submit"&&de!=="reset"||u.removeAttribute("value"),h!=null?Di(u,de,or(h)):y!=null?Di(u,de,or(y)):T!=null&&u.removeAttribute("value"),I==null&&z!=null&&(u.defaultChecked=!!z),I!=null&&(u.checked=I&&typeof I!="function"&&typeof I!="symbol"),Ie!=null&&typeof Ie!="function"&&typeof Ie!="symbol"&&typeof Ie!="boolean"?u.name=""+or(Ie):u.removeAttribute("name")}function Ns(u,h,y,T,I,z,de,Ie){if(z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(u.type=z),h!=null||y!=null){if(!(z!=="submit"&&z!=="reset"||h!=null)){fr(u);return}y=y!=null?""+or(y):"",h=h!=null?""+or(h):y,Ie||h===u.value||(u.value=h),u.defaultValue=h}T=T??I,T=typeof T!="function"&&typeof T!="symbol"&&!!T,u.checked=Ie?u.checked:!!T,u.defaultChecked=!!T,de!=null&&typeof de!="function"&&typeof de!="symbol"&&typeof de!="boolean"&&(u.name=de),fr(u)}function Di(u,h,y){h==="number"&&ln(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function gs(u,h,y,T){if(u=u.options,h){h={};for(var I=0;I<y.length;I++)h["$"+y[I]]=!0;for(y=0;y<u.length;y++)I=h.hasOwnProperty("$"+u[y].value),u[y].selected!==I&&(u[y].selected=I),I&&T&&(u[y].defaultSelected=!0)}else{for(y=""+or(y),h=null,I=0;I<u.length;I++){if(u[I].value===y){u[I].selected=!0,T&&(u[I].defaultSelected=!0);return}h!==null||u[I].disabled||(h=u[I])}h!==null&&(h.selected=!0)}}function xr(u,h,y){if(h!=null&&(h=""+or(h),h!==u.value&&(u.value=h),y==null)){u.defaultValue!==h&&(u.defaultValue=h);return}u.defaultValue=y!=null?""+or(y):""}function hi(u,h,y,T){if(h==null){if(T!=null){if(y!=null)throw Error(r(92));if($(T)){if(1<T.length)throw Error(r(93));T=T[0]}y=T}y==null&&(y=""),h=y}y=or(h),u.defaultValue=y,T=u.textContent,T===y&&T!==""&&T!==null&&(u.value=T),fr(u)}function Rs(u,h){if(h){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=h;return}}u.textContent=h}var Pi=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function qo(u,h,y){var T=h.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?T?u.setProperty(h,""):h==="float"?u.cssFloat="":u[h]="":T?u.setProperty(h,y):typeof y!="number"||y===0||Pi.has(h)?h==="float"?u.cssFloat=y:u[h]=(""+y).trim():u[h]=y+"px"}function ga(u,h,y){if(h!=null&&typeof h!="object")throw Error(r(62));if(u=u.style,y!=null){for(var T in y)!y.hasOwnProperty(T)||h!=null&&h.hasOwnProperty(T)||(T.indexOf("--")===0?u.setProperty(T,""):T==="float"?u.cssFloat="":u[T]="");for(var I in h)T=h[I],h.hasOwnProperty(I)&&y[I]!==T&&qo(u,I,T)}else for(var z in h)h.hasOwnProperty(z)&&qo(u,z,h[z])}function Aa(u){if(u.indexOf("-")===-1)return!1;switch(u){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 Yl=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),_l=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function xa(u){return _l.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function ks(){}var Kl=null;function Ya(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Na=null,Ra=null;function Ic(u){var h=Br(u);if(h&&(u=h.stateNode)){var y=u[Tt]||null;e:switch(u=h.stateNode,h.type){case"input":if(ms(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),h=y.name,y.type==="radio"&&h!=null){for(y=u;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+Dn(""+h)+'"][type="radio"]'),h=0;h<y.length;h++){var T=y[h];if(T!==u&&T.form===u.form){var I=T[Tt]||null;if(!I)throw Error(r(90));ms(T,I.value,I.defaultValue,I.defaultValue,I.checked,I.defaultChecked,I.type,I.name)}}for(h=0;h<y.length;h++)T=y[h],T.form===u.form&&kr(T)}break e;case"textarea":xr(u,y.value,y.defaultValue);break e;case"select":h=y.value,h!=null&&gs(u,!!y.multiple,h,!1)}}}var Oc=!1;function Zl(u,h,y){if(Oc)return u(h,y);Oc=!0;try{var T=u(h);return T}finally{if(Oc=!1,(Na!==null||Ra!==null)&&(Vc(),Na&&(h=Na,u=Ra,Ra=Na=null,Ic(h),u)))for(h=0;h<u.length;h++)Ic(u[h])}}function Xo(u,h){var y=u.stateNode;if(y===null)return null;var T=y[Tt]||null;if(T===null)return null;y=T[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(T=!T.disabled)||(u=u.type,T=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!T;break e;default:u=!1}if(u)return null;if(y&&typeof y!="function")throw Error(r(231,h,typeof y));return y}var io=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ro=!1;if(io)try{var Sl={};Object.defineProperty(Sl,"passive",{get:function(){Ro=!0}}),window.addEventListener("test",Sl,Sl),window.removeEventListener("test",Sl,Sl)}catch{Ro=!1}var xs=null,Ka=null,Za=null;function Lc(){if(Za)return Za;var u,h=Ka,y=h.length,T,I="value"in xs?xs.value:xs.textContent,z=I.length;for(u=0;u<y&&h[u]===I[u];u++);var de=y-u;for(T=1;T<=de&&h[y-T]===I[z-T];T++);return Za=I.slice(u,1<T?1-T:void 0)}function ri(u){var h=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&h===13&&(u=13)):u=h,u===10&&(u=13),32<=u||u===13?u:0}function Hr(){return!0}function Yo(){return!1}function vr(u){function h(y,T,I,z,de){this._reactName=y,this._targetInst=I,this.type=T,this.nativeEvent=z,this.target=de,this.currentTarget=null;for(var Ie in u)u.hasOwnProperty(Ie)&&(y=u[Ie],this[Ie]=y?y(z):z[Ie]);return this.isDefaultPrevented=(z.defaultPrevented!=null?z.defaultPrevented:z.returnValue===!1)?Hr:Yo,this.isPropagationStopped=Yo,this}return p(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=Hr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Hr)},persist:function(){},isPersistent:Hr}),h}var Si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ii=vr(Si),qr=p({},Si,{view:0,detail:0}),ka=vr(qr),wl,Ql,go,gi=p({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kp,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==go&&(go&&u.type==="mousemove"?(wl=u.screenX-go.screenX,Ql=u.screenY-go.screenY):Ql=wl=0,go=u),wl)},movementY:function(u){return"movementY"in u?u.movementY:Ql}}),_h=vr(gi),dd=p({},gi,{dataTransfer:0}),fd=vr(dd),rf=p({},qr,{relatedTarget:0}),va=vr(rf),qi=p({},Si,{animationName:0,elapsedTime:0,pseudoElement:0}),Bs=vr(qi),vs=p({},Si,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),Ml=vr(vs),xo=p({},Si,{data:0}),Rp=vr(xo),Sh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cm={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"},sf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hd(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=sf[u])?!!h[u]:!1}function kp(){return hd}var Dp=p({},qr,{key:function(u){if(u.key){var h=Sh[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=ri(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?Cm[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kp,charCode:function(u){return u.type==="keypress"?ri(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ri(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),pd=vr(Dp),Jl=p({},gi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ec=vr(Jl),md=p({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kp}),Em=vr(md),Pp=p({},Si,{propertyName:0,elapsedTime:0,pseudoElement:0}),Am=vr(Pp),Hs=p({},gi,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),Nm=vr(Hs),Rm=p({},Si,{newState:0,oldState:0}),km=vr(Rm),Dm=[9,13,27,32],gu=io&&"CompositionEvent"in window,gd=null;io&&"documentMode"in document&&(gd=document.documentMode);var Ip=io&&"TextEvent"in window&&!gd,Op=io&&(!gu||gd&&8<gd&&11>=gd),Pm=" ",tc=!1;function xd(u,h){switch(u){case"keyup":return Dm.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ds(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var xu=!1;function ys(u,h){switch(u){case"compositionend":return Ds(h);case"keypress":return h.which!==32?null:(tc=!0,Pm);case"textInput":return u=h.data,u===Pm&&tc?null:u;default:return null}}function Lp(u,h){if(xu)return u==="compositionend"||!gu&&xd(u,h)?(u=Lc(),Za=Ka=xs=null,xu=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return Op&&h.locale!=="ko"?null:h.data;default:return null}}var wh={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 vd(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!wh[u.type]:h==="textarea"}function jp(u,h,y,T){Na?Ra?Ra.push(T):Ra=[T]:Na=T,h=k3(h,"onChange"),0<h.length&&(y=new Ii("onChange","change",null,y,T),u.push({event:y,listeners:h}))}var vu=null,jc=null;function he(u){eD(u,0)}function Me(u){var h=er(u);if(kr(h))return u}function Ge(u,h){if(u==="change")return h}var Xe=!1;if(io){var dt;if(io){var Mt="oninput"in document;if(!Mt){var Vt=document.createElement("div");Vt.setAttribute("oninput","return;"),Mt=typeof Vt.oninput=="function"}dt=Mt}else dt=!1;Xe=dt&&(!document.documentMode||9<document.documentMode)}function qt(){vu&&(vu.detachEvent("onpropertychange",rn),jc=vu=null)}function rn(u){if(u.propertyName==="value"&&Me(jc)){var h=[];jp(h,jc,u,Ya(u)),Zl(he,h)}}function yn(u,h,y){u==="focusin"?(qt(),vu=h,jc=y,vu.attachEvent("onpropertychange",rn)):u==="focusout"&&qt()}function _n(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Me(jc)}function Cn(u,h){if(u==="click")return Me(h)}function tr(u,h){if(u==="input"||u==="change")return Me(h)}function Zr(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var nr=typeof Object.is=="function"?Object.is:Zr;function hr(u,h){if(nr(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var y=Object.keys(u),T=Object.keys(h);if(y.length!==T.length)return!1;for(T=0;T<y.length;T++){var I=y[T];if(!_e.call(h,I)||!nr(u[I],h[I]))return!1}return!0}function Bn(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function kn(u,h){var y=Bn(u);u=0;for(var T;y;){if(y.nodeType===3){if(T=u+y.textContent.length,u<=h&&T>=h)return{node:y,offset:h-u};u=T}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=Bn(y)}}function $n(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?$n(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function Ji(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var h=ln(u.document);h instanceof u.HTMLIFrameElement;){try{var y=typeof h.contentWindow.location.href=="string"}catch{y=!1}if(y)u=h.contentWindow;else break;h=ln(u.document)}return h}function Ps(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}var xi=io&&"documentMode"in document&&11>=document.documentMode,li=null,os=null,Is=null,Ko=!1;function ko(u,h,y){var T=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Ko||li==null||li!==ln(T)||(T=li,"selectionStart"in T&&Ps(T)?T={start:T.selectionStart,end:T.selectionEnd}:(T=(T.ownerDocument&&T.ownerDocument.defaultView||window).getSelection(),T={anchorNode:T.anchorNode,anchorOffset:T.anchorOffset,focusNode:T.focusNode,focusOffset:T.focusOffset}),Is&&hr(Is,T)||(Is=T,T=k3(os,"onSelect"),0<T.length&&(h=new Ii("onSelect","select",null,h,y),u.push({event:h,listeners:T}),h.target=li)))}function Gi(u,h){var y={};return y[u.toLowerCase()]=h.toLowerCase(),y["Webkit"+u]="webkit"+h,y["Moz"+u]="moz"+h,y}var Vs={animationend:Gi("Animation","AnimationEnd"),animationiteration:Gi("Animation","AnimationIteration"),animationstart:Gi("Animation","AnimationStart"),transitionrun:Gi("Transition","TransitionRun"),transitionstart:Gi("Transition","TransitionStart"),transitioncancel:Gi("Transition","TransitionCancel"),transitionend:Gi("Transition","TransitionEnd")},Do={},Da={};io&&(Da=document.createElement("div").style,"AnimationEvent"in window||(delete Vs.animationend.animation,delete Vs.animationiteration.animation,delete Vs.animationstart.animation),"TransitionEvent"in window||delete Vs.transitionend.transition);function so(u){if(Do[u])return Do[u];if(!Vs[u])return u;var h=Vs[u],y;for(y in h)if(h.hasOwnProperty(y)&&y in Da)return Do[u]=h[y];return u}var oo=so("animationend"),vo=so("animationiteration"),zc=so("animationstart"),Po=so("transitionrun"),Lx=so("transitionstart"),Iw=so("transitioncancel"),Vy=so("transitionend"),nc=new Map,Im="abort auxClick beforeToggle 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(" ");Im.push("scrollEnd");function rc(u,h){nc.set(u,h),gt(h,[u])}var Om=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},ic=[],yd=0,Io=0;function Lm(){for(var u=yd,h=Io=yd=0;h<u;){var y=ic[h];ic[h++]=null;var T=ic[h];ic[h++]=null;var I=ic[h];ic[h++]=null;var z=ic[h];if(ic[h++]=null,T!==null&&I!==null){var de=T.pending;de===null?I.next=I:(I.next=de.next,de.next=I),T.pending=I}z!==0&&of(y,I,z)}}function Oo(u,h,y,T){ic[yd++]=u,ic[yd++]=h,ic[yd++]=y,ic[yd++]=T,Io|=T,u.lanes|=T,u=u.alternate,u!==null&&(u.lanes|=T)}function jx(u,h,y,T){return Oo(u,h,y,T),sc(u)}function Pa(u,h){return Oo(u,null,null,h),sc(u)}function of(u,h,y){u.lanes|=y;var T=u.alternate;T!==null&&(T.lanes|=y);for(var I=!1,z=u.return;z!==null;)z.childLanes|=y,T=z.alternate,T!==null&&(T.childLanes|=y),z.tag===22&&(u=z.stateNode,u===null||u._visibility&1||(I=!0)),u=z,z=z.return;return u.tag===3?(z=u.stateNode,I&&h!==null&&(I=31-De(y),u=z.hiddenUpdates,T=u[I],T===null?u[I]=[h]:T.push(h),h.lane=y|536870912),z):null}function sc(u){if(50<Tf)throw Tf=0,Hh=null,Error(r(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var af={};function Gy(u,h,y,T){this.tag=u,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bs(u,h,y,T){return new Gy(u,h,y,T)}function zx(u){return u=u.prototype,!(!u||!u.isReactComponent)}function Qa(u,h){var y=u.alternate;return y===null?(y=bs(u.tag,h,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=h,y.type=u.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=u.flags&65011712,y.childLanes=u.childLanes,y.lanes=u.lanes,y.child=u.child,y.memoizedProps=u.memoizedProps,y.memoizedState=u.memoizedState,y.updateQueue=u.updateQueue,h=u.dependencies,y.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y.refCleanup=u.refCleanup,y}function zp(u,h){u.flags&=65011714;var y=u.alternate;return y===null?(u.childLanes=0,u.lanes=h,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=y.childLanes,u.lanes=y.lanes,u.child=y.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=y.memoizedProps,u.memoizedState=y.memoizedState,u.updateQueue=y.updateQueue,u.type=y.type,h=y.dependencies,u.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),u}function yu(u,h,y,T,I,z){var de=0;if(T=u,typeof u=="function")zx(u)&&(de=1);else if(typeof u=="string")de=QZ(u,y,ie.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case L:return u=bs(31,y,h,I),u.elementType=L,u.lanes=z,u;case _:return lf(y.children,I,z,h);case S:de=8,I|=24;break;case w:return u=bs(12,y,h,I|2),u.elementType=w,u.lanes=z,u;case D:return u=bs(13,y,h,I),u.elementType=D,u.lanes=z,u;case P:return u=bs(19,y,h,I),u.elementType=P,u.lanes=z,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:de=10;break e;case C:de=9;break e;case N:de=11;break e;case O:de=14;break e;case R:de=16,T=null;break e}de=29,y=Error(r(130,u===null?"null":typeof u,"")),T=null}return h=bs(de,y,h,I),h.elementType=u,h.type=T,h.lanes=z,h}function lf(u,h,y,T){return u=bs(7,u,T,h),u.lanes=y,u}function Fx(u,h,y){return u=bs(6,u,null,h),u.lanes=y,u}function Fp(u){var h=bs(18,null,null,0);return h.stateNode=u,h}function Ux(u,h,y){return h=bs(4,u.children!==null?u.children:[],u.key,h),h.lanes=y,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}var jm=new WeakMap;function Tl(u,h){if(typeof u=="object"&&u!==null){var y=jm.get(u);return y!==void 0?y:(h={value:u,source:h,stack:oe(h)},jm.set(u,h),h)}return{value:u,source:h,stack:oe(h)}}var cf=[],uf=0,Up=null,Bp=0,Ja=[],as=0,bd=null,_s=1,Fc="";function bu(u,h){cf[uf++]=Bp,cf[uf++]=Up,Up=u,Bp=h}function Ow(u,h,y){Ja[as++]=_s,Ja[as++]=Fc,Ja[as++]=bd,bd=u;var T=_s;u=Fc;var I=32-De(T)-1;T&=~(1<<I),y+=1;var z=32-De(h)+I;if(30<z){var de=I-I%5;z=(T&(1<<de)-1).toString(32),T>>=de,I-=de,_s=1<<32-De(h)+I|y<<I|T,Fc=z+u}else _s=1<<z|y<<I|T,Fc=u}function _u(u){u.return!==null&&(bu(u,1),Ow(u,1,0))}function Bx(u){for(;u===Up;)Up=cf[--uf],cf[uf]=null,Bp=cf[--uf],cf[uf]=null;for(;u===bd;)bd=Ja[--as],Ja[as]=null,Fc=Ja[--as],Ja[as]=null,_s=Ja[--as],Ja[as]=null}function Hx(u,h){Ja[as++]=_s,Ja[as++]=Fc,Ja[as++]=bd,_s=h.id,Fc=h.overflow,bd=u}var Os=null,Xi=null,Xr=!1,_d=null,Cl=!1,Hp=Error(r(519));function Su(u){var h=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wu(Tl(h,u)),Hp}function Lw(u){var h=u.stateNode,y=u.type,T=u.memoizedProps;switch(h[It]=u,h[Tt]=T,y){case"dialog":Jr("cancel",h),Jr("close",h);break;case"iframe":case"object":case"embed":Jr("load",h);break;case"video":case"audio":for(y=0;y<vc.length;y++)Jr(vc[y],h);break;case"source":Jr("error",h);break;case"img":case"image":case"link":Jr("error",h),Jr("load",h);break;case"details":Jr("toggle",h);break;case"input":Jr("invalid",h),Ns(h,T.value,T.defaultValue,T.checked,T.defaultChecked,T.type,T.name,!0);break;case"select":Jr("invalid",h);break;case"textarea":Jr("invalid",h),hi(h,T.value,T.defaultValue,T.children)}y=T.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||h.textContent===""+y||T.suppressHydrationWarning===!0||iD(h.textContent,y)?(T.popover!=null&&(Jr("beforetoggle",h),Jr("toggle",h)),T.onScroll!=null&&Jr("scroll",h),T.onScrollEnd!=null&&Jr("scrollend",h),T.onClick!=null&&(h.onclick=ks),h=!0):h=!1,h||Su(u,!0)}function jw(u){for(Os=u.return;Os;)switch(Os.tag){case 5:case 31:case 13:Cl=!1;return;case 27:case 3:Cl=!0;return;default:Os=Os.return}}function Vp(u){if(u!==Os)return!1;if(!Xr)return jw(u),Xr=!0,!1;var h=u.tag,y;if((y=h!==3&&h!==27)&&((y=h===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||dE(u.type,u.memoizedProps)),y=!y),y&&Xi&&Su(u),jw(u),h===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=hD(u)}else if(h===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=hD(u)}else h===27?(h=Xi,c0(u.type)?(u=gE,gE=null,Xi=u):Xi=h):Xi=Os?ju(u.stateNode.nextSibling):null;return!0}function df(){Xi=Os=null,Xr=!1}function Vx(){var u=_d;return u!==null&&(js===null?js=u:js.push.apply(js,u),_d=null),u}function wu(u){_d===null?_d=[u]:_d.push(u)}var Gp=B(null),ff=null,Mu=null;function Sd(u,h,y){j(Gp,h._currentValue),h._currentValue=y}function Tu(u){u._currentValue=Gp.current,G(Gp)}function Gx(u,h,y){for(;u!==null;){var T=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,T!==null&&(T.childLanes|=h)):T!==null&&(T.childLanes&h)!==h&&(T.childLanes|=h),u===y)break;u=u.return}}function Wx(u,h,y,T){var I=u.child;for(I!==null&&(I.return=u);I!==null;){var z=I.dependencies;if(z!==null){var de=I.child;z=z.firstContext;e:for(;z!==null;){var Ie=z;z=I;for(var st=0;st<h.length;st++)if(Ie.context===h[st]){z.lanes|=y,Ie=z.alternate,Ie!==null&&(Ie.lanes|=y),Gx(z.return,y,u),T||(de=null);break e}z=Ie.next}}else if(I.tag===18){if(de=I.return,de===null)throw Error(r(341));de.lanes|=y,z=de.alternate,z!==null&&(z.lanes|=y),Gx(de,y,u),de=null}else de=I.child;if(de!==null)de.return=I;else for(de=I;de!==null;){if(de===u){de=null;break}if(I=de.sibling,I!==null){I.return=de.return,de=I;break}de=de.return}I=de}}function Cu(u,h,y,T){u=null;for(var I=h,z=!1;I!==null;){if(!z){if((I.flags&524288)!==0)z=!0;else if((I.flags&262144)!==0)break}if(I.tag===10){var de=I.alternate;if(de===null)throw Error(r(387));if(de=de.memoizedProps,de!==null){var Ie=I.type;nr(I.pendingProps.value,de.value)||(u!==null?u.push(Ie):u=[Ie])}}else if(I===se.current){if(de=I.alternate,de===null)throw Error(r(387));de.memoizedState.memoizedState!==I.memoizedState.memoizedState&&(u!==null?u.push(Bb):u=[Bb])}I=I.return}u!==null&&Wx(h,u,y,T),h.flags|=262144}function zm(u){for(u=u.firstContext;u!==null;){if(!nr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function hf(u){ff=u,Mu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function rr(u){return zw(ff,u)}function Wp(u,h){return ff===null&&hf(u),zw(u,h)}function zw(u,h){var y=h._currentValue;if(h={context:h,memoizedValue:y,next:null},Mu===null){if(u===null)throw Error(r(308));Mu=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else Mu=Mu.next=h;return y}var Fw=typeof AbortController<"u"?AbortController:function(){var u=[],h=this.signal={aborted:!1,addEventListener:function(y,T){u.push(T)}};this.abort=function(){h.aborted=!0,u.forEach(function(y){return y()})}},KC=t.unstable_scheduleCallback,ZC=t.unstable_NormalPriority,ao={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wy(){return{controller:new Fw,data:new Map,refCount:0}}function Mh(u){u.refCount--,u.refCount===0&&KC(ZC,function(){u.controller.abort()})}var El=null,$x=0,wd=0,oc=null;function $y(u,h){if(El===null){var y=El=[];$x=0,wd=Ot(),oc={status:"pending",value:void 0,then:function(T){y.push(T)}}}return $x++,h.then(qy,qy),h}function qy(){if(--$x===0&&El!==null){oc!==null&&(oc.status="fulfilled");var u=El;El=null,wd=0,oc=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function Xy(u,h){var y=[],T={status:"pending",value:null,reason:null,then:function(I){y.push(I)}};return u.then(function(){T.status="fulfilled",T.value=h;for(var I=0;I<y.length;I++)(0,y[I])(h)},function(I){for(T.status="rejected",T.reason=I,I=0;I<y.length;I++)(0,y[I])(void 0)}),T}var Uw=X.S;X.S=function(u,h){Ob=Q(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&$y(u,h),Uw!==null&&Uw(u,h)};var pf=B(null);function qx(){var u=pf.current;return u!==null?u:ur.pooledCache}function Fm(u,h){h===null?j(pf,pf.current):j(pf,h.pool)}function Yy(){var u=qx();return u===null?null:{parent:ao._currentValue,pool:u}}var Th=Error(r(460)),Um=Error(r(474)),Tr=Error(r(542)),Xx={then:function(){}};function el(u){return u=u.status,u==="fulfilled"||u==="rejected"}function Yx(u,h,y){switch(y=u[y],y===void 0?u.push(h):y!==h&&(h.then(ks,ks),h=y),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,Ah(u),u;default:if(typeof h.status=="string")h.then(ks,ks);else{if(u=ur,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=h,u.status="pending",u.then(function(T){if(h.status==="pending"){var I=h;I.status="fulfilled",I.value=T}},function(T){if(h.status==="pending"){var I=h;I.status="rejected",I.reason=T}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,Ah(u),u}throw Eu=h,Th}}function Ch(u){try{var h=u._init;return h(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Eu=y,Th):y}}var Eu=null;function Eh(){if(Eu===null)throw Error(r(459));var u=Eu;return Eu=null,u}function Ah(u){if(u===Th||u===Tr)throw Error(r(483))}var Nh=null,Rh=0;function Bm(u){var h=Rh;return Rh+=1,Nh===null&&(Nh=[]),Yx(Nh,u,h)}function ac(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function $p(u,h){throw h.$$typeof===m?Error(r(525)):(u=Object.prototype.toString.call(h),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u)))}function Kx(u){function h(_t,mt){if(u){var Ct=_t.deletions;Ct===null?(_t.deletions=[mt],_t.flags|=16):Ct.push(mt)}}function y(_t,mt){if(!u)return null;for(;mt!==null;)h(_t,mt),mt=mt.sibling;return null}function T(_t){for(var mt=new Map;_t!==null;)_t.key!==null?mt.set(_t.key,_t):mt.set(_t.index,_t),_t=_t.sibling;return mt}function I(_t,mt){return _t=Qa(_t,mt),_t.index=0,_t.sibling=null,_t}function z(_t,mt,Ct){return _t.index=Ct,u?(Ct=_t.alternate,Ct!==null?(Ct=Ct.index,Ct<mt?(_t.flags|=67108866,mt):Ct):(_t.flags|=67108866,mt)):(_t.flags|=1048576,mt)}function de(_t){return u&&_t.alternate===null&&(_t.flags|=67108866),_t}function Ie(_t,mt,Ct,Wt){return mt===null||mt.tag!==6?(mt=Fx(Ct,_t.mode,Wt),mt.return=_t,mt):(mt=I(mt,Ct),mt.return=_t,mt)}function st(_t,mt,Ct,Wt){var Gn=Ct.type;return Gn===_?Bt(_t,mt,Ct.props.children,Wt,Ct.key):mt!==null&&(mt.elementType===Gn||typeof Gn=="object"&&Gn!==null&&Gn.$$typeof===R&&Ch(Gn)===mt.type)?(mt=I(mt,Ct.props),ac(mt,Ct),mt.return=_t,mt):(mt=yu(Ct.type,Ct.key,Ct.props,null,_t.mode,Wt),ac(mt,Ct),mt.return=_t,mt)}function At(_t,mt,Ct,Wt){return mt===null||mt.tag!==4||mt.stateNode.containerInfo!==Ct.containerInfo||mt.stateNode.implementation!==Ct.implementation?(mt=Ux(Ct,_t.mode,Wt),mt.return=_t,mt):(mt=I(mt,Ct.children||[]),mt.return=_t,mt)}function Bt(_t,mt,Ct,Wt,Gn){return mt===null||mt.tag!==7?(mt=lf(Ct,_t.mode,Wt,Gn),mt.return=_t,mt):(mt=I(mt,Ct),mt.return=_t,mt)}function $t(_t,mt,Ct){if(typeof mt=="string"&&mt!==""||typeof mt=="number"||typeof mt=="bigint")return mt=Fx(""+mt,_t.mode,Ct),mt.return=_t,mt;if(typeof mt=="object"&&mt!==null){switch(mt.$$typeof){case x:return Ct=yu(mt.type,mt.key,mt.props,null,_t.mode,Ct),ac(Ct,mt),Ct.return=_t,Ct;case b:return mt=Ux(mt,_t.mode,Ct),mt.return=_t,mt;case R:return mt=Ch(mt),$t(_t,mt,Ct)}if($(mt)||U(mt))return mt=lf(mt,_t.mode,Ct,null),mt.return=_t,mt;if(typeof mt.then=="function")return $t(_t,Bm(mt),Ct);if(mt.$$typeof===A)return $t(_t,Wp(_t,mt),Ct);$p(_t,mt)}return null}function kt(_t,mt,Ct,Wt){var Gn=mt!==null?mt.key:null;if(typeof Ct=="string"&&Ct!==""||typeof Ct=="number"||typeof Ct=="bigint")return Gn!==null?null:Ie(_t,mt,""+Ct,Wt);if(typeof Ct=="object"&&Ct!==null){switch(Ct.$$typeof){case x:return Ct.key===Gn?st(_t,mt,Ct,Wt):null;case b:return Ct.key===Gn?At(_t,mt,Ct,Wt):null;case R:return Ct=Ch(Ct),kt(_t,mt,Ct,Wt)}if($(Ct)||U(Ct))return Gn!==null?null:Bt(_t,mt,Ct,Wt,null);if(typeof Ct.then=="function")return kt(_t,mt,Bm(Ct),Wt);if(Ct.$$typeof===A)return kt(_t,mt,Wp(_t,Ct),Wt);$p(_t,Ct)}return null}function Ft(_t,mt,Ct,Wt,Gn){if(typeof Wt=="string"&&Wt!==""||typeof Wt=="number"||typeof Wt=="bigint")return _t=_t.get(Ct)||null,Ie(mt,_t,""+Wt,Gn);if(typeof Wt=="object"&&Wt!==null){switch(Wt.$$typeof){case x:return _t=_t.get(Wt.key===null?Ct:Wt.key)||null,st(mt,_t,Wt,Gn);case b:return _t=_t.get(Wt.key===null?Ct:Wt.key)||null,At(mt,_t,Wt,Gn);case R:return Wt=Ch(Wt),Ft(_t,mt,Ct,Wt,Gn)}if($(Wt)||U(Wt))return _t=_t.get(Ct)||null,Bt(mt,_t,Wt,Gn,null);if(typeof Wt.then=="function")return Ft(_t,mt,Ct,Bm(Wt),Gn);if(Wt.$$typeof===A)return Ft(_t,mt,Ct,Wp(mt,Wt),Gn);$p(mt,Wt)}return null}function Pn(_t,mt,Ct,Wt){for(var Gn=null,wi=null,zn=mt,Dr=mt=0,si=null;zn!==null&&Dr<Ct.length;Dr++){zn.index>Dr?(si=zn,zn=null):si=zn.sibling;var Mi=kt(_t,zn,Ct[Dr],Wt);if(Mi===null){zn===null&&(zn=si);break}u&&zn&&Mi.alternate===null&&h(_t,zn),mt=z(Mi,mt,Dr),wi===null?Gn=Mi:wi.sibling=Mi,wi=Mi,zn=si}if(Dr===Ct.length)return y(_t,zn),Xr&&bu(_t,Dr),Gn;if(zn===null){for(;Dr<Ct.length;Dr++)zn=$t(_t,Ct[Dr],Wt),zn!==null&&(mt=z(zn,mt,Dr),wi===null?Gn=zn:wi.sibling=zn,wi=zn);return Xr&&bu(_t,Dr),Gn}for(zn=T(zn);Dr<Ct.length;Dr++)si=Ft(zn,_t,Dr,Ct[Dr],Wt),si!==null&&(u&&si.alternate!==null&&zn.delete(si.key===null?Dr:si.key),mt=z(si,mt,Dr),wi===null?Gn=si:wi.sibling=si,wi=si);return u&&zn.forEach(function(p0){return h(_t,p0)}),Xr&&bu(_t,Dr),Gn}function Qn(_t,mt,Ct,Wt){if(Ct==null)throw Error(r(151));for(var Gn=null,wi=null,zn=mt,Dr=mt=0,si=null,Mi=Ct.next();zn!==null&&!Mi.done;Dr++,Mi=Ct.next()){zn.index>Dr?(si=zn,zn=null):si=zn.sibling;var p0=kt(_t,zn,Mi.value,Wt);if(p0===null){zn===null&&(zn=si);break}u&&zn&&p0.alternate===null&&h(_t,zn),mt=z(p0,mt,Dr),wi===null?Gn=p0:wi.sibling=p0,wi=p0,zn=si}if(Mi.done)return y(_t,zn),Xr&&bu(_t,Dr),Gn;if(zn===null){for(;!Mi.done;Dr++,Mi=Ct.next())Mi=$t(_t,Mi.value,Wt),Mi!==null&&(mt=z(Mi,mt,Dr),wi===null?Gn=Mi:wi.sibling=Mi,wi=Mi);return Xr&&bu(_t,Dr),Gn}for(zn=T(zn);!Mi.done;Dr++,Mi=Ct.next())Mi=Ft(zn,_t,Dr,Mi.value,Wt),Mi!==null&&(u&&Mi.alternate!==null&&zn.delete(Mi.key===null?Dr:Mi.key),mt=z(Mi,mt,Dr),wi===null?Gn=Mi:wi.sibling=Mi,wi=Mi);return u&&zn.forEach(function(cQ){return h(_t,cQ)}),Xr&&bu(_t,Dr),Gn}function Zi(_t,mt,Ct,Wt){if(typeof Ct=="object"&&Ct!==null&&Ct.type===_&&Ct.key===null&&(Ct=Ct.props.children),typeof Ct=="object"&&Ct!==null){switch(Ct.$$typeof){case x:e:{for(var Gn=Ct.key;mt!==null;){if(mt.key===Gn){if(Gn=Ct.type,Gn===_){if(mt.tag===7){y(_t,mt.sibling),Wt=I(mt,Ct.props.children),Wt.return=_t,_t=Wt;break e}}else if(mt.elementType===Gn||typeof Gn=="object"&&Gn!==null&&Gn.$$typeof===R&&Ch(Gn)===mt.type){y(_t,mt.sibling),Wt=I(mt,Ct.props),ac(Wt,Ct),Wt.return=_t,_t=Wt;break e}y(_t,mt);break}else h(_t,mt);mt=mt.sibling}Ct.type===_?(Wt=lf(Ct.props.children,_t.mode,Wt,Ct.key),Wt.return=_t,_t=Wt):(Wt=yu(Ct.type,Ct.key,Ct.props,null,_t.mode,Wt),ac(Wt,Ct),Wt.return=_t,_t=Wt)}return de(_t);case b:e:{for(Gn=Ct.key;mt!==null;){if(mt.key===Gn)if(mt.tag===4&&mt.stateNode.containerInfo===Ct.containerInfo&&mt.stateNode.implementation===Ct.implementation){y(_t,mt.sibling),Wt=I(mt,Ct.children||[]),Wt.return=_t,_t=Wt;break e}else{y(_t,mt);break}else h(_t,mt);mt=mt.sibling}Wt=Ux(Ct,_t.mode,Wt),Wt.return=_t,_t=Wt}return de(_t);case R:return Ct=Ch(Ct),Zi(_t,mt,Ct,Wt)}if($(Ct))return Pn(_t,mt,Ct,Wt);if(U(Ct)){if(Gn=U(Ct),typeof Gn!="function")throw Error(r(150));return Ct=Gn.call(Ct),Qn(_t,mt,Ct,Wt)}if(typeof Ct.then=="function")return Zi(_t,mt,Bm(Ct),Wt);if(Ct.$$typeof===A)return Zi(_t,mt,Wp(_t,Ct),Wt);$p(_t,Ct)}return typeof Ct=="string"&&Ct!==""||typeof Ct=="number"||typeof Ct=="bigint"?(Ct=""+Ct,mt!==null&&mt.tag===6?(y(_t,mt.sibling),Wt=I(mt,Ct),Wt.return=_t,_t=Wt):(y(_t,mt),Wt=Fx(Ct,_t.mode,Wt),Wt.return=_t,_t=Wt),de(_t)):y(_t,mt)}return function(_t,mt,Ct,Wt){try{Rh=0;var Gn=Zi(_t,mt,Ct,Wt);return Nh=null,Gn}catch(zn){if(zn===Th||zn===Tr)throw zn;var wi=bs(29,zn,null,_t.mode);return wi.lanes=Wt,wi.return=_t,wi}finally{}}}var Md=Kx(!0),Zx=Kx(!1),Ia=!1;function Hm(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ky(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Td(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function mf(u,h,y){var T=u.updateQueue;if(T===null)return null;if(T=T.shared,(Fn&2)!==0){var I=T.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),T.pending=h,h=sc(u),of(u,null,y),h}return Oo(u,T,h,y),sc(u)}function gf(u,h,y){if(h=h.updateQueue,h!==null&&(h=h.shared,(y&4194048)!==0)){var T=h.lanes;T&=u.pendingLanes,y|=T,h.lanes=y,Pt(u,y)}}function Vn(u,h){var y=u.updateQueue,T=u.alternate;if(T!==null&&(T=T.updateQueue,y===T)){var I=null,z=null;if(y=y.firstBaseUpdate,y!==null){do{var de={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};z===null?I=z=de:z=z.next=de,y=y.next}while(y!==null);z===null?I=z=h:z=z.next=h}else I=z=h;y={baseState:T.baseState,firstBaseUpdate:I,lastBaseUpdate:z,shared:T.shared,callbacks:T.callbacks},u.updateQueue=y;return}u=y.lastBaseUpdate,u===null?y.firstBaseUpdate=h:u.next=h,y.lastBaseUpdate=h}var Zy=!1;function Vm(){if(Zy){var u=oc;if(u!==null)throw u}}function qp(u,h,y,T){Zy=!1;var I=u.updateQueue;Ia=!1;var z=I.firstBaseUpdate,de=I.lastBaseUpdate,Ie=I.shared.pending;if(Ie!==null){I.shared.pending=null;var st=Ie,At=st.next;st.next=null,de===null?z=At:de.next=At,de=st;var Bt=u.alternate;Bt!==null&&(Bt=Bt.updateQueue,Ie=Bt.lastBaseUpdate,Ie!==de&&(Ie===null?Bt.firstBaseUpdate=At:Ie.next=At,Bt.lastBaseUpdate=st))}if(z!==null){var $t=I.baseState;de=0,Bt=At=st=null,Ie=z;do{var kt=Ie.lane&-536870913,Ft=kt!==Ie.lane;if(Ft?(Mr&kt)===kt:(T&kt)===kt){kt!==0&&kt===wd&&(Zy=!0),Bt!==null&&(Bt=Bt.next={lane:0,tag:Ie.tag,payload:Ie.payload,callback:null,next:null});e:{var Pn=u,Qn=Ie;kt=h;var Zi=y;switch(Qn.tag){case 1:if(Pn=Qn.payload,typeof Pn=="function"){$t=Pn.call(Zi,$t,kt);break e}$t=Pn;break e;case 3:Pn.flags=Pn.flags&-65537|128;case 0:if(Pn=Qn.payload,kt=typeof Pn=="function"?Pn.call(Zi,$t,kt):Pn,kt==null)break e;$t=p({},$t,kt);break e;case 2:Ia=!0}}kt=Ie.callback,kt!==null&&(u.flags|=64,Ft&&(u.flags|=8192),Ft=I.callbacks,Ft===null?I.callbacks=[kt]:Ft.push(kt))}else Ft={lane:kt,tag:Ie.tag,payload:Ie.payload,callback:Ie.callback,next:null},Bt===null?(At=Bt=Ft,st=$t):Bt=Bt.next=Ft,de|=kt;if(Ie=Ie.next,Ie===null){if(Ie=I.shared.pending,Ie===null)break;Ft=Ie,Ie=Ft.next,Ft.next=null,I.lastBaseUpdate=Ft,I.shared.pending=null}}while(!0);Bt===null&&(st=$t),I.baseState=st,I.firstBaseUpdate=At,I.lastBaseUpdate=Bt,z===null&&(I.shared.lanes=0),Iu|=de,u.lanes=de,u.memoizedState=$t}}function Xp(u,h){if(typeof u!="function")throw Error(r(191,u));u.call(h)}function Bw(u,h){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)Xp(y[u],h)}var Yp=B(null),Qx=B(0);function Hw(u,h){u=kl,j(Qx,u),j(Yp,h),kl=u|h.baseLanes}function Qy(){j(Qx,kl),j(Yp,Yp.current)}function Gm(){kl=Qx.current,G(Yp),G(Qx)}var tl=B(null),Oa=null;function Cd(u){var h=u.alternate;j(Yr,Yr.current&1),j(tl,u),Oa===null&&(h===null||Yp.current!==null||h.memoizedState!==null)&&(Oa=u)}function Jy(u){j(Yr,Yr.current),j(tl,u),Oa===null&&(Oa=u)}function Vw(u){u.tag===22?(j(Yr,Yr.current),j(tl,u),Oa===null&&(Oa=u)):nl()}function nl(){j(Yr,Yr.current),j(tl,tl.current)}function Gs(u){G(tl),Oa===u&&(Oa=null),G(Yr)}var Yr=B(0);function Al(u){for(var h=u;h!==null;){if(h.tag===13){var y=h.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||pE(y)||mE(y)))return h}else if(h.tag===19&&(h.memoizedProps.revealOrder==="forwards"||h.memoizedProps.revealOrder==="backwards"||h.memoizedProps.revealOrder==="unstable_legacy-backwards"||h.memoizedProps.revealOrder==="together")){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var ls=0,yr=null,Oi=null,Vr=null,lc=!1,Kp=!1,kh=!1,Jx=0,Wm=0,Zp=null,eb=0;function Ss(){throw Error(r(321))}function tb(u,h){if(h===null)return!1;for(var y=0;y<h.length&&y<u.length;y++)if(!nr(u[y],h[y]))return!1;return!0}function ev(u,h,y,T,I,z){return ls=z,yr=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,X.H=u===null||u.memoizedState===null?_3:_b,kh=!1,z=y(T,I),kh=!1,Kp&&(z=Dh(h,y,T,I)),Gw(u),z}function Gw(u){X.H=Qp;var h=Oi!==null&&Oi.next!==null;if(ls=0,Vr=Oi=yr=null,lc=!1,Wm=0,Zp=null,h)throw Error(r(300));u===null||lo||(u=u.dependencies,u!==null&&zm(u)&&(lo=!0))}function Dh(u,h,y,T){yr=u;var I=0;do{if(Kp&&(Zp=null),Wm=0,Kp=!1,25<=I)throw Error(r(301));if(I+=1,Vr=Oi=null,u.updateQueue!=null){var z=u.updateQueue;z.lastEffect=null,z.events=null,z.stores=null,z.memoCache!=null&&(z.memoCache.index=0)}X.H=cc,z=h(y,T)}while(Kp);return z}function Ph(){var u=X.H,h=u.useState()[0];return h=typeof h.then=="function"?$m(h):h,u=u.useState()[0],(Oi!==null?Oi.memoizedState:null)!==u&&(yr.flags|=1024),h}function nb(){var u=Jx!==0;return Jx=0,u}function rb(u,h,y){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~y}function ib(u){if(lc){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}lc=!1}ls=0,Vr=Oi=yr=null,Kp=!1,Wm=Jx=0,Zp=null}function yo(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vr===null?yr.memoizedState=Vr=u:Vr=Vr.next=u,Vr}function Ws(){if(Oi===null){var u=yr.alternate;u=u!==null?u.memoizedState:null}else u=Oi.next;var h=Vr===null?yr.memoizedState:Vr.next;if(h!==null)Vr=h,Oi=u;else{if(u===null)throw yr.alternate===null?Error(r(467)):Error(r(310));Oi=u,u={memoizedState:Oi.memoizedState,baseState:Oi.baseState,baseQueue:Oi.baseQueue,queue:Oi.queue,next:null},Vr===null?yr.memoizedState=Vr=u:Vr=Vr.next=u}return Vr}function tv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $m(u){var h=Wm;return Wm+=1,Zp===null&&(Zp=[]),u=Yx(Zp,u,h),h=yr,(Vr===null?h.memoizedState:Vr.next)===null&&(h=h.alternate,X.H=h===null||h.memoizedState===null?_3:_b),u}function xf(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return $m(u);if(u.$$typeof===A)return rr(u)}throw Error(r(438,String(u)))}function sb(u){var h=null,y=yr.updateQueue;if(y!==null&&(h=y.memoCache),h==null){var T=yr.alternate;T!==null&&(T=T.updateQueue,T!==null&&(T=T.memoCache,T!=null&&(h={data:T.data.map(function(I){return I.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),y===null&&(y=tv(),yr.updateQueue=y),y.memoCache=h,y=h.data[h.index],y===void 0)for(y=h.data[h.index]=Array(u),T=0;T<u;T++)y[T]=V;return h.index++,y}function Ed(u,h){return typeof h=="function"?h(u):h}function nv(u){var h=Ws();return ob(h,Oi,u)}function ob(u,h,y){var T=u.queue;if(T===null)throw Error(r(311));T.lastRenderedReducer=y;var I=u.baseQueue,z=T.pending;if(z!==null){if(I!==null){var de=I.next;I.next=z.next,z.next=de}h.baseQueue=I=z,T.pending=null}if(z=u.baseState,I===null)u.memoizedState=z;else{h=I.next;var Ie=de=null,st=null,At=h,Bt=!1;do{var $t=At.lane&-536870913;if($t!==At.lane?(Mr&$t)===$t:(ls&$t)===$t){var kt=At.revertLane;if(kt===0)st!==null&&(st=st.next={lane:0,revertLane:0,gesture:null,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null}),$t===wd&&(Bt=!0);else if((ls&kt)===kt){At=At.next,kt===wd&&(Bt=!0);continue}else $t={lane:0,revertLane:At.revertLane,gesture:null,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null},st===null?(Ie=st=$t,de=z):st=st.next=$t,yr.lanes|=kt,Iu|=kt;$t=At.action,kh&&y(z,$t),z=At.hasEagerState?At.eagerState:y(z,$t)}else kt={lane:$t,revertLane:At.revertLane,gesture:At.gesture,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null},st===null?(Ie=st=kt,de=z):st=st.next=kt,yr.lanes|=$t,Iu|=$t;At=At.next}while(At!==null&&At!==h);if(st===null?de=z:st.next=Ie,!nr(z,u.memoizedState)&&(lo=!0,Bt&&(y=oc,y!==null)))throw y;u.memoizedState=z,u.baseState=de,u.baseQueue=st,T.lastRenderedState=z}return I===null&&(T.lanes=0),[u.memoizedState,T.dispatch]}function ab(u){var h=Ws(),y=h.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var T=y.dispatch,I=y.pending,z=h.memoizedState;if(I!==null){y.pending=null;var de=I=I.next;do z=u(z,de.action),de=de.next;while(de!==I);nr(z,h.memoizedState)||(lo=!0),h.memoizedState=z,h.baseQueue===null&&(h.baseState=z),y.lastRenderedState=z}return[z,T]}function Ww(u,h,y){var T=yr,I=Ws(),z=Xr;if(z){if(y===void 0)throw Error(r(407));y=y()}else y=h();var de=!nr((Oi||I).memoizedState,y);if(de&&(I.memoizedState=y,lo=!0),I=I.queue,mb(Xw.bind(null,T,I,u),[u]),I.getSnapshot!==h||de||Vr!==null&&Vr.memoizedState.tag&1){if(T.flags|=2048,vf(9,{destroy:void 0},qw.bind(null,T,I,y,h),null),ur===null)throw Error(r(349));z||(ls&127)!==0||$w(T,h,y)}return y}function $w(u,h,y){u.flags|=16384,u={getSnapshot:h,value:y},h=yr.updateQueue,h===null?(h=tv(),yr.updateQueue=h,h.stores=[u]):(y=h.stores,y===null?h.stores=[u]:y.push(u))}function qw(u,h,y,T){h.value=y,h.getSnapshot=T,Yw(h)&&Kw(u)}function Xw(u,h,y){return y(function(){Yw(h)&&Kw(u)})}function Yw(u){var h=u.getSnapshot;u=u.value;try{var y=h();return!nr(u,y)}catch{return!0}}function Kw(u){var h=Pa(u,2);h!==null&&Er(h,u,2)}function lb(u){var h=yo();if(typeof u=="function"){var y=u;if(u=y(),kh){ut(!0);try{y()}finally{ut(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ed,lastRenderedState:u},h}function cb(u,h,y,T){return u.baseState=y,ob(u,Oi,typeof T=="function"?T:Ed)}function QC(u,h,y,T,I){if(ov(u))throw Error(r(485));if(u=h.action,u!==null){var z={payload:I,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(de){z.listeners.push(de)}};X.T!==null?y(!0):z.isTransition=!1,T(z),y=h.pending,y===null?(z.next=h.pending=z,Zw(h,z)):(z.next=y.next,h.pending=y.next=z)}}function Zw(u,h){var y=h.action,T=h.payload,I=u.state;if(h.isTransition){var z=X.T,de={};X.T=de;try{var Ie=y(I,T),st=X.S;st!==null&&st(de,Ie),Qw(u,h,Ie)}catch(At){ub(u,h,At)}finally{z!==null&&de.types!==null&&(z.types=de.types),X.T=z}}else try{z=y(I,T),Qw(u,h,z)}catch(At){ub(u,h,At)}}function Qw(u,h,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(T){Jw(u,h,T)},function(T){return ub(u,h,T)}):Jw(u,h,y)}function Jw(u,h,y){h.status="fulfilled",h.value=y,e3(h),u.state=y,h=u.pending,h!==null&&(y=h.next,y===h?u.pending=null:(y=y.next,h.next=y,Zw(u,y)))}function ub(u,h,y){var T=u.pending;if(u.pending=null,T!==null){T=T.next;do h.status="rejected",h.reason=y,e3(h),h=h.next;while(h!==T)}u.action=null}function e3(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function db(u,h){return h}function fb(u,h){if(Xr){var y=ur.formState;if(y!==null){e:{var T=yr;if(Xr){if(Xi){t:{for(var I=Xi,z=Cl;I.nodeType!==8;){if(!z){I=null;break t}if(I=ju(I.nextSibling),I===null){I=null;break t}}z=I.data,I=z==="F!"||z==="F"?I:null}if(I){Xi=ju(I.nextSibling),T=I.data==="F!";break e}}Su(T)}T=!1}T&&(h=y[0])}}return y=yo(),y.memoizedState=y.baseState=h,T={pending:null,lanes:0,dispatch:null,lastRenderedReducer:db,lastRenderedState:h},y.queue=T,y=v3.bind(null,yr,T),T.dispatch=y,T=lb(!1),z=bb.bind(null,yr,!1,T.queue),T=yo(),I={state:h,dispatch:null,action:u,pending:null},T.queue=I,y=QC.bind(null,yr,I,z,y),I.dispatch=y,T.memoizedState=u,[h,y,!1]}function t3(u){var h=Ws();return hb(h,Oi,u)}function hb(u,h,y){if(h=ob(u,h,db)[0],u=nv(Ed)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var T=$m(h)}catch(de){throw de===Th?Tr:de}else T=h;h=Ws();var I=h.queue,z=I.dispatch;return y!==h.memoizedState&&(yr.flags|=2048,vf(9,{destroy:void 0},n3.bind(null,I,y),null)),[T,z,u]}function n3(u,h){u.action=h}function pb(u){var h=Ws(),y=Oi;if(y!==null)return hb(h,y,u);Ws(),h=h.memoizedState,y=Ws();var T=y.queue.dispatch;return y.memoizedState=u,[h,T,!1]}function vf(u,h,y,T){return u={tag:u,create:y,deps:T,inst:h,next:null},h=yr.updateQueue,h===null&&(h=tv(),yr.updateQueue=h),y=h.lastEffect,y===null?h.lastEffect=u.next=u:(T=y.next,y.next=u,u.next=T,h.lastEffect=u),u}function rv(){return Ws().memoizedState}function iv(u,h,y,T){var I=yo();yr.flags|=u,I.memoizedState=vf(1|h,{destroy:void 0},y,T===void 0?null:T)}function sv(u,h,y,T){var I=Ws();T=T===void 0?null:T;var z=I.memoizedState.inst;Oi!==null&&T!==null&&tb(T,Oi.memoizedState.deps)?I.memoizedState=vf(h,z,y,T):(yr.flags|=u,I.memoizedState=vf(1|h,z,y,T))}function r3(u,h){iv(8390656,8,u,h)}function mb(u,h){sv(2048,8,u,h)}function i3(u){yr.flags|=4;var h=yr.updateQueue;if(h===null)h=tv(),yr.updateQueue=h,h.events=[u];else{var y=h.events;y===null?h.events=[u]:y.push(u)}}function s3(u){var h=Ws().memoizedState;return i3({ref:h,nextImpl:u}),function(){if((Fn&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}function o3(u,h){return sv(4,2,u,h)}function a3(u,h){return sv(4,4,u,h)}function l3(u,h){if(typeof h=="function"){u=u();var y=h(u);return function(){typeof y=="function"?y():h(null)}}if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function c3(u,h,y){y=y!=null?y.concat([u]):null,sv(4,4,l3.bind(null,h,u),y)}function gb(){}function u3(u,h){var y=Ws();h=h===void 0?null:h;var T=y.memoizedState;return h!==null&&tb(h,T[1])?T[0]:(y.memoizedState=[u,h],u)}function d3(u,h){var y=Ws();h=h===void 0?null:h;var T=y.memoizedState;if(h!==null&&tb(h,T[1]))return T[0];if(T=u(),kh){ut(!0);try{u()}finally{ut(!1)}}return y.memoizedState=[T,h],T}function xb(u,h,y){return y===void 0||(ls&1073741824)!==0&&(Mr&261930)===0?u.memoizedState=h:(u.memoizedState=y,u=jr(),yr.lanes|=u,Iu|=u,y)}function f3(u,h,y,T){return nr(y,h)?y:Yp.current!==null?(u=xb(u,y,T),nr(u,h)||(lo=!0),u):(ls&42)===0||(ls&1073741824)!==0&&(Mr&261930)===0?(lo=!0,u.memoizedState=y):(u=jr(),yr.lanes|=u,Iu|=u,h)}function h3(u,h,y,T,I){var z=Z.p;Z.p=z!==0&&8>z?z:8;var de=X.T,Ie={};X.T=Ie,bb(u,!1,h,y);try{var st=I(),At=X.S;if(At!==null&&At(Ie,st),st!==null&&typeof st=="object"&&typeof st.then=="function"){var Bt=Xy(st,T);qm(u,h,Bt,Pl(u))}else qm(u,h,T,Pl(u))}catch($t){qm(u,h,{then:function(){},status:"rejected",reason:$t},Pl())}finally{Z.p=z,de!==null&&Ie.types!==null&&(de.types=Ie.types),X.T=de}}function JC(){}function vb(u,h,y,T){if(u.tag!==5)throw Error(r(476));var I=p3(u).queue;h3(u,I,h,K,y===null?JC:function(){return m3(u),y(T)})}function p3(u){var h=u.memoizedState;if(h!==null)return h;h={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ed,lastRenderedState:K},next:null};var y={};return h.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ed,lastRenderedState:y},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function m3(u){var h=p3(u);h.next===null&&(h=u.alternate.memoizedState),qm(u,h.next.queue,{},Pl())}function yb(){return rr(Bb)}function g3(){return Ws().memoizedState}function x3(){return Ws().memoizedState}function eE(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var y=Pl();u=Td(y);var T=mf(h,u,y);T!==null&&(Er(T,h,y),gf(T,h,y)),h={cache:Wy()},u.payload=h;return}h=h.return}}function tE(u,h,y){var T=Pl();y={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ov(u)?y3(h,y):(y=jx(u,h,y,T),y!==null&&(Er(y,u,T),b3(y,h,T)))}function v3(u,h,y){var T=Pl();qm(u,h,y,T)}function qm(u,h,y,T){var I={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(ov(u))y3(h,I);else{var z=u.alternate;if(u.lanes===0&&(z===null||z.lanes===0)&&(z=h.lastRenderedReducer,z!==null))try{var de=h.lastRenderedState,Ie=z(de,y);if(I.hasEagerState=!0,I.eagerState=Ie,nr(Ie,de))return Oo(u,h,I,0),ur===null&&Lm(),!1}catch{}finally{}if(y=jx(u,h,I,T),y!==null)return Er(y,u,T),b3(y,h,T),!0}return!1}function bb(u,h,y,T){if(T={lane:2,revertLane:Ot(),gesture:null,action:T,hasEagerState:!1,eagerState:null,next:null},ov(u)){if(h)throw Error(r(479))}else h=jx(u,y,T,2),h!==null&&Er(h,u,2)}function ov(u){var h=u.alternate;return u===yr||h!==null&&h===yr}function y3(u,h){Kp=lc=!0;var y=u.pending;y===null?h.next=h:(h.next=y.next,y.next=h),u.pending=h}function b3(u,h,y){if((y&4194048)!==0){var T=h.lanes;T&=u.pendingLanes,y|=T,h.lanes=y,Pt(u,y)}}var Qp={readContext:rr,use:xf,useCallback:Ss,useContext:Ss,useEffect:Ss,useImperativeHandle:Ss,useLayoutEffect:Ss,useInsertionEffect:Ss,useMemo:Ss,useReducer:Ss,useRef:Ss,useState:Ss,useDebugValue:Ss,useDeferredValue:Ss,useTransition:Ss,useSyncExternalStore:Ss,useId:Ss,useHostTransitionStatus:Ss,useFormState:Ss,useActionState:Ss,useOptimistic:Ss,useMemoCache:Ss,useCacheRefresh:Ss};Qp.useEffectEvent=Ss;var _3={readContext:rr,use:xf,useCallback:function(u,h){return yo().memoizedState=[u,h===void 0?null:h],u},useContext:rr,useEffect:r3,useImperativeHandle:function(u,h,y){y=y!=null?y.concat([u]):null,iv(4194308,4,l3.bind(null,h,u),y)},useLayoutEffect:function(u,h){return iv(4194308,4,u,h)},useInsertionEffect:function(u,h){iv(4,2,u,h)},useMemo:function(u,h){var y=yo();h=h===void 0?null:h;var T=u();if(kh){ut(!0);try{u()}finally{ut(!1)}}return y.memoizedState=[T,h],T},useReducer:function(u,h,y){var T=yo();if(y!==void 0){var I=y(h);if(kh){ut(!0);try{y(h)}finally{ut(!1)}}}else I=h;return T.memoizedState=T.baseState=I,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:I},T.queue=u,u=u.dispatch=tE.bind(null,yr,u),[T.memoizedState,u]},useRef:function(u){var h=yo();return u={current:u},h.memoizedState=u},useState:function(u){u=lb(u);var h=u.queue,y=v3.bind(null,yr,h);return h.dispatch=y,[u.memoizedState,y]},useDebugValue:gb,useDeferredValue:function(u,h){var y=yo();return xb(y,u,h)},useTransition:function(){var u=lb(!1);return u=h3.bind(null,yr,u.queue,!0,!1),yo().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,y){var T=yr,I=yo();if(Xr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=h(),ur===null)throw Error(r(349));(Mr&127)!==0||$w(T,h,y)}I.memoizedState=y;var z={value:y,getSnapshot:h};return I.queue=z,r3(Xw.bind(null,T,z,u),[u]),T.flags|=2048,vf(9,{destroy:void 0},qw.bind(null,T,z,y,h),null),y},useId:function(){var u=yo(),h=ur.identifierPrefix;if(Xr){var y=Fc,T=_s;y=(T&~(1<<32-De(T)-1)).toString(32)+y,h="_"+h+"R_"+y,y=Jx++,0<y&&(h+="H"+y.toString(32)),h+="_"}else y=eb++,h="_"+h+"r_"+y.toString(32)+"_";return u.memoizedState=h},useHostTransitionStatus:yb,useFormState:fb,useActionState:fb,useOptimistic:function(u){var h=yo();h.memoizedState=h.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=y,h=bb.bind(null,yr,!0,y),y.dispatch=h,[u,h]},useMemoCache:sb,useCacheRefresh:function(){return yo().memoizedState=eE.bind(null,yr)},useEffectEvent:function(u){var h=yo(),y={impl:u};return h.memoizedState=y,function(){if((Fn&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},_b={readContext:rr,use:xf,useCallback:u3,useContext:rr,useEffect:mb,useImperativeHandle:c3,useInsertionEffect:o3,useLayoutEffect:a3,useMemo:d3,useReducer:nv,useRef:rv,useState:function(){return nv(Ed)},useDebugValue:gb,useDeferredValue:function(u,h){var y=Ws();return f3(y,Oi.memoizedState,u,h)},useTransition:function(){var u=nv(Ed)[0],h=Ws().memoizedState;return[typeof u=="boolean"?u:$m(u),h]},useSyncExternalStore:Ww,useId:g3,useHostTransitionStatus:yb,useFormState:t3,useActionState:t3,useOptimistic:function(u,h){var y=Ws();return cb(y,Oi,u,h)},useMemoCache:sb,useCacheRefresh:x3};_b.useEffectEvent=s3;var cc={readContext:rr,use:xf,useCallback:u3,useContext:rr,useEffect:mb,useImperativeHandle:c3,useInsertionEffect:o3,useLayoutEffect:a3,useMemo:d3,useReducer:ab,useRef:rv,useState:function(){return ab(Ed)},useDebugValue:gb,useDeferredValue:function(u,h){var y=Ws();return Oi===null?xb(y,u,h):f3(y,Oi.memoizedState,u,h)},useTransition:function(){var u=ab(Ed)[0],h=Ws().memoizedState;return[typeof u=="boolean"?u:$m(u),h]},useSyncExternalStore:Ww,useId:g3,useHostTransitionStatus:yb,useFormState:pb,useActionState:pb,useOptimistic:function(u,h){var y=Ws();return Oi!==null?cb(y,Oi,u,h):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:sb,useCacheRefresh:x3};cc.useEffectEvent=s3;function av(u,h,y,T){h=u.memoizedState,y=y(T,h),y=y==null?h:p({},h,y),u.memoizedState=y,u.lanes===0&&(u.updateQueue.baseState=y)}var Xm={enqueueSetState:function(u,h,y){u=u._reactInternals;var T=Pl(),I=Td(T);I.payload=h,y!=null&&(I.callback=y),h=mf(u,I,T),h!==null&&(Er(h,u,T),gf(h,u,T))},enqueueReplaceState:function(u,h,y){u=u._reactInternals;var T=Pl(),I=Td(T);I.tag=1,I.payload=h,y!=null&&(I.callback=y),h=mf(u,I,T),h!==null&&(Er(h,u,T),gf(h,u,T))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var y=Pl(),T=Td(y);T.tag=2,h!=null&&(T.callback=h),h=mf(u,T,y),h!==null&&(Er(h,u,y),gf(h,u,y))}};function Sb(u,h,y,T,I,z,de){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(T,z,de):h.prototype&&h.prototype.isPureReactComponent?!hr(y,T)||!hr(I,z):!0}function wb(u,h,y,T){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(y,T),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(y,T),h.state!==u&&Xm.enqueueReplaceState(h,h.state,null)}function yf(u,h){var y=h;if("ref"in h){y={};for(var T in h)T!=="ref"&&(y[T]=h[T])}if(u=u.defaultProps){y===h&&(y=p({},y));for(var I in u)y[I]===void 0&&(y[I]=u[I])}return y}function S3(u){Om(u)}function Mb(u){console.error(u)}function Tb(u){Om(u)}function lv(u,h){try{var y=u.onUncaughtError;y(h.value,{componentStack:h.stack})}catch(T){setTimeout(function(){throw T})}}function w3(u,h,y){try{var T=u.onCaughtError;T(y.value,{componentStack:y.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(I){setTimeout(function(){throw I})}}function Cb(u,h,y){return y=Td(y),y.tag=3,y.payload={element:null},y.callback=function(){lv(u,h)},y}function Eb(u){return u=Td(u),u.tag=3,u}function M3(u,h,y,T){var I=y.type.getDerivedStateFromError;if(typeof I=="function"){var z=T.value;u.payload=function(){return I(z)},u.callback=function(){w3(h,y,T)}}var de=y.stateNode;de!==null&&typeof de.componentDidCatch=="function"&&(u.callback=function(){w3(h,y,T),typeof I!="function"&&(Xs===null?Xs=new Set([this]):Xs.add(this));var Ie=T.stack;this.componentDidCatch(T.value,{componentStack:Ie!==null?Ie:""})})}function bo(u,h,y,T,I){if(y.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){if(h=y.alternate,h!==null&&Cu(h,y,I,!0),y=tl.current,y!==null){switch(y.tag){case 31:case 13:return Oa===null?s0():y.alternate===null&&ws===0&&(ws=3),y.flags&=-257,y.flags|=65536,y.lanes=I,T===Xx?y.flags|=16384:(h=y.updateQueue,h===null?y.updateQueue=new Set([T]):h.add(T),og(u,T,I)),!1;case 22:return y.flags|=65536,T===Xx?y.flags|=16384:(h=y.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([T])},y.updateQueue=h):(y=h.retryQueue,y===null?h.retryQueue=new Set([T]):y.add(T)),og(u,T,I)),!1}throw Error(r(435,y.tag))}return og(u,T,I),s0(),!1}if(Xr)return h=tl.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=I,T!==Hp&&(u=Error(r(422),{cause:T}),wu(Tl(u,y)))):(T!==Hp&&(h=Error(r(423),{cause:T}),wu(Tl(h,y))),u=u.current.alternate,u.flags|=65536,I&=-I,u.lanes|=I,T=Tl(T,y),I=Cb(u.stateNode,T,I),Vn(u,I),ws!==4&&(ws=2)),!1;var z=Error(r(520),{cause:T});if(z=Tl(z,y),Bh===null?Bh=[z]:Bh.push(z),ws!==4&&(ws=2),h===null)return!0;T=Tl(T,y),y=h;do{switch(y.tag){case 3:return y.flags|=65536,u=I&-I,y.lanes|=u,u=Cb(y.stateNode,T,u),Vn(y,u),!1;case 1:if(h=y.type,z=y.stateNode,(y.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||z!==null&&typeof z.componentDidCatch=="function"&&(Xs===null||!Xs.has(z))))return y.flags|=65536,I&=-I,y.lanes|=I,I=Eb(I),M3(I,u,y,T),Vn(y,I),!1}y=y.return}while(y!==null);return!1}var cv=Error(r(461)),lo=!1;function Lo(u,h,y,T){h.child=u===null?Zx(h,null,y,T):Md(h,u.child,y,T)}function Ab(u,h,y,T,I){y=y.render;var z=h.ref;if("ref"in T){var de={};for(var Ie in T)Ie!=="ref"&&(de[Ie]=T[Ie])}else de=T;return hf(h),T=ev(u,h,y,de,z,I),Ie=nb(),u!==null&&!lo?(rb(u,h,I),$s(u,h,I)):(Xr&&Ie&&_u(h),h.flags|=1,Lo(u,h,T,I),h.child)}function Ih(u,h,y,T,I){if(u===null){var z=y.type;return typeof z=="function"&&!zx(z)&&z.defaultProps===void 0&&y.compare===null?(h.tag=15,h.type=z,uv(u,h,z,T,I)):(u=yu(y.type,null,T,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(z=u.child,!gv(u,I)){var de=z.memoizedProps;if(y=y.compare,y=y!==null?y:hr,y(de,T)&&u.ref===h.ref)return $s(u,h,I)}return h.flags|=1,u=Qa(z,T),u.ref=h.ref,u.return=h,h.child=u}function uv(u,h,y,T,I){if(u!==null){var z=u.memoizedProps;if(hr(z,T)&&u.ref===h.ref)if(lo=!1,h.pendingProps=T=z,gv(u,I))(u.flags&131072)!==0&&(lo=!0);else return h.lanes=u.lanes,$s(u,h,I)}return Jp(u,h,y,T,I)}function Oh(u,h,y,T){var I=T.children,z=u!==null?u.memoizedState:null;if(u===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),T.mode==="hidden"){if((h.flags&128)!==0){if(z=z!==null?z.baseLanes|y:y,u!==null){for(T=h.child=u.child,I=0;T!==null;)I=I|T.lanes|T.childLanes,T=T.sibling;T=I&~z}else T=0,h.child=null;return rl(u,h,z,y,T)}if((y&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&Fm(h,z!==null?z.cachePool:null),z!==null?Hw(h,z):Qy(),Vw(h);else return T=h.lanes=536870912,rl(u,h,z!==null?z.baseLanes|y:y,y,T)}else z!==null?(Fm(h,z.cachePool),Hw(h,z),nl(),h.memoizedState=null):(u!==null&&Fm(h,null),Qy(),nl());return Lo(u,h,I,y),h.child}function Au(u,h){return u!==null&&u.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function rl(u,h,y,T,I){var z=qx();return z=z===null?null:{parent:ao._currentValue,pool:z},h.memoizedState={baseLanes:y,cachePool:z},u!==null&&Fm(h,null),Qy(),Vw(h),u!==null&&Cu(u,h,T,!0),h.childLanes=I,null}function dv(u,h){return h=mv({mode:h.mode,children:h.children},u.mode),h.ref=u.ref,u.child=h,h.return=u,h}function T3(u,h,y){return Md(h,u.child,null,y),u=dv(h,h.pendingProps),u.flags|=2,Gs(h),h.memoizedState=null,u}function fv(u,h,y){var T=h.pendingProps,I=(h.flags&128)!==0;if(h.flags&=-129,u===null){if(Xr){if(T.mode==="hidden")return u=dv(h,T),h.lanes=536870912,Au(null,u);if(Jy(h),(u=Xi)?(u=fD(u,Cl),u=u!==null&&u.data==="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:bd!==null?{id:_s,overflow:Fc}:null,retryLane:536870912,hydrationErrors:null},y=Fp(u),y.return=h,h.child=y,Os=h,Xi=null)):u=null,u===null)throw Su(h);return h.lanes=536870912,null}return dv(h,T)}var z=u.memoizedState;if(z!==null){var de=z.dehydrated;if(Jy(h),I)if(h.flags&256)h.flags&=-257,h=T3(u,h,y);else if(h.memoizedState!==null)h.child=u.child,h.flags|=128,h=null;else throw Error(r(558));else if(lo||Cu(u,h,y,!1),I=(y&u.childLanes)!==0,lo||I){if(T=ur,T!==null&&(de=zt(T,y),de!==0&&de!==z.retryLane))throw z.retryLane=de,Pa(u,de),Er(T,u,de),cv;s0(),h=T3(u,h,y)}else u=z.treeContext,Xi=ju(de.nextSibling),Os=h,Xr=!0,_d=null,Cl=!1,u!==null&&Hx(h,u),h=dv(h,T),h.flags|=4096;return h}return u=Qa(u.child,{mode:T.mode,children:T.children}),u.ref=h.ref,h.child=u,u.return=h,u}function Lh(u,h){var y=h.ref;if(y===null)u!==null&&u.ref!==null&&(h.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(r(284));(u===null||u.ref!==y)&&(h.flags|=4194816)}}function Jp(u,h,y,T,I){return hf(h),y=ev(u,h,y,T,void 0,I),T=nb(),u!==null&&!lo?(rb(u,h,I),$s(u,h,I)):(Xr&&T&&_u(h),h.flags|=1,Lo(u,h,y,I),h.child)}function Ym(u,h,y,T,I,z){return hf(h),h.updateQueue=null,y=Dh(h,T,y,I),Gw(u),T=nb(),u!==null&&!lo?(rb(u,h,z),$s(u,h,z)):(Xr&&T&&_u(h),h.flags|=1,Lo(u,h,y,z),h.child)}function hv(u,h,y,T,I){if(hf(h),h.stateNode===null){var z=af,de=y.contextType;typeof de=="object"&&de!==null&&(z=rr(de)),z=new y(T,z),h.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,z.updater=Xm,h.stateNode=z,z._reactInternals=h,z=h.stateNode,z.props=T,z.state=h.memoizedState,z.refs={},Hm(h),de=y.contextType,z.context=typeof de=="object"&&de!==null?rr(de):af,z.state=h.memoizedState,de=y.getDerivedStateFromProps,typeof de=="function"&&(av(h,y,de,T),z.state=h.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(de=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),de!==z.state&&Xm.enqueueReplaceState(z,z.state,null),qp(h,T,z,I),Vm(),z.state=h.memoizedState),typeof z.componentDidMount=="function"&&(h.flags|=4194308),T=!0}else if(u===null){z=h.stateNode;var Ie=h.memoizedProps,st=yf(y,Ie);z.props=st;var At=z.context,Bt=y.contextType;de=af,typeof Bt=="object"&&Bt!==null&&(de=rr(Bt));var $t=y.getDerivedStateFromProps;Bt=typeof $t=="function"||typeof z.getSnapshotBeforeUpdate=="function",Ie=h.pendingProps!==Ie,Bt||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Ie||At!==de)&&wb(h,z,T,de),Ia=!1;var kt=h.memoizedState;z.state=kt,qp(h,T,z,I),Vm(),At=h.memoizedState,Ie||kt!==At||Ia?(typeof $t=="function"&&(av(h,y,$t,T),At=h.memoizedState),(st=Ia||Sb(h,y,st,T,kt,At,de))?(Bt||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(h.flags|=4194308)):(typeof z.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=T,h.memoizedState=At),z.props=T,z.state=At,z.context=de,T=st):(typeof z.componentDidMount=="function"&&(h.flags|=4194308),T=!1)}else{z=h.stateNode,Ky(u,h),de=h.memoizedProps,Bt=yf(y,de),z.props=Bt,$t=h.pendingProps,kt=z.context,At=y.contextType,st=af,typeof At=="object"&&At!==null&&(st=rr(At)),Ie=y.getDerivedStateFromProps,(At=typeof Ie=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(de!==$t||kt!==st)&&wb(h,z,T,st),Ia=!1,kt=h.memoizedState,z.state=kt,qp(h,T,z,I),Vm();var Ft=h.memoizedState;de!==$t||kt!==Ft||Ia||u!==null&&u.dependencies!==null&&zm(u.dependencies)?(typeof Ie=="function"&&(av(h,y,Ie,T),Ft=h.memoizedState),(Bt=Ia||Sb(h,y,Bt,T,kt,Ft,st)||u!==null&&u.dependencies!==null&&zm(u.dependencies))?(At||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(T,Ft,st),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(T,Ft,st)),typeof z.componentDidUpdate=="function"&&(h.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof z.componentDidUpdate!="function"||de===u.memoizedProps&&kt===u.memoizedState||(h.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||de===u.memoizedProps&&kt===u.memoizedState||(h.flags|=1024),h.memoizedProps=T,h.memoizedState=Ft),z.props=T,z.state=Ft,z.context=st,T=Bt):(typeof z.componentDidUpdate!="function"||de===u.memoizedProps&&kt===u.memoizedState||(h.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||de===u.memoizedProps&&kt===u.memoizedState||(h.flags|=1024),T=!1)}return z=T,Lh(u,h),T=(h.flags&128)!==0,z||T?(z=h.stateNode,y=T&&typeof y.getDerivedStateFromError!="function"?null:z.render(),h.flags|=1,u!==null&&T?(h.child=Md(h,u.child,null,I),h.child=Md(h,null,y,I)):Lo(u,h,y,I),h.memoizedState=z.state,u=h.child):u=$s(u,h,I),u}function C3(u,h,y,T){return df(),h.flags|=256,Lo(u,h,y,T),h.child}var Nb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ya(u){return{baseLanes:u,cachePool:Yy()}}function pv(u,h,y){return u=u!==null?u.childLanes&~y:0,h&&(u|=za),u}function E3(u,h,y){var T=h.pendingProps,I=!1,z=(h.flags&128)!==0,de;if((de=z)||(de=u!==null&&u.memoizedState===null?!1:(Yr.current&2)!==0),de&&(I=!0,h.flags&=-129),de=(h.flags&32)!==0,h.flags&=-33,u===null){if(Xr){if(I?Cd(h):nl(),(u=Xi)?(u=fD(u,Cl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:bd!==null?{id:_s,overflow:Fc}:null,retryLane:536870912,hydrationErrors:null},y=Fp(u),y.return=h,h.child=y,Os=h,Xi=null)):u=null,u===null)throw Su(h);return mE(u)?h.lanes=32:h.lanes=536870912,null}var Ie=T.children;return T=T.fallback,I?(nl(),I=h.mode,Ie=mv({mode:"hidden",children:Ie},I),T=lf(T,I,y,null),Ie.return=h,T.return=h,Ie.sibling=T,h.child=Ie,T=h.child,T.memoizedState=ya(y),T.childLanes=pv(u,de,y),h.memoizedState=Nb,Au(null,T)):(Cd(h),Km(h,Ie))}var st=u.memoizedState;if(st!==null&&(Ie=st.dehydrated,Ie!==null)){if(z)h.flags&256?(Cd(h),h.flags&=-257,h=Rb(u,h,y)):h.memoizedState!==null?(nl(),h.child=u.child,h.flags|=128,h=null):(nl(),Ie=T.fallback,I=h.mode,T=mv({mode:"visible",children:T.children},I),Ie=lf(Ie,I,y,null),Ie.flags|=2,T.return=h,Ie.return=h,T.sibling=Ie,h.child=T,Md(h,u.child,null,y),T=h.child,T.memoizedState=ya(y),T.childLanes=pv(u,de,y),h.memoizedState=Nb,h=Au(null,T));else if(Cd(h),mE(Ie)){if(de=Ie.nextSibling&&Ie.nextSibling.dataset,de)var At=de.dgst;de=At,T=Error(r(419)),T.stack="",T.digest=de,wu({value:T,source:null,stack:null}),h=Rb(u,h,y)}else if(lo||Cu(u,h,y,!1),de=(y&u.childLanes)!==0,lo||de){if(de=ur,de!==null&&(T=zt(de,y),T!==0&&T!==st.retryLane))throw st.retryLane=T,Pa(u,T),Er(de,u,T),cv;pE(Ie)||s0(),h=Rb(u,h,y)}else pE(Ie)?(h.flags|=192,h.child=u.child,h=null):(u=st.treeContext,Xi=ju(Ie.nextSibling),Os=h,Xr=!0,_d=null,Cl=!1,u!==null&&Hx(h,u),h=Km(h,T.children),h.flags|=4096);return h}return I?(nl(),Ie=T.fallback,I=h.mode,st=u.child,At=st.sibling,T=Qa(st,{mode:"hidden",children:T.children}),T.subtreeFlags=st.subtreeFlags&65011712,At!==null?Ie=Qa(At,Ie):(Ie=lf(Ie,I,y,null),Ie.flags|=2),Ie.return=h,T.return=h,T.sibling=Ie,h.child=T,Au(null,T),T=h.child,Ie=u.child.memoizedState,Ie===null?Ie=ya(y):(I=Ie.cachePool,I!==null?(st=ao._currentValue,I=I.parent!==st?{parent:st,pool:st}:I):I=Yy(),Ie={baseLanes:Ie.baseLanes|y,cachePool:I}),T.memoizedState=Ie,T.childLanes=pv(u,de,y),h.memoizedState=Nb,Au(u.child,T)):(Cd(h),y=u.child,u=y.sibling,y=Qa(y,{mode:"visible",children:T.children}),y.return=h,y.sibling=null,u!==null&&(de=h.deletions,de===null?(h.deletions=[u],h.flags|=16):de.push(u)),h.child=y,h.memoizedState=null,y)}function Km(u,h){return h=mv({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function mv(u,h){return u=bs(22,u,null,h),u.lanes=0,u}function Rb(u,h,y){return Md(h,u.child,null,y),u=Km(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function A3(u,h,y){u.lanes|=h;var T=u.alternate;T!==null&&(T.lanes|=h),Gx(u.return,h,y)}function jh(u,h,y,T,I,z){var de=u.memoizedState;de===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:T,tail:y,tailMode:I,treeForkCount:z}:(de.isBackwards=h,de.rendering=null,de.renderingStartTime=0,de.last=T,de.tail=y,de.tailMode=I,de.treeForkCount=z)}function il(u,h,y){var T=h.pendingProps,I=T.revealOrder,z=T.tail;T=T.children;var de=Yr.current,Ie=(de&2)!==0;if(Ie?(de=de&1|2,h.flags|=128):de&=1,j(Yr,de),Lo(u,h,T,y),T=Xr?Bp:0,!Ie&&u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&A3(u,y,h);else if(u.tag===19)A3(u,y,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(I){case"forwards":for(y=h.child,I=null;y!==null;)u=y.alternate,u!==null&&Al(u)===null&&(I=y),y=y.sibling;y=I,y===null?(I=h.child,h.child=null):(I=y.sibling,y.sibling=null),jh(h,!1,I,y,z,T);break;case"backwards":case"unstable_legacy-backwards":for(y=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&Al(u)===null){h.child=I;break}u=I.sibling,I.sibling=y,y=I,I=u}jh(h,!0,y,null,z,T);break;case"together":jh(h,!1,null,null,void 0,T);break;default:h.memoizedState=null}return h.child}function $s(u,h,y){if(u!==null&&(h.dependencies=u.dependencies),Iu|=h.lanes,(y&h.childLanes)===0)if(u!==null){if(Cu(u,h,y,!1),(y&h.childLanes)===0)return null}else return null;if(u!==null&&h.child!==u.child)throw Error(r(153));if(h.child!==null){for(u=h.child,y=Qa(u,u.pendingProps),h.child=y,y.return=h;u.sibling!==null;)u=u.sibling,y=y.sibling=Qa(u,u.pendingProps),y.return=h;y.sibling=null}return h.child}function gv(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&zm(u)))}function nE(u,h,y){switch(h.tag){case 3:le(h,h.stateNode.containerInfo),Sd(h,ao,u.memoizedState.cache),df();break;case 27:case 5:pe(h);break;case 4:le(h,h.stateNode.containerInfo);break;case 10:Sd(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,Jy(h),null;break;case 13:var T=h.memoizedState;if(T!==null)return T.dehydrated!==null?(Cd(h),h.flags|=128,null):(y&h.child.childLanes)!==0?E3(u,h,y):(Cd(h),u=$s(u,h,y),u!==null?u.sibling:null);Cd(h);break;case 19:var I=(u.flags&128)!==0;if(T=(y&h.childLanes)!==0,T||(Cu(u,h,y,!1),T=(y&h.childLanes)!==0),I){if(T)return il(u,h,y);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),j(Yr,Yr.current),T)break;return null;case 22:return h.lanes=0,Oh(u,h,y,h.pendingProps);case 24:Sd(h,ao,u.memoizedState.cache)}return $s(u,h,y)}function xv(u,h,y){if(u!==null)if(u.memoizedProps!==h.pendingProps)lo=!0;else{if(!gv(u,y)&&(h.flags&128)===0)return lo=!1,nE(u,h,y);lo=(u.flags&131072)!==0}else lo=!1,Xr&&(h.flags&1048576)!==0&&Ow(h,Bp,h.index);switch(h.lanes=0,h.tag){case 16:e:{var T=h.pendingProps;if(u=Ch(h.elementType),h.type=u,typeof u=="function")zx(u)?(T=yf(u,T),h.tag=1,h=hv(null,h,u,T,y)):(h.tag=0,h=Jp(null,h,u,T,y));else{if(u!=null){var I=u.$$typeof;if(I===N){h.tag=11,h=Ab(null,h,u,T,y);break e}else if(I===O){h.tag=14,h=Ih(null,h,u,T,y);break e}}throw h=Y(u)||u,Error(r(306,h,""))}}return h;case 0:return Jp(u,h,h.type,h.pendingProps,y);case 1:return T=h.type,I=yf(T,h.pendingProps),hv(u,h,T,I,y);case 3:e:{if(le(h,h.stateNode.containerInfo),u===null)throw Error(r(387));T=h.pendingProps;var z=h.memoizedState;I=z.element,Ky(u,h),qp(h,T,null,y);var de=h.memoizedState;if(T=de.cache,Sd(h,ao,T),T!==z.cache&&Wx(h,[ao],y,!0),Vm(),T=de.element,z.isDehydrated)if(z={element:T,isDehydrated:!1,cache:de.cache},h.updateQueue.baseState=z,h.memoizedState=z,h.flags&256){h=C3(u,h,T,y);break e}else if(T!==I){I=Tl(Error(r(424)),h),wu(I),h=C3(u,h,T,y);break e}else{switch(u=h.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Xi=ju(u.firstChild),Os=h,Xr=!0,_d=null,Cl=!0,y=Zx(h,null,T,y),h.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(df(),T===I){h=$s(u,h,y);break e}Lo(u,h,T,y)}h=h.child}return h;case 26:return Lh(u,h),u===null?(y=vD(h.type,null,h.pendingProps,null))?h.memoizedState=y:Xr||(y=h.type,u=h.pendingProps,T=D3(te.current).createElement(y),T[It]=h,T[Tt]=u,Ua(T,y,u),rt(T),h.stateNode=T):h.memoizedState=vD(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return pe(h),u===null&&Xr&&(T=h.stateNode=mD(h.type,h.pendingProps,te.current),Os=h,Cl=!0,I=Xi,c0(h.type)?(gE=I,Xi=ju(T.firstChild)):Xi=I),Lo(u,h,h.pendingProps.children,y),Lh(u,h),u===null&&(h.flags|=4194304),h.child;case 5:return u===null&&Xr&&((I=T=Xi)&&(T=FZ(T,h.type,h.pendingProps,Cl),T!==null?(h.stateNode=T,Os=h,Xi=ju(T.firstChild),Cl=!1,I=!0):I=!1),I||Su(h)),pe(h),I=h.type,z=h.pendingProps,de=u!==null?u.memoizedProps:null,T=z.children,dE(I,z)?T=null:de!==null&&dE(I,de)&&(h.flags|=32),h.memoizedState!==null&&(I=ev(u,h,Ph,null,null,y),Bb._currentValue=I),Lh(u,h),Lo(u,h,T,y),h.child;case 6:return u===null&&Xr&&((u=y=Xi)&&(y=UZ(y,h.pendingProps,Cl),y!==null?(h.stateNode=y,Os=h,Xi=null,u=!0):u=!1),u||Su(h)),null;case 13:return E3(u,h,y);case 4:return le(h,h.stateNode.containerInfo),T=h.pendingProps,u===null?h.child=Md(h,null,T,y):Lo(u,h,T,y),h.child;case 11:return Ab(u,h,h.type,h.pendingProps,y);case 7:return Lo(u,h,h.pendingProps,y),h.child;case 8:return Lo(u,h,h.pendingProps.children,y),h.child;case 12:return Lo(u,h,h.pendingProps.children,y),h.child;case 10:return T=h.pendingProps,Sd(h,h.type,T.value),Lo(u,h,T.children,y),h.child;case 9:return I=h.type._context,T=h.pendingProps.children,hf(h),I=rr(I),T=T(I),h.flags|=1,Lo(u,h,T,y),h.child;case 14:return Ih(u,h,h.type,h.pendingProps,y);case 15:return uv(u,h,h.type,h.pendingProps,y);case 19:return il(u,h,y);case 31:return fv(u,h,y);case 22:return Oh(u,h,y,h.pendingProps);case 24:return hf(h),T=rr(ao),u===null?(I=qx(),I===null&&(I=ur,z=Wy(),I.pooledCache=z,z.refCount++,z!==null&&(I.pooledCacheLanes|=y),I=z),h.memoizedState={parent:T,cache:I},Hm(h),Sd(h,ao,I)):((u.lanes&y)!==0&&(Ky(u,h),qp(h,null,null,y),Vm()),I=u.memoizedState,z=h.memoizedState,I.parent!==T?(I={parent:T,cache:T},h.memoizedState=I,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=I),Sd(h,ao,T)):(T=z.cache,Sd(h,ao,T),T!==I.cache&&Wx(h,[ao],y,!0))),Lo(u,h,h.pendingProps.children,y),h.child;case 29:throw h.pendingProps}throw Error(r(156,h.tag))}function Nu(u){u.flags|=4}function Zm(u,h,y,T,I){if((h=(u.mode&32)!==0)&&(h=!1),h){if(u.flags|=16777216,(I&335544128)===I)if(u.stateNode.complete)u.flags|=8192;else if(Ts())u.flags|=8192;else throw Eu=Xx,Um}else u.flags&=-16777217}function kb(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!wD(h))if(Ts())u.flags|=8192;else throw Eu=Xx,Um}function Ad(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?et():536870912,u.lanes|=h,es|=h)}function Ru(u,h){if(!Xr)switch(u.tailMode){case"hidden":h=u.tail;for(var y=null;h!==null;)h.alternate!==null&&(y=h),h=h.sibling;y===null?u.tail=null:y.sibling=null;break;case"collapsed":y=u.tail;for(var T=null;y!==null;)y.alternate!==null&&(T=y),y=y.sibling;T===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:T.sibling=null}}function Li(u){var h=u.alternate!==null&&u.alternate.child===u.child,y=0,T=0;if(h)for(var I=u.child;I!==null;)y|=I.lanes|I.childLanes,T|=I.subtreeFlags&65011712,T|=I.flags&65011712,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)y|=I.lanes|I.childLanes,T|=I.subtreeFlags,T|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=T,u.childLanes=y,h}function Qm(u,h,y){var T=h.pendingProps;switch(Bx(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Li(h),null;case 1:return Li(h),null;case 3:return y=h.stateNode,T=null,u!==null&&(T=u.memoizedState.cache),h.memoizedState.cache!==T&&(h.flags|=2048),Tu(ao),re(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(Vp(h)?Nu(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Vx())),Li(h),null;case 26:var I=h.type,z=h.memoizedState;return u===null?(Nu(h),z!==null?(Li(h),kb(h,z)):(Li(h),Zm(h,I,null,T,y))):z?z!==u.memoizedState?(Nu(h),Li(h),kb(h,z)):(Li(h),h.flags&=-16777217):(u=u.memoizedProps,u!==T&&Nu(h),Li(h),Zm(h,I,u,T,y)),null;case 27:if(be(h),y=te.current,I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Nu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Li(h),null}u=ie.current,Vp(h)?Lw(h):(u=mD(I,T,y),h.stateNode=u,Nu(h))}return Li(h),null;case 5:if(be(h),I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Nu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Li(h),null}if(z=ie.current,Vp(h))Lw(h);else{var de=D3(te.current);switch(z){case 1:z=de.createElementNS("http://www.w3.org/2000/svg",I);break;case 2:z=de.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;default:switch(I){case"svg":z=de.createElementNS("http://www.w3.org/2000/svg",I);break;case"math":z=de.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;case"script":z=de.createElement("div"),z.innerHTML="<script><\/script>",z=z.removeChild(z.firstChild);break;case"select":z=typeof T.is=="string"?de.createElement("select",{is:T.is}):de.createElement("select"),T.multiple?z.multiple=!0:T.size&&(z.size=T.size);break;default:z=typeof T.is=="string"?de.createElement(I,{is:T.is}):de.createElement(I)}}z[It]=h,z[Tt]=T;e:for(de=h.child;de!==null;){if(de.tag===5||de.tag===6)z.appendChild(de.stateNode);else if(de.tag!==4&&de.tag!==27&&de.child!==null){de.child.return=de,de=de.child;continue}if(de===h)break e;for(;de.sibling===null;){if(de.return===null||de.return===h)break e;de=de.return}de.sibling.return=de.return,de=de.sibling}h.stateNode=z;e:switch(Ua(z,I,T),I){case"button":case"input":case"select":case"textarea":T=!!T.autoFocus;break e;case"img":T=!0;break e;default:T=!1}T&&Nu(h)}}return Li(h),Zm(h,h.type,u===null?null:u.memoizedProps,h.pendingProps,y),null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==T&&Nu(h);else{if(typeof T!="string"&&h.stateNode===null)throw Error(r(166));if(u=te.current,Vp(h)){if(u=h.stateNode,y=h.memoizedProps,T=null,I=Os,I!==null)switch(I.tag){case 27:case 5:T=I.memoizedProps}u[It]=h,u=!!(u.nodeValue===y||T!==null&&T.suppressHydrationWarning===!0||iD(u.nodeValue,y)),u||Su(h,!0)}else u=D3(u).createTextNode(T),u[It]=h,h.stateNode=u}return Li(h),null;case 31:if(y=h.memoizedState,u===null||u.memoizedState!==null){if(T=Vp(h),y!==null){if(u===null){if(!T)throw Error(r(318));if(u=h.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[It]=h}else df(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Li(h),u=!1}else y=Vx(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return h.flags&256?(Gs(h),h):(Gs(h),null);if((h.flags&128)!==0)throw Error(r(558))}return Li(h),null;case 13:if(T=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(I=Vp(h),T!==null&&T.dehydrated!==null){if(u===null){if(!I)throw Error(r(318));if(I=h.memoizedState,I=I!==null?I.dehydrated:null,!I)throw Error(r(317));I[It]=h}else df(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Li(h),I=!1}else I=Vx(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=I),I=!0;if(!I)return h.flags&256?(Gs(h),h):(Gs(h),null)}return Gs(h),(h.flags&128)!==0?(h.lanes=y,h):(y=T!==null,u=u!==null&&u.memoizedState!==null,y&&(T=h.child,I=null,T.alternate!==null&&T.alternate.memoizedState!==null&&T.alternate.memoizedState.cachePool!==null&&(I=T.alternate.memoizedState.cachePool.pool),z=null,T.memoizedState!==null&&T.memoizedState.cachePool!==null&&(z=T.memoizedState.cachePool.pool),z!==I&&(T.flags|=2048)),y!==u&&y&&(h.child.flags|=8192),Ad(h,h.updateQueue),Li(h),null);case 4:return re(),u===null&&oE(h.stateNode.containerInfo),Li(h),null;case 10:return Tu(h.type),Li(h),null;case 19:if(G(Yr),T=h.memoizedState,T===null)return Li(h),null;if(I=(h.flags&128)!==0,z=T.rendering,z===null)if(I)Ru(T,!1);else{if(ws!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(z=Al(u),z!==null){for(h.flags|=128,Ru(T,!1),u=z.updateQueue,h.updateQueue=u,Ad(h,u),h.subtreeFlags=0,u=y,y=h.child;y!==null;)zp(y,u),y=y.sibling;return j(Yr,Yr.current&1|2),Xr&&bu(h,T.treeForkCount),h.child}u=u.sibling}T.tail!==null&&Q()>qs&&(h.flags|=128,I=!0,Ru(T,!1),h.lanes=4194304)}else{if(!I)if(u=Al(z),u!==null){if(h.flags|=128,I=!0,u=u.updateQueue,h.updateQueue=u,Ad(h,u),Ru(T,!0),T.tail===null&&T.tailMode==="hidden"&&!z.alternate&&!Xr)return Li(h),null}else 2*Q()-T.renderingStartTime>qs&&y!==536870912&&(h.flags|=128,I=!0,Ru(T,!1),h.lanes=4194304);T.isBackwards?(z.sibling=h.child,h.child=z):(u=T.last,u!==null?u.sibling=z:h.child=z,T.last=z)}return T.tail!==null?(u=T.tail,T.rendering=u,T.tail=u.sibling,T.renderingStartTime=Q(),u.sibling=null,y=Yr.current,j(Yr,I?y&1|2:y&1),Xr&&bu(h,T.treeForkCount),u):(Li(h),null);case 22:case 23:return Gs(h),Gm(),T=h.memoizedState!==null,u!==null?u.memoizedState!==null!==T&&(h.flags|=8192):T&&(h.flags|=8192),T?(y&536870912)!==0&&(h.flags&128)===0&&(Li(h),h.subtreeFlags&6&&(h.flags|=8192)):Li(h),y=h.updateQueue,y!==null&&Ad(h,y.retryQueue),y=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),T=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(T=h.memoizedState.cachePool.pool),T!==y&&(h.flags|=2048),u!==null&&G(pf),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),h.memoizedState.cache!==y&&(h.flags|=2048),Tu(ao),Li(h),null;case 25:return null;case 30:return null}throw Error(r(156,h.tag))}function uc(u,h){switch(Bx(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return Tu(ao),re(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return be(h),null;case 31:if(h.memoizedState!==null){if(Gs(h),h.alternate===null)throw Error(r(340));df()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 13:if(Gs(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(r(340));df()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return G(Yr),null;case 4:return re(),null;case 10:return Tu(h.type),null;case 22:case 23:return Gs(h),Gm(),u!==null&&G(pf),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return Tu(ao),null;case 25:return null;default:return null}}function Nl(u,h){switch(Bx(h),h.tag){case 3:Tu(ao),re();break;case 26:case 27:case 5:be(h);break;case 4:re();break;case 31:h.memoizedState!==null&&Gs(h);break;case 13:Gs(h);break;case 19:G(Yr);break;case 10:Tu(h.type);break;case 22:case 23:Gs(h),Gm(),u!==null&&G(pf);break;case 24:Tu(ao)}}function dc(u,h){try{var y=h.updateQueue,T=y!==null?y.lastEffect:null;if(T!==null){var I=T.next;y=I;do{if((y.tag&u)===u){T=void 0;var z=y.create,de=y.inst;T=z(),de.destroy=T}y=y.next}while(y!==I)}}catch(Ie){ci(h,h.return,Ie)}}function Zo(u,h,y){try{var T=h.updateQueue,I=T!==null?T.lastEffect:null;if(I!==null){var z=I.next;T=z;do{if((T.tag&u)===u){var de=T.inst,Ie=de.destroy;if(Ie!==void 0){de.destroy=void 0,I=h;var st=y,At=Ie;try{At()}catch(Bt){ci(I,st,Bt)}}}T=T.next}while(T!==z)}}catch(Bt){ci(h,h.return,Bt)}}function Uc(u){var h=u.updateQueue;if(h!==null){var y=u.stateNode;try{Bw(h,y)}catch(T){ci(u,u.return,T)}}}function jo(u,h,y){y.props=yf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(T){ci(u,h,T)}}function Nd(u,h){try{var y=u.ref;if(y!==null){switch(u.tag){case 26:case 27:case 5:var T=u.stateNode;break;case 30:T=u.stateNode;break;default:T=u.stateNode}typeof y=="function"?u.refCleanup=y(T):y.current=T}}catch(I){ci(u,h,I)}}function Qo(u,h){var y=u.ref,T=u.refCleanup;if(y!==null)if(typeof T=="function")try{T()}catch(I){ci(u,h,I)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(I){ci(u,h,I)}else y.current=null}function Jm(u){var h=u.type,y=u.memoizedProps,T=u.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":y.autoFocus&&T.focus();break e;case"img":y.src?T.src=y.src:y.srcSet&&(T.srcset=y.srcSet)}}catch(I){ci(u,u.return,I)}}function _o(u,h,y){try{var T=u.stateNode;PZ(T,u.type,y,h),T[Tt]=h}catch(I){ci(u,u.return,I)}}function cs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&c0(u.type)||u.tag===4}function Gr(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||cs(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&c0(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function ku(u,h,y){var T=u.tag;if(T===5||T===6)u=u.stateNode,h?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(u,h):(h=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,h.appendChild(u),y=y._reactRootContainer,y!=null||h.onclick!==null||(h.onclick=ks));else if(T!==4&&(T===27&&c0(u.type)&&(y=u.stateNode,h=null),u=u.child,u!==null))for(ku(u,h,y),u=u.sibling;u!==null;)ku(u,h,y),u=u.sibling}function La(u,h,y){var T=u.tag;if(T===5||T===6)u=u.stateNode,h?y.insertBefore(u,h):y.appendChild(u);else if(T!==4&&(T===27&&c0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(La(u,h,y),u=u.sibling;u!==null;)La(u,h,y),u=u.sibling}function vv(u){var h=u.stateNode,y=u.memoizedProps;try{for(var T=u.type,I=h.attributes;I.length;)h.removeAttributeNode(I[0]);Ua(h,T,y),h[It]=u,h[Tt]=y}catch(z){ci(u,u.return,z)}}var fc=!1,Yi=!1,Bc=!1,N3=typeof WeakSet=="function"?WeakSet:Set,zo=null;function rE(u,h){if(u=u.containerInfo,cE=F3,u=Ji(u),Ps(u)){if("selectionStart"in u)var y={start:u.selectionStart,end:u.selectionEnd};else e:{y=(y=u.ownerDocument)&&y.defaultView||window;var T=y.getSelection&&y.getSelection();if(T&&T.rangeCount!==0){y=T.anchorNode;var I=T.anchorOffset,z=T.focusNode;T=T.focusOffset;try{y.nodeType,z.nodeType}catch{y=null;break e}var de=0,Ie=-1,st=-1,At=0,Bt=0,$t=u,kt=null;t:for(;;){for(var Ft;$t!==y||I!==0&&$t.nodeType!==3||(Ie=de+I),$t!==z||T!==0&&$t.nodeType!==3||(st=de+T),$t.nodeType===3&&(de+=$t.nodeValue.length),(Ft=$t.firstChild)!==null;)kt=$t,$t=Ft;for(;;){if($t===u)break t;if(kt===y&&++At===I&&(Ie=de),kt===z&&++Bt===T&&(st=de),(Ft=$t.nextSibling)!==null)break;$t=kt,kt=$t.parentNode}$t=Ft}y=Ie===-1||st===-1?null:{start:Ie,end:st}}else y=null}y=y||{start:0,end:0}}else y=null;for(uE={focusedElem:u,selectionRange:y},F3=!1,zo=h;zo!==null;)if(h=zo,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,zo=u;else for(;zo!==null;){switch(h=zo,z=h.alternate,u=h.flags,h.tag){case 0:if((u&4)!==0&&(u=h.updateQueue,u=u!==null?u.events:null,u!==null))for(y=0;y<u.length;y++)I=u[y],I.ref.impl=I.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&z!==null){u=void 0,y=h,I=z.memoizedProps,z=z.memoizedState,T=y.stateNode;try{var Pn=yf(y.type,I);u=T.getSnapshotBeforeUpdate(Pn,z),T.__reactInternalSnapshotBeforeUpdate=u}catch(Qn){ci(y,y.return,Qn)}}break;case 3:if((u&1024)!==0){if(u=h.stateNode.containerInfo,y=u.nodeType,y===9)hE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":hE(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(r(163))}if(u=h.sibling,u!==null){u.return=h.return,zo=u;break}zo=h.return}}function us(u,h,y){var T=y.flags;switch(y.tag){case 0:case 11:case 15:mc(u,y),T&4&&dc(5,y);break;case 1:if(mc(u,y),T&4)if(u=y.stateNode,h===null)try{u.componentDidMount()}catch(de){ci(y,y.return,de)}else{var I=yf(y.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(I,h,u.__reactInternalSnapshotBeforeUpdate)}catch(de){ci(y,y.return,de)}}T&64&&Uc(y),T&512&&Nd(y,y.return);break;case 3:if(mc(u,y),T&64&&(u=y.updateQueue,u!==null)){if(h=null,y.child!==null)switch(y.child.tag){case 27:case 5:h=y.child.stateNode;break;case 1:h=y.child.stateNode}try{Bw(u,h)}catch(de){ci(y,y.return,de)}}break;case 27:h===null&&T&4&&vv(y);case 26:case 5:mc(u,y),h===null&&T&4&&Jm(y),T&512&&Nd(y,y.return);break;case 12:mc(u,y);break;case 31:mc(u,y),T&4&&bf(u,y);break;case 13:mc(u,y),T&4&&e0(u,y),T&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=E.bind(null,y),BZ(u,y))));break;case 22:if(T=y.memoizedState!==null||fc,!T){h=h!==null&&h.memoizedState!==null||Yi,I=fc;var z=Yi;fc=T,(Yi=h)&&!z?ja(u,y,(y.subtreeFlags&8772)!==0):mc(u,y),fc=I,Yi=z}break;case 30:break;default:mc(u,y)}}function eg(u){var h=u.alternate;h!==null&&(u.alternate=null,eg(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&Hn(h)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var Ei=null,ba=!1;function hc(u,h,y){for(y=y.child;y!==null;)yv(u,h,y),y=y.sibling}function yv(u,h,y){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(Ze,y)}catch{}switch(y.tag){case 26:Yi||Qo(y,h),hc(u,h,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Yi||Qo(y,h);var T=Ei,I=ba;c0(y.type)&&(Ei=y.stateNode,ba=!1),hc(u,h,y),zb(y.stateNode),Ei=T,ba=I;break;case 5:Yi||Qo(y,h);case 6:if(T=Ei,I=ba,Ei=null,hc(u,h,y),Ei=T,ba=I,Ei!==null)if(ba)try{(Ei.nodeType===9?Ei.body:Ei.nodeName==="HTML"?Ei.ownerDocument.body:Ei).removeChild(y.stateNode)}catch(z){ci(y,h,z)}else try{Ei.removeChild(y.stateNode)}catch(z){ci(y,h,z)}break;case 18:Ei!==null&&(ba?(u=Ei,uD(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),Ev(u)):uD(Ei,y.stateNode));break;case 4:T=Ei,I=ba,Ei=y.stateNode.containerInfo,ba=!0,hc(u,h,y),Ei=T,ba=I;break;case 0:case 11:case 14:case 15:Zo(2,y,h),Yi||Zo(4,y,h),hc(u,h,y);break;case 1:Yi||(Qo(y,h),T=y.stateNode,typeof T.componentWillUnmount=="function"&&jo(y,h,T)),hc(u,h,y);break;case 21:hc(u,h,y);break;case 22:Yi=(T=Yi)||y.memoizedState!==null,hc(u,h,y),Yi=T;break;default:hc(u,h,y)}}function bf(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{Ev(u)}catch(y){ci(h,h.return,y)}}}function e0(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Ev(u)}catch(y){ci(h,h.return,y)}}function Db(u){switch(u.tag){case 31:case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new N3),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new N3),h;default:throw Error(r(435,u.tag))}}function Rd(u,h){var y=Db(u);h.forEach(function(T){if(!y.has(T)){y.add(T);var I=k.bind(null,u,T);T.then(I,I)}})}function So(u,h){var y=h.deletions;if(y!==null)for(var T=0;T<y.length;T++){var I=y[T],z=u,de=h,Ie=de;e:for(;Ie!==null;){switch(Ie.tag){case 27:if(c0(Ie.type)){Ei=Ie.stateNode,ba=!1;break e}break;case 5:Ei=Ie.stateNode,ba=!1;break e;case 3:case 4:Ei=Ie.stateNode.containerInfo,ba=!0;break e}Ie=Ie.return}if(Ei===null)throw Error(r(160));yv(z,de,I),Ei=null,ba=!1,z=I.alternate,z!==null&&(z.return=null),I.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)_f(h,u),h=h.sibling}var pc=null;function _f(u,h){var y=u.alternate,T=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:So(h,u),wo(u),T&4&&(Zo(3,u,u.return),dc(3,u),Zo(5,u,u.return));break;case 1:So(h,u),wo(u),T&512&&(Yi||y===null||Qo(y,y.return)),T&64&&fc&&(u=u.updateQueue,u!==null&&(T=u.callbacks,T!==null&&(y=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=y===null?T:y.concat(T))));break;case 26:var I=pc;if(So(h,u),wo(u),T&512&&(Yi||y===null||Qo(y,y.return)),T&4){var z=y!==null?y.memoizedState:null;if(T=u.memoizedState,y===null)if(T===null)if(u.stateNode===null){e:{T=u.type,y=u.memoizedProps,I=I.ownerDocument||I;t:switch(T){case"title":z=I.getElementsByTagName("title")[0],(!z||z[En]||z[It]||z.namespaceURI==="http://www.w3.org/2000/svg"||z.hasAttribute("itemprop"))&&(z=I.createElement(T),I.head.insertBefore(z,I.querySelector("head > title"))),Ua(z,T,y),z[It]=u,rt(z),T=z;break e;case"link":var de=_D("link","href",I).get(T+(y.href||""));if(de){for(var Ie=0;Ie<de.length;Ie++)if(z=de[Ie],z.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&z.getAttribute("rel")===(y.rel==null?null:y.rel)&&z.getAttribute("title")===(y.title==null?null:y.title)&&z.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){de.splice(Ie,1);break t}}z=I.createElement(T),Ua(z,T,y),I.head.appendChild(z);break;case"meta":if(de=_D("meta","content",I).get(T+(y.content||""))){for(Ie=0;Ie<de.length;Ie++)if(z=de[Ie],z.getAttribute("content")===(y.content==null?null:""+y.content)&&z.getAttribute("name")===(y.name==null?null:y.name)&&z.getAttribute("property")===(y.property==null?null:y.property)&&z.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&z.getAttribute("charset")===(y.charSet==null?null:y.charSet)){de.splice(Ie,1);break t}}z=I.createElement(T),Ua(z,T,y),I.head.appendChild(z);break;default:throw Error(r(468,T))}z[It]=u,rt(z),T=z}u.stateNode=T}else SD(I,u.type,u.stateNode);else u.stateNode=bD(I,T,u.memoizedProps);else z!==T?(z===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):z.count--,T===null?SD(I,u.type,u.stateNode):bD(I,T,u.memoizedProps)):T===null&&u.stateNode!==null&&_o(u,u.memoizedProps,y.memoizedProps)}break;case 27:So(h,u),wo(u),T&512&&(Yi||y===null||Qo(y,y.return)),y!==null&&T&4&&_o(u,u.memoizedProps,y.memoizedProps);break;case 5:if(So(h,u),wo(u),T&512&&(Yi||y===null||Qo(y,y.return)),u.flags&32){I=u.stateNode;try{Rs(I,"")}catch(Pn){ci(u,u.return,Pn)}}T&4&&u.stateNode!=null&&(I=u.memoizedProps,_o(u,I,y!==null?y.memoizedProps:I)),T&1024&&(Bc=!0);break;case 6:if(So(h,u),wo(u),T&4){if(u.stateNode===null)throw Error(r(162));T=u.memoizedProps,y=u.stateNode;try{y.nodeValue=T}catch(Pn){ci(u,u.return,Pn)}}break;case 3:if(O3=null,I=pc,pc=P3(h.containerInfo),So(h,u),pc=I,wo(u),T&4&&y!==null&&y.memoizedState.isDehydrated)try{Ev(h.containerInfo)}catch(Pn){ci(u,u.return,Pn)}Bc&&(Bc=!1,bv(u));break;case 4:T=pc,pc=P3(u.stateNode.containerInfo),So(h,u),wo(u),pc=T;break;case 12:So(h,u),wo(u);break;case 31:So(h,u),wo(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,Rd(u,T)));break;case 13:So(h,u),wo(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(t0=Q()),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,Rd(u,T)));break;case 22:I=u.memoizedState!==null;var st=y!==null&&y.memoizedState!==null,At=fc,Bt=Yi;if(fc=At||I,Yi=Bt||st,So(h,u),Yi=Bt,fc=At,wo(u),T&8192)e:for(h=u.stateNode,h._visibility=I?h._visibility&-2:h._visibility|1,I&&(y===null||st||fc||Yi||Du(u)),y=null,h=u;;){if(h.tag===5||h.tag===26){if(y===null){st=y=h;try{if(z=st.stateNode,I)de=z.style,typeof de.setProperty=="function"?de.setProperty("display","none","important"):de.display="none";else{Ie=st.stateNode;var $t=st.memoizedProps.style,kt=$t!=null&&$t.hasOwnProperty("display")?$t.display:null;Ie.style.display=kt==null||typeof kt=="boolean"?"":(""+kt).trim()}}catch(Pn){ci(st,st.return,Pn)}}}else if(h.tag===6){if(y===null){st=h;try{st.stateNode.nodeValue=I?"":st.memoizedProps}catch(Pn){ci(st,st.return,Pn)}}}else if(h.tag===18){if(y===null){st=h;try{var Ft=st.stateNode;I?dD(Ft,!0):dD(st.stateNode,!1)}catch(Pn){ci(st,st.return,Pn)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===u)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break e;for(;h.sibling===null;){if(h.return===null||h.return===u)break e;y===h&&(y=null),h=h.return}y===h&&(y=null),h.sibling.return=h.return,h=h.sibling}T&4&&(T=u.updateQueue,T!==null&&(y=T.retryQueue,y!==null&&(T.retryQueue=null,Rd(u,y))));break;case 19:So(h,u),wo(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,Rd(u,T)));break;case 30:break;case 21:break;default:So(h,u),wo(u)}}function wo(u){var h=u.flags;if(h&2){try{for(var y,T=u.return;T!==null;){if(cs(T)){y=T;break}T=T.return}if(y==null)throw Error(r(160));switch(y.tag){case 27:var I=y.stateNode,z=Gr(u);La(u,z,I);break;case 5:var de=y.stateNode;y.flags&32&&(Rs(de,""),y.flags&=-33);var Ie=Gr(u);La(u,Ie,de);break;case 3:case 4:var st=y.stateNode.containerInfo,At=Gr(u);ku(u,At,st);break;default:throw Error(r(161))}}catch(Bt){ci(u,u.return,Bt)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function bv(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;bv(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function mc(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)us(u,h.alternate,h),h=h.sibling}function Du(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:Zo(4,h,h.return),Du(h);break;case 1:Qo(h,h.return);var y=h.stateNode;typeof y.componentWillUnmount=="function"&&jo(h,h.return,y),Du(h);break;case 27:zb(h.stateNode);case 26:case 5:Qo(h,h.return),Du(h);break;case 22:h.memoizedState===null&&Du(h);break;case 30:Du(h);break;default:Du(h)}u=u.sibling}}function ja(u,h,y){for(y=y&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var T=h.alternate,I=u,z=h,de=z.flags;switch(z.tag){case 0:case 11:case 15:ja(I,z,y),dc(4,z);break;case 1:if(ja(I,z,y),T=z,I=T.stateNode,typeof I.componentDidMount=="function")try{I.componentDidMount()}catch(At){ci(T,T.return,At)}if(T=z,I=T.updateQueue,I!==null){var Ie=T.stateNode;try{var st=I.shared.hiddenCallbacks;if(st!==null)for(I.shared.hiddenCallbacks=null,I=0;I<st.length;I++)Xp(st[I],Ie)}catch(At){ci(T,T.return,At)}}y&&de&64&&Uc(z),Nd(z,z.return);break;case 27:vv(z);case 26:case 5:ja(I,z,y),y&&T===null&&de&4&&Jm(z),Nd(z,z.return);break;case 12:ja(I,z,y);break;case 31:ja(I,z,y),y&&de&4&&bf(I,z);break;case 13:ja(I,z,y),y&&de&4&&e0(I,z);break;case 22:z.memoizedState===null&&ja(I,z,y),Nd(z,z.return);break;case 30:break;default:ja(I,z,y)}h=h.sibling}}function Sf(u,h){var y=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),u=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(u=h.memoizedState.cachePool.pool),u!==y&&(u!=null&&u.refCount++,y!=null&&Mh(y))}function zh(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Mh(u))}function Jo(u,h,y,T){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)Pb(u,h,y,T),h=h.sibling}function Pb(u,h,y,T){var I=h.flags;switch(h.tag){case 0:case 11:case 15:Jo(u,h,y,T),I&2048&&dc(9,h);break;case 1:Jo(u,h,y,T);break;case 3:Jo(u,h,y,T),I&2048&&(u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Mh(u)));break;case 12:if(I&2048){Jo(u,h,y,T),u=h.stateNode;try{var z=h.memoizedProps,de=z.id,Ie=z.onPostCommit;typeof Ie=="function"&&Ie(de,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(st){ci(h,h.return,st)}}else Jo(u,h,y,T);break;case 31:Jo(u,h,y,T);break;case 13:Jo(u,h,y,T);break;case 23:break;case 22:z=h.stateNode,de=h.alternate,h.memoizedState!==null?z._visibility&2?Jo(u,h,y,T):Pu(u,h):z._visibility&2?Jo(u,h,y,T):(z._visibility|=2,ea(u,h,y,T,(h.subtreeFlags&10256)!==0||!1)),I&2048&&Sf(de,h);break;case 24:Jo(u,h,y,T),I&2048&&zh(h.alternate,h);break;default:Jo(u,h,y,T)}}function ea(u,h,y,T,I){for(I=I&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var z=u,de=h,Ie=y,st=T,At=de.flags;switch(de.tag){case 0:case 11:case 15:ea(z,de,Ie,st,I),dc(8,de);break;case 23:break;case 22:var Bt=de.stateNode;de.memoizedState!==null?Bt._visibility&2?ea(z,de,Ie,st,I):Pu(z,de):(Bt._visibility|=2,ea(z,de,Ie,st,I)),I&&At&2048&&Sf(de.alternate,de);break;case 24:ea(z,de,Ie,st,I),I&&At&2048&&zh(de.alternate,de);break;default:ea(z,de,Ie,st,I)}h=h.sibling}}function Pu(u,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var y=u,T=h,I=T.flags;switch(T.tag){case 22:Pu(y,T),I&2048&&Sf(T.alternate,T);break;case 24:Pu(y,T),I&2048&&zh(T.alternate,T);break;default:Pu(y,T)}h=h.sibling}}var Fh=8192;function Rl(u,h,y){if(u.subtreeFlags&Fh)for(u=u.child;u!==null;)_v(u,h,y),u=u.sibling}function _v(u,h,y){switch(u.tag){case 26:Rl(u,h,y),u.flags&Fh&&u.memoizedState!==null&&JZ(y,pc,u.memoizedState,u.memoizedProps);break;case 5:Rl(u,h,y);break;case 3:case 4:var T=pc;pc=P3(u.stateNode.containerInfo),Rl(u,h,y),pc=T;break;case 22:u.memoizedState===null&&(T=u.alternate,T!==null&&T.memoizedState!==null?(T=Fh,Fh=16777216,Rl(u,h,y),Fh=T):Rl(u,h,y));break;default:Rl(u,h,y)}}function Uh(u){var h=u.alternate;if(h!==null&&(u=h.child,u!==null)){h.child=null;do h=u.sibling,u.sibling=null,u=h;while(u!==null)}}function wf(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var y=0;y<h.length;y++){var T=h[y];zo=T,Ls(T,u)}Uh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)sl(u),u=u.sibling}function sl(u){switch(u.tag){case 0:case 11:case 15:wf(u),u.flags&2048&&Zo(9,u,u.return);break;case 3:wf(u);break;case 12:wf(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&2&&(u.return===null||u.return.tag!==13)?(h._visibility&=-3,ol(u)):wf(u);break;default:wf(u)}}function ol(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var y=0;y<h.length;y++){var T=h[y];zo=T,Ls(T,u)}Uh(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:Zo(8,h,h.return),ol(h);break;case 22:y=h.stateNode,y._visibility&2&&(y._visibility&=-3,ol(h));break;default:ol(h)}u=u.sibling}}function Ls(u,h){for(;zo!==null;){var y=zo;switch(y.tag){case 0:case 11:case 15:Zo(8,y,h);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var T=y.memoizedState.cachePool.pool;T!=null&&T.refCount++}break;case 24:Mh(y.memoizedState.cache)}if(T=y.child,T!==null)T.return=y,zo=T;else e:for(y=u;zo!==null;){T=zo;var I=T.sibling,z=T.return;if(eg(T),T===y){zo=null;break e}if(I!==null){I.return=z,zo=I;break e}zo=z}}}var kd={getCacheForType:function(u){var h=rr(ao),y=h.data.get(u);return y===void 0&&(y=u(),h.data.set(u,y)),y},cacheSignal:function(){return rr(ao).controller.signal}},br=typeof WeakMap=="function"?WeakMap:Map,Fn=0,ur=null,Cr=null,Mr=0,Qr=0,_a=null,gc=!1,Hc=!1,Ib=!1,kl=0,ws=0,Iu=0,Mf=0,tg=0,za=0,es=0,Bh=null,js=null,zs=!1,t0=0,Ob=0,qs=1/0,Ms=null,Xs=null,Ai=0,Dl=null,n0=null,xc=0,r0=0,i0=null,ng=null,Tf=0,Hh=null;function Pl(){return(Fn&2)!==0&&Mr!==0?Mr&-Mr:X.T!==null?Ot():Be()}function jr(){if(za===0)if((Mr&536870912)===0||Xr){var u=$e;$e<<=1,($e&3932160)===0&&($e=262144),za=u}else za=536870912;return u=tl.current,u!==null&&(u.flags|=32),za}function Er(u,h,y){(u===ur&&(Qr===2||Qr===9)||u.cancelPendingCommit!==null)&&(Ef(u,0),co(u,Mr,za,!1)),Lt(u,y),((Fn&2)===0||u!==ur)&&(u===ur&&((Fn&2)===0&&(Mf|=y),ws===4&&co(u,Mr,za,!1)),en(u))}function zr(u,h,y){if((Fn&6)!==0)throw Error(r(327));var T=!y&&(h&127)===0&&(h&u.expiredLanes)===0||Ke(u,h),I=T?rg(u,h):Fa(u,h,!0),z=T;do{if(I===0){Hc&&!T&&co(u,h,0,!1);break}else{if(y=u.current.alternate,z&&!Ni(y)){I=Fa(u,h,!1),z=!1;continue}if(I===2){if(z=h,u.errorRecoveryDisabledLanes&z)var de=0;else de=u.pendingLanes&-536870913,de=de!==0?de:de&536870912?536870912:0;if(de!==0){h=de;e:{var Ie=u;I=Bh;var st=Ie.current.memoizedState.isDehydrated;if(st&&(Ef(Ie,de).flags|=256),de=Fa(Ie,de,!1),de!==2){if(Ib&&!st){Ie.errorRecoveryDisabledLanes|=z,Mf|=z,I=4;break e}z=js,js=I,z!==null&&(js===null?js=z:js.push.apply(js,z))}I=de}if(z=!1,I!==2)continue}}if(I===1){Ef(u,0),co(u,h,0,!0);break}e:{switch(T=u,z=I,z){case 0:case 1:throw Error(r(345));case 4:if((h&4194048)!==h)break;case 6:co(T,h,za,!gc);break e;case 2:js=null;break;case 3:case 5:break;default:throw Error(r(329))}if((h&62914560)===h&&(I=t0+300-Q(),10<I)){if(co(T,h,za,!gc),We(T,0,!0)!==0)break e;xc=h,T.timeoutHandle=lD(Wr.bind(null,T,y,js,Ms,zs,h,za,Mf,es,gc,z,"Throttled",-0,0),I);break e}Wr(T,y,js,Ms,zs,h,za,Mf,es,gc,z,null,-0,0)}}break}while(!0);en(u)}function Wr(u,h,y,T,I,z,de,Ie,st,At,Bt,$t,kt,Ft){if(u.timeoutHandle=-1,$t=h.subtreeFlags,$t&8192||($t&16785408)===16785408){$t={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ks},_v(h,z,$t);var Pn=(z&62914560)===z?t0-Q():(z&4194048)===z?Ob-Q():0;if(Pn=eQ($t,Pn),Pn!==null){xc=z,u.cancelPendingCommit=Pn(Pd.bind(null,u,h,z,y,T,I,de,Ie,st,Bt,$t,null,kt,Ft)),co(u,z,de,!At);return}}Pd(u,h,z,y,T,I,de,Ie,st)}function Ni(u){for(var h=u;;){var y=h.tag;if((y===0||y===11||y===15)&&h.flags&16384&&(y=h.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var T=0;T<y.length;T++){var I=y[T],z=I.getSnapshot;I=I.value;try{if(!nr(z(),I))return!1}catch{return!1}}if(y=h.child,h.subtreeFlags&16384&&y!==null)y.return=h,h=y;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function co(u,h,y,T){h&=~tg,h&=~Mf,u.suspendedLanes|=h,u.pingedLanes&=~h,T&&(u.warmLanes|=h),T=u.expirationTimes;for(var I=h;0<I;){var z=31-De(I),de=1<<z;T[z]=-1,I&=~de}y!==0&&yt(u,y,h)}function Vc(){return(Fn&6)===0?(wn(0),!1):!0}function Cf(){if(Cr!==null){if(Qr===0)var u=Cr.return;else u=Cr,Mu=ff=null,ib(u),Nh=null,Rh=0,u=Cr;for(;u!==null;)Nl(u.alternate,u),u=u.return;Cr=null}}function Ef(u,h){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,LZ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),xc=0,Cf(),ur=u,Cr=y=Qa(u.current,null),Mr=h,Qr=0,_a=null,gc=!1,Hc=Ke(u,h),Ib=!1,es=za=tg=Mf=Iu=ws=0,js=Bh=null,zs=!1,(h&8)!==0&&(h|=h&32);var T=u.entangledLanes;if(T!==0)for(u=u.entanglements,T&=h;0<T;){var I=31-De(T),z=1<<I;h|=u[I],T&=~z}return kl=h,Lm(),y}function Ou(u,h){yr=null,X.H=Qp,h===Th||h===Tr?(h=Eh(),Qr=3):h===Um?(h=Eh(),Qr=4):Qr=h===cv?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,_a=h,Cr===null&&(ws=1,lv(u,Tl(h,u.current)))}function Ts(){var u=tl.current;return u===null?!0:(Mr&4194048)===Mr?Oa===null:(Mr&62914560)===Mr||(Mr&536870912)!==0?u===Oa:!1}function Dd(){var u=X.H;return X.H=Qp,u===null?Qp:u}function Af(){var u=X.A;return X.A=kd,u}function s0(){ws=4,gc||(Mr&4194048)!==Mr&&tl.current!==null||(Hc=!0),(Iu&134217727)===0&&(Mf&134217727)===0||ur===null||co(ur,Mr,za,!1)}function Fa(u,h,y){var T=Fn;Fn|=2;var I=Dd(),z=Af();(ur!==u||Mr!==h)&&(Ms=null,Ef(u,h)),h=!1;var de=ws;e:do try{if(Qr!==0&&Cr!==null){var Ie=Cr,st=_a;switch(Qr){case 8:Cf(),de=6;break e;case 3:case 2:case 9:case 6:tl.current===null&&(h=!0);var At=Qr;if(Qr=0,_a=null,Vh(u,Ie,st,At),y&&Hc){de=0;break e}break;default:At=Qr,Qr=0,_a=null,Vh(u,Ie,st,At)}}o0(),de=ws;break}catch(Bt){Ou(u,Bt)}while(!0);return h&&u.shellSuspendCounter++,Mu=ff=null,Fn=T,X.H=I,X.A=z,Cr===null&&(ur=null,Mr=0,Lm()),de}function o0(){for(;Cr!==null;)Sv(Cr)}function rg(u,h){var y=Fn;Fn|=2;var T=Dd(),I=Af();ur!==u||Mr!==h?(Ms=null,qs=Q()+500,Ef(u,h)):Hc=Ke(u,h);e:do try{if(Qr!==0&&Cr!==null){h=Cr;var z=_a;t:switch(Qr){case 1:Qr=0,_a=null,Vh(u,h,z,1);break;case 2:case 9:if(el(z)){Qr=0,_a=null,ig(h);break}h=function(){Qr!==2&&Qr!==9||ur!==u||(Qr=7),en(u)},z.then(h,h);break e;case 3:Qr=7;break e;case 4:Qr=5;break e;case 7:el(z)?(Qr=0,_a=null,ig(h)):(Qr=0,_a=null,Vh(u,h,z,7));break;case 5:var de=null;switch(Cr.tag){case 26:de=Cr.memoizedState;case 5:case 27:var Ie=Cr;if(de?wD(de):Ie.stateNode.complete){Qr=0,_a=null;var st=Ie.sibling;if(st!==null)Cr=st;else{var At=Ie.return;At!==null?(Cr=At,Nf(At)):Cr=null}break t}}Qr=0,_a=null,Vh(u,h,z,5);break;case 6:Qr=0,_a=null,Vh(u,h,z,6);break;case 8:Cf(),ws=6;break e;default:throw Error(r(462))}}al();break}catch(Bt){Ou(u,Bt)}while(!0);return Mu=ff=null,X.H=T,X.A=I,Fn=y,Cr!==null?0:(ur=null,Mr=0,Lm(),ws)}function al(){for(;Cr!==null&&!Oe();)Sv(Cr)}function Sv(u){var h=xv(u.alternate,u,kl);u.memoizedProps=u.pendingProps,h===null?Nf(u):Cr=h}function ig(u){var h=u,y=h.alternate;switch(h.tag){case 15:case 0:h=Ym(y,h,h.pendingProps,h.type,void 0,Mr);break;case 11:h=Ym(y,h,h.pendingProps,h.type.render,h.ref,Mr);break;case 5:ib(h);default:Nl(y,h),h=Cr=zp(h,kl),h=xv(y,h,kl)}u.memoizedProps=u.pendingProps,h===null?Nf(u):Cr=h}function Vh(u,h,y,T){Mu=ff=null,ib(h),Nh=null,Rh=0;var I=h.return;try{if(bo(u,I,h,y,Mr)){ws=1,lv(u,Tl(y,u.current)),Cr=null;return}}catch(z){if(I!==null)throw Cr=I,z;ws=1,lv(u,Tl(y,u.current)),Cr=null;return}h.flags&32768?(Xr||T===1?u=!0:Hc||(Mr&536870912)!==0?u=!1:(gc=u=!0,(T===2||T===9||T===3||T===6)&&(T=tl.current,T!==null&&T.tag===13&&(T.flags|=16384))),sg(h,u)):Nf(h)}function Nf(u){var h=u;do{if((h.flags&32768)!==0){sg(h,gc);return}u=h.return;var y=Qm(h.alternate,h,kl);if(y!==null){Cr=y;return}if(h=h.sibling,h!==null){Cr=h;return}Cr=h=u}while(h!==null);ws===0&&(ws=5)}function sg(u,h){do{var y=uc(u.alternate,u);if(y!==null){y.flags&=32767,Cr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!h&&(u=u.sibling,u!==null)){Cr=u;return}Cr=u=y}while(u!==null);ws=6,Cr=null}function Pd(u,h,y,T,I,z,de,Ie,st){u.cancelPendingCommit=null;do a0();while(Ai!==0);if((Fn&6)!==0)throw Error(r(327));if(h!==null){if(h===u.current)throw Error(r(177));if(z=h.lanes|h.childLanes,z|=Io,wt(u,y,z,de,Ie,st),u===ur&&(Cr=ur=null,Mr=0),n0=h,Dl=u,xc=y,r0=z,i0=I,ng=T,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,q(ve,function(){return wv(),null})):(u.callbackNode=null,u.callbackPriority=0),T=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||T){T=X.T,X.T=null,I=Z.p,Z.p=2,de=Fn,Fn|=4;try{rE(u,h,y)}finally{Fn=de,Z.p=I,X.T=T}}Ai=1,uo(),Id(),Gh()}}function uo(){if(Ai===1){Ai=0;var u=Dl,h=n0,y=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||y){y=X.T,X.T=null;var T=Z.p;Z.p=2;var I=Fn;Fn|=4;try{_f(h,u);var z=uE,de=Ji(u.containerInfo),Ie=z.focusedElem,st=z.selectionRange;if(de!==Ie&&Ie&&Ie.ownerDocument&&$n(Ie.ownerDocument.documentElement,Ie)){if(st!==null&&Ps(Ie)){var At=st.start,Bt=st.end;if(Bt===void 0&&(Bt=At),"selectionStart"in Ie)Ie.selectionStart=At,Ie.selectionEnd=Math.min(Bt,Ie.value.length);else{var $t=Ie.ownerDocument||document,kt=$t&&$t.defaultView||window;if(kt.getSelection){var Ft=kt.getSelection(),Pn=Ie.textContent.length,Qn=Math.min(st.start,Pn),Zi=st.end===void 0?Qn:Math.min(st.end,Pn);!Ft.extend&&Qn>Zi&&(de=Zi,Zi=Qn,Qn=de);var _t=kn(Ie,Qn),mt=kn(Ie,Zi);if(_t&&mt&&(Ft.rangeCount!==1||Ft.anchorNode!==_t.node||Ft.anchorOffset!==_t.offset||Ft.focusNode!==mt.node||Ft.focusOffset!==mt.offset)){var Ct=$t.createRange();Ct.setStart(_t.node,_t.offset),Ft.removeAllRanges(),Qn>Zi?(Ft.addRange(Ct),Ft.extend(mt.node,mt.offset)):(Ct.setEnd(mt.node,mt.offset),Ft.addRange(Ct))}}}}for($t=[],Ft=Ie;Ft=Ft.parentNode;)Ft.nodeType===1&&$t.push({element:Ft,left:Ft.scrollLeft,top:Ft.scrollTop});for(typeof Ie.focus=="function"&&Ie.focus(),Ie=0;Ie<$t.length;Ie++){var Wt=$t[Ie];Wt.element.scrollLeft=Wt.left,Wt.element.scrollTop=Wt.top}}F3=!!cE,uE=cE=null}finally{Fn=I,Z.p=T,X.T=y}}u.current=h,Ai=2}}function Id(){if(Ai===2){Ai=0;var u=Dl,h=n0,y=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||y){y=X.T,X.T=null;var T=Z.p;Z.p=2;var I=Fn;Fn|=4;try{us(u,h.alternate,h)}finally{Fn=I,Z.p=T,X.T=y}}Ai=3}}function Gh(){if(Ai===4||Ai===3){Ai=0,ue();var u=Dl,h=n0,y=xc,T=ng;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ai=5:(Ai=0,n0=Dl=null,Lu(u,u.pendingLanes));var I=u.pendingLanes;if(I===0&&(Xs=null),Et(y),h=h.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(Ze,h,void 0,(h.current.flags&128)===128)}catch{}if(T!==null){h=X.T,I=Z.p,Z.p=2,X.T=null;try{for(var z=u.onRecoverableError,de=0;de<T.length;de++){var Ie=T[de];z(Ie.value,{componentStack:Ie.stack})}}finally{X.T=h,Z.p=I}}(xc&3)!==0&&a0(),en(u),I=u.pendingLanes,(y&261930)!==0&&(I&42)!==0?u===Hh?Tf++:(Tf=0,Hh=u):Tf=0,wn(0)}}function Lu(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,Mh(h)))}function a0(){return uo(),Id(),Gh(),wv()}function wv(){if(Ai!==5)return!1;var u=Dl,h=r0;r0=0;var y=Et(xc),T=X.T,I=Z.p;try{Z.p=32>y?32:y,X.T=null,y=i0,i0=null;var z=Dl,de=xc;if(Ai=0,n0=Dl=null,xc=0,(Fn&6)!==0)throw Error(r(331));var Ie=Fn;if(Fn|=4,sl(z.current),Pb(z,z.current,de,y),Fn=Ie,wn(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(Ze,z)}catch{}return!0}finally{Z.p=I,X.T=T,Lu(u,h)}}function Lb(u,h,y){h=Tl(y,h),h=Cb(u.stateNode,h,2),u=mf(u,h,2),u!==null&&(Lt(u,2),en(u))}function ci(u,h,y){if(u.tag===3)Lb(u,u,y);else for(;h!==null;){if(h.tag===3){Lb(h,u,y);break}else if(h.tag===1){var T=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof T.componentDidCatch=="function"&&(Xs===null||!Xs.has(T))){u=Tl(y,u),y=Eb(2),T=mf(h,y,2),T!==null&&(M3(y,T,h,u),Lt(T,2),en(T));break}}h=h.return}}function og(u,h,y){var T=u.pingCache;if(T===null){T=u.pingCache=new br;var I=new Set;T.set(h,I)}else I=T.get(h),I===void 0&&(I=new Set,T.set(h,I));I.has(y)||(Ib=!0,I.add(y),u=g.bind(null,u,h,y),h.then(u,u))}function g(u,h,y){var T=u.pingCache;T!==null&&T.delete(h),u.pingedLanes|=u.suspendedLanes&y,u.warmLanes&=~y,ur===u&&(Mr&y)===y&&(ws===4||ws===3&&(Mr&62914560)===Mr&&300>Q()-t0?(Fn&2)===0&&Ef(u,0):tg|=y,es===Mr&&(es=0)),en(u)}function v(u,h){h===0&&(h=et()),u=Pa(u,h),u!==null&&(Lt(u,h),en(u))}function E(u){var h=u.memoizedState,y=0;h!==null&&(y=h.retryLane),v(u,y)}function k(u,h){var y=0;switch(u.tag){case 31:case 13:var T=u.stateNode,I=u.memoizedState;I!==null&&(y=I.retryLane);break;case 19:T=u.stateNode;break;case 22:T=u.stateNode._retryCache;break;default:throw Error(r(314))}T!==null&&T.delete(h),v(u,y)}function q(u,h){return Fe(u,h)}var ee=null,Re=null,at=!1,jt=!1,Yt=!1,hn=0;function en(u){u!==Re&&u.next===null&&(Re===null?ee=Re=u:Re=Re.next=u),jt=!0,at||(at=!0,St())}function wn(u,h){if(!Yt&&jt){Yt=!0;do for(var y=!1,T=ee;T!==null;){if(u!==0){var I=T.pendingLanes;if(I===0)var z=0;else{var de=T.suspendedLanes,Ie=T.pingedLanes;z=(1<<31-De(42|u)+1)-1,z&=I&~(de&~Ie),z=z&201326741?z&201326741|1:z?z|2:0}z!==0&&(y=!0,Nt(T,z))}else z=Mr,z=We(T,T===ur?z:0,T.cancelPendingCommit!==null||T.timeoutHandle!==-1),(z&3)===0||Ke(T,z)||(y=!0,Nt(T,z));T=T.next}while(y);Yt=!1}}function pr(){Ys()}function Ys(){jt=at=!1;var u=0;hn!==0&&OZ()&&(u=hn);for(var h=Q(),y=null,T=ee;T!==null;){var I=T.next,z=l0(T,h);z===0?(T.next=null,y===null?ee=I:y.next=I,I===null&&(Re=y)):(y=T,(u!==0||(z&3)!==0)&&(jt=!0)),T=I}Ai!==0&&Ai!==5||wn(u),hn!==0&&(hn=0)}function l0(u,h){for(var y=u.suspendedLanes,T=u.pingedLanes,I=u.expirationTimes,z=u.pendingLanes&-62914561;0<z;){var de=31-De(z),Ie=1<<de,st=I[de];st===-1?((Ie&y)===0||(Ie&T)!==0)&&(I[de]=je(Ie,h)):st<=h&&(u.expiredLanes|=Ie),z&=~Ie}if(h=ur,y=Mr,y=We(u,u===h?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),T=u.callbackNode,y===0||u===h&&(Qr===2||Qr===9)||u.cancelPendingCommit!==null)return T!==null&&T!==null&&Ue(T),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Ke(u,y)){if(h=y&-y,h===u.callbackPriority)return h;switch(T!==null&&Ue(T),Et(y)){case 2:case 8:y=Ae;break;case 32:y=ve;break;case 268435456:y=Ee;break;default:y=ve}return T=Rf.bind(null,u),y=Fe(y,T),u.callbackPriority=h,u.callbackNode=y,h}return T!==null&&T!==null&&Ue(T),u.callbackPriority=2,u.callbackNode=null,2}function Rf(u,h){if(Ai!==0&&Ai!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(a0()&&u.callbackNode!==y)return null;var T=Mr;return T=We(u,u===ur?T:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),T===0?null:(zr(u,T,h),l0(u,Q()),u.callbackNode!=null&&u.callbackNode===y?Rf.bind(null,u):null)}function Nt(u,h){if(a0())return null;zr(u,h,!0)}function St(){jZ(function(){(Fn&6)!==0?Fe(Se,pr):Ys()})}function Ot(){if(hn===0){var u=wd;u===0&&(u=Ne,Ne<<=1,(Ne&261888)===0&&(Ne=256)),hn=u}return hn}function cn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:xa(""+u)}function qn(u,h){var y=h.ownerDocument.createElement("input");return y.name=h.name,y.value=h.value,u.id&&y.setAttribute("form",u.id),h.parentNode.insertBefore(y,h),u=new FormData(u),y.parentNode.removeChild(y),u}function Cs(u,h,y,T,I){if(h==="submit"&&y&&y.stateNode===I){var z=cn((I[Tt]||null).action),de=T.submitter;de&&(h=(h=de[Tt]||null)?cn(h.formAction):de.getAttribute("formAction"),h!==null&&(z=h,de=null));var Ie=new Ii("action","action",null,T,I);u.push({event:Ie,listeners:[{instance:null,listener:function(){if(T.defaultPrevented){if(hn!==0){var st=de?qn(I,de):new FormData(I);vb(y,{pending:!0,data:st,method:I.method,action:z},null,st)}}else typeof z=="function"&&(Ie.preventDefault(),st=de?qn(I,de):new FormData(I),vb(y,{pending:!0,data:st,method:I.method,action:z},z,st))},currentTarget:I}]})}}for(var Yn=0;Yn<Im.length;Yn++){var ii=Im[Yn],Fo=ii.toLowerCase(),pi=ii[0].toUpperCase()+ii.slice(1);rc(Fo,"on"+pi)}rc(oo,"onAnimationEnd"),rc(vo,"onAnimationIteration"),rc(zc,"onAnimationStart"),rc("dblclick","onDoubleClick"),rc("focusin","onFocus"),rc("focusout","onBlur"),rc(Po,"onTransitionRun"),rc(Lx,"onTransitionStart"),rc(Iw,"onTransitionCancel"),rc(Vy,"onTransitionEnd"),Xt("onMouseEnter",["mouseout","mouseover"]),Xt("onMouseLeave",["mouseout","mouseover"]),Xt("onPointerEnter",["pointerout","pointerover"]),Xt("onPointerLeave",["pointerout","pointerover"]),gt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gt("onBeforeInput",["compositionend","keypress","textInput","paste"]),gt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vc="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(" "),iE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vc));function eD(u,h){h=(h&4)!==0;for(var y=0;y<u.length;y++){var T=u[y],I=T.event;T=T.listeners;e:{var z=void 0;if(h)for(var de=T.length-1;0<=de;de--){var Ie=T[de],st=Ie.instance,At=Ie.currentTarget;if(Ie=Ie.listener,st!==z&&I.isPropagationStopped())break e;z=Ie,I.currentTarget=At;try{z(I)}catch(Bt){Om(Bt)}I.currentTarget=null,z=st}else for(de=0;de<T.length;de++){if(Ie=T[de],st=Ie.instance,At=Ie.currentTarget,Ie=Ie.listener,st!==z&&I.isPropagationStopped())break e;z=Ie,I.currentTarget=At;try{z(I)}catch(Bt){Om(Bt)}I.currentTarget=null,z=st}}}}function Jr(u,h){var y=h[Ut];y===void 0&&(y=h[Ut]=new Set);var T=u+"__bubble";y.has(T)||(tD(h,u,2,!1),y.add(T))}function sE(u,h,y){var T=0;h&&(T|=4),tD(y,u,T,h)}var R3="_reactListening"+Math.random().toString(36).slice(2);function oE(u){if(!u[R3]){u[R3]=!0,bt.forEach(function(y){y!=="selectionchange"&&(iE.has(y)||sE(y,!1,u),sE(y,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[R3]||(h[R3]=!0,sE("selectionchange",!1,h))}}function tD(u,h,y,T){switch(RD(h)){case 2:var I=rQ;break;case 8:I=iQ;break;default:I=_E}y=I.bind(null,h,y,u),I=void 0,!Ro||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(I=!0),T?I!==void 0?u.addEventListener(h,y,{capture:!0,passive:I}):u.addEventListener(h,y,!0):I!==void 0?u.addEventListener(h,y,{passive:I}):u.addEventListener(h,y,!1)}function aE(u,h,y,T,I){var z=T;if((h&1)===0&&(h&2)===0&&T!==null)e:for(;;){if(T===null)return;var de=T.tag;if(de===3||de===4){var Ie=T.stateNode.containerInfo;if(Ie===I)break;if(de===4)for(de=T.return;de!==null;){var st=de.tag;if((st===3||st===4)&&de.stateNode.containerInfo===I)return;de=de.return}for(;Ie!==null;){if(de=Nn(Ie),de===null)return;if(st=de.tag,st===5||st===6||st===26||st===27){T=z=de;continue e}Ie=Ie.parentNode}}T=T.return}Zl(function(){var At=z,Bt=Ya(y),$t=[];e:{var kt=nc.get(u);if(kt!==void 0){var Ft=Ii,Pn=u;switch(u){case"keypress":if(ri(y)===0)break e;case"keydown":case"keyup":Ft=pd;break;case"focusin":Pn="focus",Ft=va;break;case"focusout":Pn="blur",Ft=va;break;case"beforeblur":case"afterblur":Ft=va;break;case"click":if(y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ft=_h;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ft=fd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ft=Em;break;case oo:case vo:case zc:Ft=Bs;break;case Vy:Ft=Am;break;case"scroll":case"scrollend":Ft=ka;break;case"wheel":Ft=Nm;break;case"copy":case"cut":case"paste":Ft=Ml;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ft=ec;break;case"toggle":case"beforetoggle":Ft=km}var Qn=(h&4)!==0,Zi=!Qn&&(u==="scroll"||u==="scrollend"),_t=Qn?kt!==null?kt+"Capture":null:kt;Qn=[];for(var mt=At,Ct;mt!==null;){var Wt=mt;if(Ct=Wt.stateNode,Wt=Wt.tag,Wt!==5&&Wt!==26&&Wt!==27||Ct===null||_t===null||(Wt=Xo(mt,_t),Wt!=null&&Qn.push(jb(mt,Wt,Ct))),Zi)break;mt=mt.return}0<Qn.length&&(kt=new Ft(kt,Pn,null,y,Bt),$t.push({event:kt,listeners:Qn}))}}if((h&7)===0){e:{if(kt=u==="mouseover"||u==="pointerover",Ft=u==="mouseout"||u==="pointerout",kt&&y!==Kl&&(Pn=y.relatedTarget||y.fromElement)&&(Nn(Pn)||Pn[ct]))break e;if((Ft||kt)&&(kt=Bt.window===Bt?Bt:(kt=Bt.ownerDocument)?kt.defaultView||kt.parentWindow:window,Ft?(Pn=y.relatedTarget||y.toElement,Ft=At,Pn=Pn?Nn(Pn):null,Pn!==null&&(Zi=s(Pn),Qn=Pn.tag,Pn!==Zi||Qn!==5&&Qn!==27&&Qn!==6)&&(Pn=null)):(Ft=null,Pn=At),Ft!==Pn)){if(Qn=_h,Wt="onMouseLeave",_t="onMouseEnter",mt="mouse",(u==="pointerout"||u==="pointerover")&&(Qn=ec,Wt="onPointerLeave",_t="onPointerEnter",mt="pointer"),Zi=Ft==null?kt:er(Ft),Ct=Pn==null?kt:er(Pn),kt=new Qn(Wt,mt+"leave",Ft,y,Bt),kt.target=Zi,kt.relatedTarget=Ct,Wt=null,Nn(Bt)===At&&(Qn=new Qn(_t,mt+"enter",Pn,y,Bt),Qn.target=Ct,Qn.relatedTarget=Zi,Wt=Qn),Zi=Wt,Ft&&Pn)t:{for(Qn=RZ,_t=Ft,mt=Pn,Ct=0,Wt=_t;Wt;Wt=Qn(Wt))Ct++;Wt=0;for(var Gn=mt;Gn;Gn=Qn(Gn))Wt++;for(;0<Ct-Wt;)_t=Qn(_t),Ct--;for(;0<Wt-Ct;)mt=Qn(mt),Wt--;for(;Ct--;){if(_t===mt||mt!==null&&_t===mt.alternate){Qn=_t;break t}_t=Qn(_t),mt=Qn(mt)}Qn=null}else Qn=null;Ft!==null&&nD($t,kt,Ft,Qn,!1),Pn!==null&&Zi!==null&&nD($t,Zi,Pn,Qn,!0)}}e:{if(kt=At?er(At):window,Ft=kt.nodeName&&kt.nodeName.toLowerCase(),Ft==="select"||Ft==="input"&&kt.type==="file")var wi=Ge;else if(vd(kt))if(Xe)wi=tr;else{wi=_n;var zn=yn}else Ft=kt.nodeName,!Ft||Ft.toLowerCase()!=="input"||kt.type!=="checkbox"&&kt.type!=="radio"?At&&Aa(At.elementType)&&(wi=Ge):wi=Cn;if(wi&&(wi=wi(u,At))){jp($t,wi,y,Bt);break e}zn&&zn(u,kt,At),u==="focusout"&&At&&kt.type==="number"&&At.memoizedProps.value!=null&&Di(kt,"number",kt.value)}switch(zn=At?er(At):window,u){case"focusin":(vd(zn)||zn.contentEditable==="true")&&(li=zn,os=At,Is=null);break;case"focusout":Is=os=li=null;break;case"mousedown":Ko=!0;break;case"contextmenu":case"mouseup":case"dragend":Ko=!1,ko($t,y,Bt);break;case"selectionchange":if(xi)break;case"keydown":case"keyup":ko($t,y,Bt)}var Dr;if(gu)e:{switch(u){case"compositionstart":var si="onCompositionStart";break e;case"compositionend":si="onCompositionEnd";break e;case"compositionupdate":si="onCompositionUpdate";break e}si=void 0}else xu?xd(u,y)&&(si="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(si="onCompositionStart");si&&(Op&&y.locale!=="ko"&&(xu||si!=="onCompositionStart"?si==="onCompositionEnd"&&xu&&(Dr=Lc()):(xs=Bt,Ka="value"in xs?xs.value:xs.textContent,xu=!0)),zn=k3(At,si),0<zn.length&&(si=new Rp(si,u,null,y,Bt),$t.push({event:si,listeners:zn}),Dr?si.data=Dr:(Dr=Ds(y),Dr!==null&&(si.data=Dr)))),(Dr=Ip?ys(u,y):Lp(u,y))&&(si=k3(At,"onBeforeInput"),0<si.length&&(zn=new Rp("onBeforeInput","beforeinput",null,y,Bt),$t.push({event:zn,listeners:si}),zn.data=Dr)),Cs($t,u,At,y,Bt)}eD($t,h)})}function jb(u,h,y){return{instance:u,listener:h,currentTarget:y}}function k3(u,h){for(var y=h+"Capture",T=[];u!==null;){var I=u,z=I.stateNode;if(I=I.tag,I!==5&&I!==26&&I!==27||z===null||(I=Xo(u,y),I!=null&&T.unshift(jb(u,I,z)),I=Xo(u,h),I!=null&&T.push(jb(u,I,z))),u.tag===3)return T;u=u.return}return[]}function RZ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function nD(u,h,y,T,I){for(var z=h._reactName,de=[];y!==null&&y!==T;){var Ie=y,st=Ie.alternate,At=Ie.stateNode;if(Ie=Ie.tag,st!==null&&st===T)break;Ie!==5&&Ie!==26&&Ie!==27||At===null||(st=At,I?(At=Xo(y,z),At!=null&&de.unshift(jb(y,At,st))):I||(At=Xo(y,z),At!=null&&de.push(jb(y,At,st)))),y=y.return}de.length!==0&&u.push({event:h,listeners:de})}var kZ=/\r\n?/g,DZ=/\u0000|\uFFFD/g;function rD(u){return(typeof u=="string"?u:""+u).replace(kZ,`
`).replace(DZ,"")}function iD(u,h){return h=rD(h),rD(u)===h}function Ki(u,h,y,T,I,z){switch(y){case"children":typeof T=="string"?h==="body"||h==="textarea"&&T===""||Rs(u,T):(typeof T=="number"||typeof T=="bigint")&&h!=="body"&&Rs(u,""+T);break;case"className":Wn(u,"class",T);break;case"tabIndex":Wn(u,"tabindex",T);break;case"dir":case"role":case"viewBox":case"width":case"height":Wn(u,y,T);break;case"style":ga(u,T,z);break;case"data":if(h!=="object"){Wn(u,"data",T);break}case"src":case"href":if(T===""&&(h!=="a"||y!=="href")){u.removeAttribute(y);break}if(T==null||typeof T=="function"||typeof T=="symbol"||typeof T=="boolean"){u.removeAttribute(y);break}T=xa(""+T),u.setAttribute(y,T);break;case"action":case"formAction":if(typeof T=="function"){u.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof z=="function"&&(y==="formAction"?(h!=="input"&&Ki(u,h,"name",I.name,I,null),Ki(u,h,"formEncType",I.formEncType,I,null),Ki(u,h,"formMethod",I.formMethod,I,null),Ki(u,h,"formTarget",I.formTarget,I,null)):(Ki(u,h,"encType",I.encType,I,null),Ki(u,h,"method",I.method,I,null),Ki(u,h,"target",I.target,I,null)));if(T==null||typeof T=="symbol"||typeof T=="boolean"){u.removeAttribute(y);break}T=xa(""+T),u.setAttribute(y,T);break;case"onClick":T!=null&&(u.onclick=ks);break;case"onScroll":T!=null&&Jr("scroll",u);break;case"onScrollEnd":T!=null&&Jr("scrollend",u);break;case"dangerouslySetInnerHTML":if(T!=null){if(typeof T!="object"||!("__html"in T))throw Error(r(61));if(y=T.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"multiple":u.multiple=T&&typeof T!="function"&&typeof T!="symbol";break;case"muted":u.muted=T&&typeof T!="function"&&typeof T!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(T==null||typeof T=="function"||typeof T=="boolean"||typeof T=="symbol"){u.removeAttribute("xlink:href");break}y=xa(""+T),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":T!=null&&typeof T!="function"&&typeof T!="symbol"?u.setAttribute(y,""+T):u.removeAttribute(y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":T&&typeof T!="function"&&typeof T!="symbol"?u.setAttribute(y,""):u.removeAttribute(y);break;case"capture":case"download":T===!0?u.setAttribute(y,""):T!==!1&&T!=null&&typeof T!="function"&&typeof T!="symbol"?u.setAttribute(y,T):u.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":T!=null&&typeof T!="function"&&typeof T!="symbol"&&!isNaN(T)&&1<=T?u.setAttribute(y,T):u.removeAttribute(y);break;case"rowSpan":case"start":T==null||typeof T=="function"||typeof T=="symbol"||isNaN(T)?u.removeAttribute(y):u.setAttribute(y,T);break;case"popover":Jr("beforetoggle",u),Jr("toggle",u),On(u,"popover",T);break;case"xlinkActuate":fn(u,"http://www.w3.org/1999/xlink","xlink:actuate",T);break;case"xlinkArcrole":fn(u,"http://www.w3.org/1999/xlink","xlink:arcrole",T);break;case"xlinkRole":fn(u,"http://www.w3.org/1999/xlink","xlink:role",T);break;case"xlinkShow":fn(u,"http://www.w3.org/1999/xlink","xlink:show",T);break;case"xlinkTitle":fn(u,"http://www.w3.org/1999/xlink","xlink:title",T);break;case"xlinkType":fn(u,"http://www.w3.org/1999/xlink","xlink:type",T);break;case"xmlBase":fn(u,"http://www.w3.org/XML/1998/namespace","xml:base",T);break;case"xmlLang":fn(u,"http://www.w3.org/XML/1998/namespace","xml:lang",T);break;case"xmlSpace":fn(u,"http://www.w3.org/XML/1998/namespace","xml:space",T);break;case"is":On(u,"is",T);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=Yl.get(y)||y,On(u,y,T))}}function lE(u,h,y,T,I,z){switch(y){case"style":ga(u,T,z);break;case"dangerouslySetInnerHTML":if(T!=null){if(typeof T!="object"||!("__html"in T))throw Error(r(61));if(y=T.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"children":typeof T=="string"?Rs(u,T):(typeof T=="number"||typeof T=="bigint")&&Rs(u,""+T);break;case"onScroll":T!=null&&Jr("scroll",u);break;case"onScrollEnd":T!=null&&Jr("scrollend",u);break;case"onClick":T!=null&&(u.onclick=ks);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!vt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(I=y.endsWith("Capture"),h=y.slice(2,I?y.length-7:void 0),z=u[Tt]||null,z=z!=null?z[y]:null,typeof z=="function"&&u.removeEventListener(h,z,I),typeof T=="function")){typeof z!="function"&&z!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(h,T,I);break e}y in u?u[y]=T:T===!0?u.setAttribute(y,""):On(u,y,T)}}}function Ua(u,h,y){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Jr("error",u),Jr("load",u);var T=!1,I=!1,z;for(z in y)if(y.hasOwnProperty(z)){var de=y[z];if(de!=null)switch(z){case"src":T=!0;break;case"srcSet":I=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,h));default:Ki(u,h,z,de,y,null)}}I&&Ki(u,h,"srcSet",y.srcSet,y,null),T&&Ki(u,h,"src",y.src,y,null);return;case"input":Jr("invalid",u);var Ie=z=de=I=null,st=null,At=null;for(T in y)if(y.hasOwnProperty(T)){var Bt=y[T];if(Bt!=null)switch(T){case"name":I=Bt;break;case"type":de=Bt;break;case"checked":st=Bt;break;case"defaultChecked":At=Bt;break;case"value":z=Bt;break;case"defaultValue":Ie=Bt;break;case"children":case"dangerouslySetInnerHTML":if(Bt!=null)throw Error(r(137,h));break;default:Ki(u,h,T,Bt,y,null)}}Ns(u,z,Ie,st,At,de,I,!1);return;case"select":Jr("invalid",u),T=de=z=null;for(I in y)if(y.hasOwnProperty(I)&&(Ie=y[I],Ie!=null))switch(I){case"value":z=Ie;break;case"defaultValue":de=Ie;break;case"multiple":T=Ie;default:Ki(u,h,I,Ie,y,null)}h=z,y=de,u.multiple=!!T,h!=null?gs(u,!!T,h,!1):y!=null&&gs(u,!!T,y,!0);return;case"textarea":Jr("invalid",u),z=I=T=null;for(de in y)if(y.hasOwnProperty(de)&&(Ie=y[de],Ie!=null))switch(de){case"value":T=Ie;break;case"defaultValue":I=Ie;break;case"children":z=Ie;break;case"dangerouslySetInnerHTML":if(Ie!=null)throw Error(r(91));break;default:Ki(u,h,de,Ie,y,null)}hi(u,T,I,z);return;case"option":for(st in y)if(y.hasOwnProperty(st)&&(T=y[st],T!=null))switch(st){case"selected":u.selected=T&&typeof T!="function"&&typeof T!="symbol";break;default:Ki(u,h,st,T,y,null)}return;case"dialog":Jr("beforetoggle",u),Jr("toggle",u),Jr("cancel",u),Jr("close",u);break;case"iframe":case"object":Jr("load",u);break;case"video":case"audio":for(T=0;T<vc.length;T++)Jr(vc[T],u);break;case"image":Jr("error",u),Jr("load",u);break;case"details":Jr("toggle",u);break;case"embed":case"source":case"link":Jr("error",u),Jr("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(At in y)if(y.hasOwnProperty(At)&&(T=y[At],T!=null))switch(At){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,h));default:Ki(u,h,At,T,y,null)}return;default:if(Aa(h)){for(Bt in y)y.hasOwnProperty(Bt)&&(T=y[Bt],T!==void 0&&lE(u,h,Bt,T,y,void 0));return}}for(Ie in y)y.hasOwnProperty(Ie)&&(T=y[Ie],T!=null&&Ki(u,h,Ie,T,y,null))}function PZ(u,h,y,T){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var I=null,z=null,de=null,Ie=null,st=null,At=null,Bt=null;for(Ft in y){var $t=y[Ft];if(y.hasOwnProperty(Ft)&&$t!=null)switch(Ft){case"checked":break;case"value":break;case"defaultValue":st=$t;default:T.hasOwnProperty(Ft)||Ki(u,h,Ft,null,T,$t)}}for(var kt in T){var Ft=T[kt];if($t=y[kt],T.hasOwnProperty(kt)&&(Ft!=null||$t!=null))switch(kt){case"type":z=Ft;break;case"name":I=Ft;break;case"checked":At=Ft;break;case"defaultChecked":Bt=Ft;break;case"value":de=Ft;break;case"defaultValue":Ie=Ft;break;case"children":case"dangerouslySetInnerHTML":if(Ft!=null)throw Error(r(137,h));break;default:Ft!==$t&&Ki(u,h,kt,Ft,T,$t)}}ms(u,de,Ie,st,At,Bt,z,I);return;case"select":Ft=de=Ie=kt=null;for(z in y)if(st=y[z],y.hasOwnProperty(z)&&st!=null)switch(z){case"value":break;case"multiple":Ft=st;default:T.hasOwnProperty(z)||Ki(u,h,z,null,T,st)}for(I in T)if(z=T[I],st=y[I],T.hasOwnProperty(I)&&(z!=null||st!=null))switch(I){case"value":kt=z;break;case"defaultValue":Ie=z;break;case"multiple":de=z;default:z!==st&&Ki(u,h,I,z,T,st)}h=Ie,y=de,T=Ft,kt!=null?gs(u,!!y,kt,!1):!!T!=!!y&&(h!=null?gs(u,!!y,h,!0):gs(u,!!y,y?[]:"",!1));return;case"textarea":Ft=kt=null;for(Ie in y)if(I=y[Ie],y.hasOwnProperty(Ie)&&I!=null&&!T.hasOwnProperty(Ie))switch(Ie){case"value":break;case"children":break;default:Ki(u,h,Ie,null,T,I)}for(de in T)if(I=T[de],z=y[de],T.hasOwnProperty(de)&&(I!=null||z!=null))switch(de){case"value":kt=I;break;case"defaultValue":Ft=I;break;case"children":break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(91));break;default:I!==z&&Ki(u,h,de,I,T,z)}xr(u,kt,Ft);return;case"option":for(var Pn in y)if(kt=y[Pn],y.hasOwnProperty(Pn)&&kt!=null&&!T.hasOwnProperty(Pn))switch(Pn){case"selected":u.selected=!1;break;default:Ki(u,h,Pn,null,T,kt)}for(st in T)if(kt=T[st],Ft=y[st],T.hasOwnProperty(st)&&kt!==Ft&&(kt!=null||Ft!=null))switch(st){case"selected":u.selected=kt&&typeof kt!="function"&&typeof kt!="symbol";break;default:Ki(u,h,st,kt,T,Ft)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Qn in y)kt=y[Qn],y.hasOwnProperty(Qn)&&kt!=null&&!T.hasOwnProperty(Qn)&&Ki(u,h,Qn,null,T,kt);for(At in T)if(kt=T[At],Ft=y[At],T.hasOwnProperty(At)&&kt!==Ft&&(kt!=null||Ft!=null))switch(At){case"children":case"dangerouslySetInnerHTML":if(kt!=null)throw Error(r(137,h));break;default:Ki(u,h,At,kt,T,Ft)}return;default:if(Aa(h)){for(var Zi in y)kt=y[Zi],y.hasOwnProperty(Zi)&&kt!==void 0&&!T.hasOwnProperty(Zi)&&lE(u,h,Zi,void 0,T,kt);for(Bt in T)kt=T[Bt],Ft=y[Bt],!T.hasOwnProperty(Bt)||kt===Ft||kt===void 0&&Ft===void 0||lE(u,h,Bt,kt,T,Ft);return}}for(var _t in y)kt=y[_t],y.hasOwnProperty(_t)&&kt!=null&&!T.hasOwnProperty(_t)&&Ki(u,h,_t,null,T,kt);for($t in T)kt=T[$t],Ft=y[$t],!T.hasOwnProperty($t)||kt===Ft||kt==null&&Ft==null||Ki(u,h,$t,kt,T,Ft)}function sD(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function IZ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,h=0,y=performance.getEntriesByType("resource"),T=0;T<y.length;T++){var I=y[T],z=I.transferSize,de=I.initiatorType,Ie=I.duration;if(z&&Ie&&sD(de)){for(de=0,Ie=I.responseEnd,T+=1;T<y.length;T++){var st=y[T],At=st.startTime;if(At>Ie)break;var Bt=st.transferSize,$t=st.initiatorType;Bt&&sD($t)&&(st=st.responseEnd,de+=Bt*(st<Ie?1:(Ie-At)/(st-At)))}if(--T,h+=8*(z+de)/(I.duration/1e3),u++,10<u)break}}if(0<u)return h/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var cE=null,uE=null;function D3(u){return u.nodeType===9?u:u.ownerDocument}function oD(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function aD(u,h){if(u===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&h==="foreignObject"?0:u}function dE(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var fE=null;function OZ(){var u=window.event;return u&&u.type==="popstate"?u===fE?!1:(fE=u,!0):(fE=null,!1)}var lD=typeof setTimeout=="function"?setTimeout:void 0,LZ=typeof clearTimeout=="function"?clearTimeout:void 0,cD=typeof Promise=="function"?Promise:void 0,jZ=typeof queueMicrotask=="function"?queueMicrotask:typeof cD<"u"?function(u){return cD.resolve(null).then(u).catch(zZ)}:lD;function zZ(u){setTimeout(function(){throw u})}function c0(u){return u==="head"}function uD(u,h){var y=h,T=0;do{var I=y.nextSibling;if(u.removeChild(y),I&&I.nodeType===8)if(y=I.data,y==="/$"||y==="/&"){if(T===0){u.removeChild(I),Ev(h);return}T--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")T++;else if(y==="html")zb(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,zb(y);for(var z=y.firstChild;z;){var de=z.nextSibling,Ie=z.nodeName;z[En]||Ie==="SCRIPT"||Ie==="STYLE"||Ie==="LINK"&&z.rel.toLowerCase()==="stylesheet"||y.removeChild(z),z=de}}else y==="body"&&zb(u.ownerDocument.body);y=I}while(y);Ev(h)}function dD(u,h){var y=u;u=0;do{var T=y.nextSibling;if(y.nodeType===1?h?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(h?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),T&&T.nodeType===8)if(y=T.data,y==="/$"){if(u===0)break;u--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||u++;y=T}while(y)}function hE(u){var h=u.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var y=h;switch(h=h.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":hE(y),Hn(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function FZ(u,h,y,T){for(;u.nodeType===1;){var I=y;if(u.nodeName.toLowerCase()!==h.toLowerCase()){if(!T&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(T){if(!u[En])switch(h){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(z=u.getAttribute("rel"),z==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(z!==I.rel||u.getAttribute("href")!==(I.href==null||I.href===""?null:I.href)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin)||u.getAttribute("title")!==(I.title==null?null:I.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(z=u.getAttribute("src"),(z!==(I.src==null?null:I.src)||u.getAttribute("type")!==(I.type==null?null:I.type)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin))&&z&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(h==="input"&&u.type==="hidden"){var z=I.name==null?null:""+I.name;if(I.type==="hidden"&&u.getAttribute("name")===z)return u}else return u;if(u=ju(u.nextSibling),u===null)break}return null}function UZ(u,h,y){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=ju(u.nextSibling),u===null))return null;return u}function fD(u,h){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!h||(u=ju(u.nextSibling),u===null))return null;return u}function pE(u){return u.data==="$?"||u.data==="$~"}function mE(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function BZ(u,h){var y=u.ownerDocument;if(u.data==="$~")u._reactRetry=h;else if(u.data!=="$?"||y.readyState!=="loading")h();else{var T=function(){h(),y.removeEventListener("DOMContentLoaded",T)};y.addEventListener("DOMContentLoaded",T),u._reactRetry=T}}function ju(u){for(;u!=null;u=u.nextSibling){var h=u.nodeType;if(h===1||h===3)break;if(h===8){if(h=u.data,h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"||h==="F!"||h==="F")break;if(h==="/$"||h==="/&")return null}}return u}var gE=null;function hD(u){u=u.nextSibling;for(var h=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(h===0)return ju(u.nextSibling);h--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||h++}u=u.nextSibling}return null}function pD(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var y=u.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(h===0)return u;h--}else y!=="/$"&&y!=="/&"||h++}u=u.previousSibling}return null}function mD(u,h,y){switch(h=D3(y),u){case"html":if(u=h.documentElement,!u)throw Error(r(452));return u;case"head":if(u=h.head,!u)throw Error(r(453));return u;case"body":if(u=h.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function zb(u){for(var h=u.attributes;h.length;)u.removeAttributeNode(h[0]);Hn(u)}var zu=new Map,gD=new Set;function P3(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Wh=Z.d;Z.d={f:HZ,r:VZ,D:GZ,C:WZ,L:$Z,m:qZ,X:YZ,S:XZ,M:KZ};function HZ(){var u=Wh.f(),h=Vc();return u||h}function VZ(u){var h=Br(u);h!==null&&h.tag===5&&h.type==="form"?m3(h):Wh.r(u)}var Mv=typeof document>"u"?null:document;function xD(u,h,y){var T=Mv;if(T&&typeof h=="string"&&h){var I=Dn(h);I='link[rel="'+u+'"][href="'+I+'"]',typeof y=="string"&&(I+='[crossorigin="'+y+'"]'),gD.has(I)||(gD.add(I),u={rel:u,crossOrigin:y,href:h},T.querySelector(I)===null&&(h=T.createElement("link"),Ua(h,"link",u),rt(h),T.head.appendChild(h)))}}function GZ(u){Wh.D(u),xD("dns-prefetch",u,null)}function WZ(u,h){Wh.C(u,h),xD("preconnect",u,h)}function $Z(u,h,y){Wh.L(u,h,y);var T=Mv;if(T&&u&&h){var I='link[rel="preload"][as="'+Dn(h)+'"]';h==="image"&&y&&y.imageSrcSet?(I+='[imagesrcset="'+Dn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(I+='[imagesizes="'+Dn(y.imageSizes)+'"]')):I+='[href="'+Dn(u)+'"]';var z=I;switch(h){case"style":z=Tv(u);break;case"script":z=Cv(u)}zu.has(z)||(u=p({rel:"preload",href:h==="image"&&y&&y.imageSrcSet?void 0:u,as:h},y),zu.set(z,u),T.querySelector(I)!==null||h==="style"&&T.querySelector(Fb(z))||h==="script"&&T.querySelector(Ub(z))||(h=T.createElement("link"),Ua(h,"link",u),rt(h),T.head.appendChild(h)))}}function qZ(u,h){Wh.m(u,h);var y=Mv;if(y&&u){var T=h&&typeof h.as=="string"?h.as:"script",I='link[rel="modulepreload"][as="'+Dn(T)+'"][href="'+Dn(u)+'"]',z=I;switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":z=Cv(u)}if(!zu.has(z)&&(u=p({rel:"modulepreload",href:u},h),zu.set(z,u),y.querySelector(I)===null)){switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Ub(z)))return}T=y.createElement("link"),Ua(T,"link",u),rt(T),y.head.appendChild(T)}}}function XZ(u,h,y){Wh.S(u,h,y);var T=Mv;if(T&&u){var I=ge(T).hoistableStyles,z=Tv(u);h=h||"default";var de=I.get(z);if(!de){var Ie={loading:0,preload:null};if(de=T.querySelector(Fb(z)))Ie.loading=5;else{u=p({rel:"stylesheet",href:u,"data-precedence":h},y),(y=zu.get(z))&&xE(u,y);var st=de=T.createElement("link");rt(st),Ua(st,"link",u),st._p=new Promise(function(At,Bt){st.onload=At,st.onerror=Bt}),st.addEventListener("load",function(){Ie.loading|=1}),st.addEventListener("error",function(){Ie.loading|=2}),Ie.loading|=4,I3(de,h,T)}de={type:"stylesheet",instance:de,count:1,state:Ie},I.set(z,de)}}}function YZ(u,h){Wh.X(u,h);var y=Mv;if(y&&u){var T=ge(y).hoistableScripts,I=Cv(u),z=T.get(I);z||(z=y.querySelector(Ub(I)),z||(u=p({src:u,async:!0},h),(h=zu.get(I))&&vE(u,h),z=y.createElement("script"),rt(z),Ua(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},T.set(I,z))}}function KZ(u,h){Wh.M(u,h);var y=Mv;if(y&&u){var T=ge(y).hoistableScripts,I=Cv(u),z=T.get(I);z||(z=y.querySelector(Ub(I)),z||(u=p({src:u,async:!0,type:"module"},h),(h=zu.get(I))&&vE(u,h),z=y.createElement("script"),rt(z),Ua(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},T.set(I,z))}}function vD(u,h,y,T){var I=(I=te.current)?P3(I):null;if(!I)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(h=Tv(y.href),y=ge(I).hoistableStyles,T=y.get(h),T||(T={type:"style",instance:null,count:0,state:null},y.set(h,T)),T):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){u=Tv(y.href);var z=ge(I).hoistableStyles,de=z.get(u);if(de||(I=I.ownerDocument||I,de={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},z.set(u,de),(z=I.querySelector(Fb(u)))&&!z._p&&(de.instance=z,de.state.loading=5),zu.has(u)||(y={rel:"preload",as:"style",href:y.href,crossOrigin:y.crossOrigin,integrity:y.integrity,media:y.media,hrefLang:y.hrefLang,referrerPolicy:y.referrerPolicy},zu.set(u,y),z||ZZ(I,u,y,de.state))),h&&T===null)throw Error(r(528,""));return de}if(h&&T!==null)throw Error(r(529,""));return null;case"script":return h=y.async,y=y.src,typeof y=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=Cv(y),y=ge(I).hoistableScripts,T=y.get(h),T||(T={type:"script",instance:null,count:0,state:null},y.set(h,T)),T):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function Tv(u){return'href="'+Dn(u)+'"'}function Fb(u){return'link[rel="stylesheet"]['+u+"]"}function yD(u){return p({},u,{"data-precedence":u.precedence,precedence:null})}function ZZ(u,h,y,T){u.querySelector('link[rel="preload"][as="style"]['+h+"]")?T.loading=1:(h=u.createElement("link"),T.preload=h,h.addEventListener("load",function(){return T.loading|=1}),h.addEventListener("error",function(){return T.loading|=2}),Ua(h,"link",y),rt(h),u.head.appendChild(h))}function Cv(u){return'[src="'+Dn(u)+'"]'}function Ub(u){return"script[async]"+u}function bD(u,h,y){if(h.count++,h.instance===null)switch(h.type){case"style":var T=u.querySelector('style[data-href~="'+Dn(y.href)+'"]');if(T)return h.instance=T,rt(T),T;var I=p({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return T=(u.ownerDocument||u).createElement("style"),rt(T),Ua(T,"style",I),I3(T,y.precedence,u),h.instance=T;case"stylesheet":I=Tv(y.href);var z=u.querySelector(Fb(I));if(z)return h.state.loading|=4,h.instance=z,rt(z),z;T=yD(y),(I=zu.get(I))&&xE(T,I),z=(u.ownerDocument||u).createElement("link"),rt(z);var de=z;return de._p=new Promise(function(Ie,st){de.onload=Ie,de.onerror=st}),Ua(z,"link",T),h.state.loading|=4,I3(z,y.precedence,u),h.instance=z;case"script":return z=Cv(y.src),(I=u.querySelector(Ub(z)))?(h.instance=I,rt(I),I):(T=y,(I=zu.get(z))&&(T=p({},y),vE(T,I)),u=u.ownerDocument||u,I=u.createElement("script"),rt(I),Ua(I,"link",T),u.head.appendChild(I),h.instance=I);case"void":return null;default:throw Error(r(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(T=h.instance,h.state.loading|=4,I3(T,y.precedence,u));return h.instance}function I3(u,h,y){for(var T=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),I=T.length?T[T.length-1]:null,z=I,de=0;de<T.length;de++){var Ie=T[de];if(Ie.dataset.precedence===h)z=Ie;else if(z!==I)break}z?z.parentNode.insertBefore(u,z.nextSibling):(h=y.nodeType===9?y.head:y,h.insertBefore(u,h.firstChild))}function xE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function vE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var O3=null;function _D(u,h,y){if(O3===null){var T=new Map,I=O3=new Map;I.set(y,T)}else I=O3,T=I.get(y),T||(T=new Map,I.set(y,T));if(T.has(u))return T;for(T.set(u,null),y=y.getElementsByTagName(u),I=0;I<y.length;I++){var z=y[I];if(!(z[En]||z[It]||u==="link"&&z.getAttribute("rel")==="stylesheet")&&z.namespaceURI!=="http://www.w3.org/2000/svg"){var de=z.getAttribute(h)||"";de=u+de;var Ie=T.get(de);Ie?Ie.push(z):T.set(de,[z])}}return T}function SD(u,h,y){u=u.ownerDocument||u,u.head.insertBefore(y,h==="title"?u.querySelector("head > title"):null)}function QZ(u,h,y){if(y===1||h.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return u=h.disabled,typeof h.precedence=="string"&&u==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function wD(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function JZ(u,h,y,T){if(y.type==="stylesheet"&&(typeof T.media!="string"||matchMedia(T.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var I=Tv(T.href),z=h.querySelector(Fb(I));if(z){h=z._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(u.count++,u=L3.bind(u),h.then(u,u)),y.state.loading|=4,y.instance=z,rt(z);return}z=h.ownerDocument||h,T=yD(T),(I=zu.get(I))&&xE(T,I),z=z.createElement("link"),rt(z);var de=z;de._p=new Promise(function(Ie,st){de.onload=Ie,de.onerror=st}),Ua(z,"link",T),y.instance=z}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,h),(h=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=L3.bind(u),h.addEventListener("load",y),h.addEventListener("error",y))}}var yE=0;function eQ(u,h){return u.stylesheets&&u.count===0&&z3(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var T=setTimeout(function(){if(u.stylesheets&&z3(u,u.stylesheets),u.unsuspend){var z=u.unsuspend;u.unsuspend=null,z()}},6e4+h);0<u.imgBytes&&yE===0&&(yE=62500*IZ());var I=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&z3(u,u.stylesheets),u.unsuspend)){var z=u.unsuspend;u.unsuspend=null,z()}},(u.imgBytes>yE?50:800)+h);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(T),clearTimeout(I)}}:null}function L3(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)z3(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var j3=null;function z3(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,j3=new Map,h.forEach(tQ,u),j3=null,L3.call(u))}function tQ(u,h){if(!(h.state.loading&4)){var y=j3.get(u);if(y)var T=y.get(null);else{y=new Map,j3.set(u,y);for(var I=u.querySelectorAll("link[data-precedence],style[data-precedence]"),z=0;z<I.length;z++){var de=I[z];(de.nodeName==="LINK"||de.getAttribute("media")!=="not all")&&(y.set(de.dataset.precedence,de),T=de)}T&&y.set(null,T)}I=h.instance,de=I.getAttribute("data-precedence"),z=y.get(de)||T,z===T&&y.set(null,I),y.set(de,I),this.count++,T=L3.bind(this),I.addEventListener("load",T),I.addEventListener("error",T),z?z.parentNode.insertBefore(I,z.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(I,u.firstChild)),h.state.loading|=4}}var Bb={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function nQ(u,h,y,T,I,z,de,Ie,st){this.tag=1,this.containerInfo=u,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pt(0),this.hiddenUpdates=pt(null),this.identifierPrefix=T,this.onUncaughtError=I,this.onCaughtError=z,this.onRecoverableError=de,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=st,this.incompleteTransitions=new Map}function MD(u,h,y,T,I,z,de,Ie,st,At,Bt,$t){return u=new nQ(u,h,y,de,st,At,Bt,$t,Ie),h=1,z===!0&&(h|=24),z=bs(3,null,null,h),u.current=z,z.stateNode=u,h=Wy(),h.refCount++,u.pooledCache=h,h.refCount++,z.memoizedState={element:T,isDehydrated:y,cache:h},Hm(z),u}function TD(u){return u?(u=af,u):af}function CD(u,h,y,T,I,z){I=TD(I),T.context===null?T.context=I:T.pendingContext=I,T=Td(h),T.payload={element:y},z=z===void 0?null:z,z!==null&&(T.callback=z),y=mf(u,T,h),y!==null&&(Er(y,u,h),gf(y,u,h))}function ED(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<h?y:h}}function bE(u,h){ED(u,h),(u=u.alternate)&&ED(u,h)}function AD(u){if(u.tag===13||u.tag===31){var h=Pa(u,67108864);h!==null&&Er(h,u,67108864),bE(u,67108864)}}function ND(u){if(u.tag===13||u.tag===31){var h=Pl();h=Dt(h);var y=Pa(u,h);y!==null&&Er(y,u,h),bE(u,h)}}var F3=!0;function rQ(u,h,y,T){var I=X.T;X.T=null;var z=Z.p;try{Z.p=2,_E(u,h,y,T)}finally{Z.p=z,X.T=I}}function iQ(u,h,y,T){var I=X.T;X.T=null;var z=Z.p;try{Z.p=8,_E(u,h,y,T)}finally{Z.p=z,X.T=I}}function _E(u,h,y,T){if(F3){var I=SE(T);if(I===null)aE(u,h,T,U3,y),kD(u,T);else if(oQ(I,u,h,y,T))T.stopPropagation();else if(kD(u,T),h&4&&-1<sQ.indexOf(u)){for(;I!==null;){var z=Br(I);if(z!==null)switch(z.tag){case 3:if(z=z.stateNode,z.current.memoizedState.isDehydrated){var de=nt(z.pendingLanes);if(de!==0){var Ie=z;for(Ie.pendingLanes|=2,Ie.entangledLanes|=2;de;){var st=1<<31-De(de);Ie.entanglements[1]|=st,de&=~st}en(z),(Fn&6)===0&&(qs=Q()+500,wn(0))}}break;case 31:case 13:Ie=Pa(z,2),Ie!==null&&Er(Ie,z,2),Vc(),bE(z,2)}if(z=SE(T),z===null&&aE(u,h,T,U3,y),z===I)break;I=z}I!==null&&T.stopPropagation()}else aE(u,h,T,null,y)}}function SE(u){return u=Ya(u),wE(u)}var U3=null;function wE(u){if(U3=null,u=Nn(u),u!==null){var h=s(u);if(h===null)u=null;else{var y=h.tag;if(y===13){if(u=o(h),u!==null)return u;u=null}else if(y===31){if(u=a(h),u!==null)return u;u=null}else if(y===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null)}}return U3=u,null}function RD(u){switch(u){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(fe()){case Se:return 2;case Ae:return 8;case ve:case qe:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var ME=!1,u0=null,d0=null,f0=null,Hb=new Map,Vb=new Map,h0=[],sQ="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".split(" ");function kD(u,h){switch(u){case"focusin":case"focusout":u0=null;break;case"dragenter":case"dragleave":d0=null;break;case"mouseover":case"mouseout":f0=null;break;case"pointerover":case"pointerout":Hb.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vb.delete(h.pointerId)}}function Gb(u,h,y,T,I,z){return u===null||u.nativeEvent!==z?(u={blockedOn:h,domEventName:y,eventSystemFlags:T,nativeEvent:z,targetContainers:[I]},h!==null&&(h=Br(h),h!==null&&AD(h)),u):(u.eventSystemFlags|=T,h=u.targetContainers,I!==null&&h.indexOf(I)===-1&&h.push(I),u)}function oQ(u,h,y,T,I){switch(h){case"focusin":return u0=Gb(u0,u,h,y,T,I),!0;case"dragenter":return d0=Gb(d0,u,h,y,T,I),!0;case"mouseover":return f0=Gb(f0,u,h,y,T,I),!0;case"pointerover":var z=I.pointerId;return Hb.set(z,Gb(Hb.get(z)||null,u,h,y,T,I)),!0;case"gotpointercapture":return z=I.pointerId,Vb.set(z,Gb(Vb.get(z)||null,u,h,y,T,I)),!0}return!1}function DD(u){var h=Nn(u.target);if(h!==null){var y=s(h);if(y!==null){if(h=y.tag,h===13){if(h=o(y),h!==null){u.blockedOn=h,Qe(u.priority,function(){ND(y)});return}}else if(h===31){if(h=a(y),h!==null){u.blockedOn=h,Qe(u.priority,function(){ND(y)});return}}else if(h===3&&y.stateNode.current.memoizedState.isDehydrated){u.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}u.blockedOn=null}function B3(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var y=SE(u.nativeEvent);if(y===null){y=u.nativeEvent;var T=new y.constructor(y.type,y);Kl=T,y.target.dispatchEvent(T),Kl=null}else return h=Br(y),h!==null&&AD(h),u.blockedOn=y,!1;h.shift()}return!0}function PD(u,h,y){B3(u)&&y.delete(h)}function aQ(){ME=!1,u0!==null&&B3(u0)&&(u0=null),d0!==null&&B3(d0)&&(d0=null),f0!==null&&B3(f0)&&(f0=null),Hb.forEach(PD),Vb.forEach(PD)}function H3(u,h){u.blockedOn===h&&(u.blockedOn=null,ME||(ME=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,aQ)))}var V3=null;function ID(u){V3!==u&&(V3=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){V3===u&&(V3=null);for(var h=0;h<u.length;h+=3){var y=u[h],T=u[h+1],I=u[h+2];if(typeof T!="function"){if(wE(T||y)===null)continue;break}var z=Br(y);z!==null&&(u.splice(h,3),h-=3,vb(z,{pending:!0,data:I,method:y.method,action:T},T,I))}}))}function Ev(u){function h(st){return H3(st,u)}u0!==null&&H3(u0,u),d0!==null&&H3(d0,u),f0!==null&&H3(f0,u),Hb.forEach(h),Vb.forEach(h);for(var y=0;y<h0.length;y++){var T=h0[y];T.blockedOn===u&&(T.blockedOn=null)}for(;0<h0.length&&(y=h0[0],y.blockedOn===null);)DD(y),y.blockedOn===null&&h0.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(T=0;T<y.length;T+=3){var I=y[T],z=y[T+1],de=I[Tt]||null;if(typeof z=="function")de||ID(y);else if(de){var Ie=null;if(z&&z.hasAttribute("formAction")){if(I=z,de=z[Tt]||null)Ie=de.formAction;else if(wE(I)!==null)continue}else Ie=de.action;typeof Ie=="function"?y[T+1]=Ie:(y.splice(T,3),T-=3),ID(y)}}}function OD(){function u(z){z.canIntercept&&z.info==="react-transition"&&z.intercept({handler:function(){return new Promise(function(de){return I=de})},focusReset:"manual",scroll:"manual"})}function h(){I!==null&&(I(),I=null),T||setTimeout(y,20)}function y(){if(!T&&!navigation.transition){var z=navigation.currentEntry;z&&z.url!=null&&navigation.navigate(z.url,{state:z.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var T=!1,I=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(y,100),function(){T=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),I!==null&&(I(),I=null)}}}function TE(u){this._internalRoot=u}G3.prototype.render=TE.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(r(409));var y=h.current,T=Pl();CD(y,T,u,h,null,null)},G3.prototype.unmount=TE.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;CD(u.current,2,null,u,null,null),Vc(),h[ct]=null}};function G3(u){this._internalRoot=u}G3.prototype.unstable_scheduleHydration=function(u){if(u){var h=Be();u={blockedOn:null,target:u,priority:h};for(var y=0;y<h0.length&&h!==0&&h<h0[y].priority;y++);h0.splice(y,0,u),y===0&&DD(u)}};var LD=e.version;if(LD!=="19.2.1")throw Error(r(527,LD,"19.2.1"));Z.findDOMNode=function(u){var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=c(h),u=u!==null?d(u):null,u=u===null?null:u.stateNode,u};var lQ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var W3=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!W3.isDisabled&&W3.supportsFiber)try{Ze=W3.inject(lQ),it=W3}catch{}}return $b.createRoot=function(u,h){if(!i(u))throw Error(r(299));var y=!1,T="",I=S3,z=Mb,de=Tb;return h!=null&&(h.unstable_strictMode===!0&&(y=!0),h.identifierPrefix!==void 0&&(T=h.identifierPrefix),h.onUncaughtError!==void 0&&(I=h.onUncaughtError),h.onCaughtError!==void 0&&(z=h.onCaughtError),h.onRecoverableError!==void 0&&(de=h.onRecoverableError)),h=MD(u,1,!1,null,null,y,T,null,I,z,de,OD),u[ct]=h.current,oE(u),new TE(h)},$b.hydrateRoot=function(u,h,y){if(!i(u))throw Error(r(299));var T=!1,I="",z=S3,de=Mb,Ie=Tb,st=null;return y!=null&&(y.unstable_strictMode===!0&&(T=!0),y.identifierPrefix!==void 0&&(I=y.identifierPrefix),y.onUncaughtError!==void 0&&(z=y.onUncaughtError),y.onCaughtError!==void 0&&(de=y.onCaughtError),y.onRecoverableError!==void 0&&(Ie=y.onRecoverableError),y.formState!==void 0&&(st=y.formState)),h=MD(u,1,!0,h,y??null,T,I,st,z,de,Ie,OD),h.context=TD(null),y=h.current,T=Pl(),T=Dt(T),I=Td(T),I.callback=null,mf(y,I,T),y=T,h.current.lanes=y,Lt(h,y),en(h),u[ct]=h.current,oE(u),new G3(h)},$b.version="19.2.1",$b}var qD;function xQ(){if(qD)return NE.exports;qD=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(),NE.exports=gQ(),NE.exports}var WF=xQ();/**
 * react-router v7.13.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var XD="popstate";function YD(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function vQ(t={}){function e(r,i){var c;let s=(c=i.state)==null?void 0:c.masked,{pathname:o,search:a,hash:l}=s||r.location;return cN("",{pathname:o,search:a,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:eS(i)}return bQ(e,n,null,t)}function to(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Zd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function yQ(){return Math.random().toString(36).substring(2,10)}function KD(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 cN(t,e,n=null,r,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?vy(e):e,state:n,key:e&&e.key||r||yQ(),unstable_mask:i}}function eS({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 vy(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function bQ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=d();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function d(){return(o.state||{idx:null}).idx}function p(){a="POP";let S=d(),w=S==null?null:S-c;c=S,l&&l({action:a,location:_.location,delta:w})}function m(S,w){a="PUSH";let C=YD(S)?S:cN(_.location,S,w);c=d()+1;let A=KD(C,c),N=_.createHref(C.unstable_mask||C);try{o.pushState(A,"",N)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(N)}s&&l&&l({action:a,location:_.location,delta:1})}function x(S,w){a="REPLACE";let C=YD(S)?S:cN(_.location,S,w);c=d();let A=KD(C,c),N=_.createHref(C.unstable_mask||C);o.replaceState(A,"",N),s&&l&&l({action:a,location:_.location,delta:0})}function b(S){return _Q(S)}let _={get action(){return a},get location(){return t(i,o)},listen(S){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(XD,p),l=S,()=>{i.removeEventListener(XD,p),l=null}},createHref(S){return e(i,S)},createURL:b,encodeLocation(S){let w=b(S);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:x,go(S){return o.go(S)}};return _}function _Q(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),to(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:eS(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function $F(t,e,n="/"){return SQ(t,e,n,!1)}function SQ(t,e,n,r){let i=typeof e=="string"?vy(e):e,s=mp(i.pathname||"/",n);if(s==null)return null;let o=qF(t);wQ(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=IQ(s);a=DQ(o[l],c,r)}return a}function qF(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let d={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;to(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let p=th([r,d.relativePath]),m=n.concat(d);o.children&&o.children.length>0&&(to(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),qF(o.children,e,m,p,l)),!(o.path==null&&!o.index)&&e.push({path:p,score:RQ(p,o.index),routesMeta:m})};return t.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of XF(o.path))s(o,a,!0,c)}),e}function XF(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=XF(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function wQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:kQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var MQ=/^:[\w-]+$/,TQ=3,CQ=2,EQ=1,AQ=10,NQ=-2,ZD=t=>t==="*";function RQ(t,e){let n=t.split("/"),r=n.length;return n.some(ZD)&&(r+=NQ),e&&(r+=CQ),n.filter(i=>!ZD(i)).reduce((i,s)=>i+(MQ.test(s)?TQ:s===""?EQ:AQ),r)}function kQ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function DQ(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",p=ZM({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),m=l.route;if(!p&&c&&n&&!r[r.length-1].route.index&&(p=ZM({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:th([s,p.pathname]),pathnameBase:zQ(th([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=th([s,p.pathnameBase]))}return o}function ZM(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=PQ(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:p},m)=>{if(d==="*"){let b=a[m]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const x=a[m];return p&&!x?c[d]=void 0:c[d]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function PQ(t,e=!1,n=!0){Zd(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 r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l,c,d)=>{if(r.push({paramName:a,isOptional:l!=null}),l){let p=d.charAt(c+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function IQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Zd(!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 mp(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var OQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LQ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?vy(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=QD(n.substring(1),"/"):s=QD(n,e)):s=e,{pathname:s,search:FQ(r),hash:UQ(i)}}function QD(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function PE(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}].  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 jQ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function YF(t){let e=jQ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Tk(t,e,n,r=!1){let i;typeof t=="string"?i=vy(t):(i={...t},to(!i.pathname||!i.pathname.includes("?"),PE("?","pathname","search",i)),to(!i.pathname||!i.pathname.includes("#"),PE("#","pathname","hash",i)),to(!i.search||!i.search.includes("#"),PE("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let p=e.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;i.pathname=m.join("/")}a=p>=0?e[p]:"/"}let l=LQ(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var th=t=>t.join("/").replace(/\/\/+/g,"/"),zQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),FQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,UQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,BQ=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function HQ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function VQ(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var KF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ZF(t,e){let n=t;if(typeof n!="string"||!OQ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(KF)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=mp(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{Zd(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var QF=["POST","PUT","PATCH","DELETE"];new Set(QF);var GQ=["GET",...QF];new Set(GQ);var yy=M.createContext(null);yy.displayName="DataRouter";var q5=M.createContext(null);q5.displayName="DataRouterState";var WQ=M.createContext(!1),JF=M.createContext({isTransitioning:!1});JF.displayName="ViewTransition";var $Q=M.createContext(new Map);$Q.displayName="Fetchers";var qQ=M.createContext(null);qQ.displayName="Await";var sd=M.createContext(null);sd.displayName="Navigation";var ZS=M.createContext(null);ZS.displayName="Location";var wp=M.createContext({outlet:null,matches:[],isDataRoute:!1});wp.displayName="Route";var Ck=M.createContext(null);Ck.displayName="RouteError";var eU="REACT_ROUTER_ERROR",XQ="REDIRECT",YQ="ROUTE_ERROR_RESPONSE";function KQ(t){if(t.startsWith(`${eU}:${XQ}:{`))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 ZQ(t){if(t.startsWith(`${eU}:${YQ}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new BQ(e.status,e.statusText,e.data)}catch{}}function QQ(t,{relative:e}={}){to(QS(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=M.useContext(sd),{hash:i,pathname:s,search:o}=JS(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:th([n,s])),r.createHref({pathname:a,search:o,hash:i})}function QS(){return M.useContext(ZS)!=null}function hh(){return to(QS(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(ZS).location}var tU="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nU(t){M.useContext(sd).static||M.useLayoutEffect(t)}function X5(){let{isDataRoute:t}=M.useContext(wp);return t?dJ():JQ()}function JQ(){to(QS(),"useNavigate() may be used only in the context of a <Router> component.");let t=M.useContext(yy),{basename:e,navigator:n}=M.useContext(sd),{matches:r}=M.useContext(wp),{pathname:i}=hh(),s=JSON.stringify(YF(r)),o=M.useRef(!1);return nU(()=>{o.current=!0}),M.useCallback((l,c={})=>{if(Zd(o.current,tU),!o.current)return;if(typeof l=="number"){n.go(l);return}let d=Tk(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:th([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}M.createContext(null);function JS(t,{relative:e}={}){let{matches:n}=M.useContext(wp),{pathname:r}=hh(),i=JSON.stringify(YF(n));return M.useMemo(()=>Tk(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function eJ(t,e){return rU(t,e)}function rU(t,e,n){var S;to(QS(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=M.useContext(sd),{matches:i}=M.useContext(wp),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let w=c&&c.path||"";sU(a,!c||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${w}">) 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.

Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let d=hh(),p;if(e){let w=typeof e=="string"?vy(e):e;to(l==="/"||((S=w.pathname)==null?void 0:S.startsWith(l)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${w.pathname}" was given in the \`location\` prop.`),p=w}else p=d;let m=p.pathname||"/",x=m;if(l!=="/"){let w=l.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let b=$F(t,{pathname:x});Zd(c||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Zd(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.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.`);let _=sJ(b&&b.map(w=>Object.assign({},w,{params:Object.assign({},o,w.params),pathname:th([l,r.encodeLocation?r.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:th([l,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),i,n);return e&&_?M.createElement(ZS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},_):_}function tJ(){let t=uJ(),e=HQ(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:s},"ErrorBoundary")," or"," ",M.createElement("code",{style:s},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},e),n?M.createElement("pre",{style:i},n):null,o)}var nJ=M.createElement(tJ,null),iU=class extends M.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=ZQ(t.digest);n&&(t=n)}let e=t!==void 0?M.createElement(wp.Provider,{value:this.props.routeContext},M.createElement(Ck.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?M.createElement(rJ,{error:t},e):e}};iU.contextType=WQ;var IE=new WeakMap;function rJ({children:t,error:e}){let{basename:n}=M.useContext(sd);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=KQ(e.digest);if(r){let i=IE.get(e);if(i)throw i;let s=ZF(r.location,n);if(KF&&!IE.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw IE.set(e,o),o}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function iJ({routeContext:t,match:e,children:n}){let r=M.useContext(yy);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),M.createElement(wp.Provider,{value:t},n)}function sJ(t,e=[],n){let r=n==null?void 0:n.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,s=r==null?void 0:r.errors;if(s!=null){let d=i.findIndex(p=>p.route.id&&(s==null?void 0:s[p.route.id])!==void 0);to(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let o=!1,a=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<i.length;d++){let p=i[d];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(a=d),p.route.id){let{loaderData:m,errors:x}=r,b=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!x||x[p.route.id]===void 0);if(p.route.lazy||b){n.isStatic&&(o=!0),a>=0?i=i.slice(0,a+1):i=[i[0]];break}}}}let l=n==null?void 0:n.onError,c=r&&l?(d,p)=>{var m,x;l(d,{location:r.location,params:((x=(m=r.matches)==null?void 0:m[0])==null?void 0:x.params)??{},unstable_pattern:VQ(r.matches),errorInfo:p})}:void 0;return i.reduceRight((d,p,m)=>{let x,b=!1,_=null,S=null;r&&(x=s&&p.route.id?s[p.route.id]:void 0,_=p.route.errorElement||nJ,o&&(a<0&&m===0?(sU("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,S=null):a===m&&(b=!0,S=p.route.hydrateFallbackElement||null)));let w=e.concat(i.slice(0,m+1)),C=()=>{let A;return x?A=_:b?A=S:p.route.Component?A=M.createElement(p.route.Component,null):p.route.element?A=p.route.element:A=d,M.createElement(iJ,{match:p,routeContext:{outlet:d,matches:w,isDataRoute:r!=null},children:A})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?M.createElement(iU,{location:r.location,revalidation:r.revalidation,component:_,error:x,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):C()},null)}function Ek(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function oJ(t){let e=M.useContext(yy);return to(e,Ek(t)),e}function aJ(t){let e=M.useContext(q5);return to(e,Ek(t)),e}function lJ(t){let e=M.useContext(wp);return to(e,Ek(t)),e}function Ak(t){let e=lJ(t),n=e.matches[e.matches.length-1];return to(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function cJ(){return Ak("useRouteId")}function uJ(){var r;let t=M.useContext(Ck),e=aJ("useRouteError"),n=Ak("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function dJ(){let{router:t}=oJ("useNavigate"),e=Ak("useNavigate"),n=M.useRef(!1);return nU(()=>{n.current=!0}),M.useCallback(async(i,s={})=>{Zd(n.current,tU),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var JD={};function sU(t,e,n){!e&&!JD[t]&&(JD[t]=!0,Zd(!1,n))}M.memo(fJ);function fJ({routes:t,future:e,state:n,isStatic:r,onError:i}){return rU(t,void 0,{state:n,isStatic:r,onError:i})}function Ff(t){to(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hJ({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){to(!QS(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=M.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=vy(n));let{pathname:c="/",search:d="",hash:p="",state:m=null,key:x="default",unstable_mask:b}=n,_=M.useMemo(()=>{let S=mp(c,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:m,key:x,unstable_mask:b},navigationType:r}},[a,c,d,p,m,x,r,b]);return Zd(_!=null,`<Router basename="${a}"> is not able to match the URL "${c}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:M.createElement(sd.Provider,{value:l},M.createElement(ZS.Provider,{children:e,value:_}))}function pJ({children:t,location:e}){return eJ(uN(t),e)}function uN(t,e=[]){let n=[];return M.Children.forEach(t,(r,i)=>{if(!M.isValidElement(r))return;let s=[...e,i];if(r.type===M.Fragment){n.push.apply(n,uN(r.props.children,s));return}to(r.type===Ff,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),to(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=uN(r.props.children,s)),n.push(o)}),n}var IM="get",OM="application/x-www-form-urlencoded";function Y5(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function mJ(t){return Y5(t)&&t.tagName.toLowerCase()==="button"}function gJ(t){return Y5(t)&&t.tagName.toLowerCase()==="form"}function xJ(t){return Y5(t)&&t.tagName.toLowerCase()==="input"}function vJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yJ(t,e){return t.button===0&&(!e||e==="_self")&&!vJ(t)}function dN(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function bJ(t,e){let n=dN(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var q3=null;function _J(){if(q3===null)try{new FormData(document.createElement("form"),0),q3=!1}catch{q3=!0}return q3}var SJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function OE(t){return t!=null&&!SJ.has(t)?(Zd(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${OM}"`),null):t}function wJ(t,e){let n,r,i,s,o;if(gJ(t)){let a=t.getAttribute("action");r=a?mp(a,e):null,n=t.getAttribute("method")||IM,i=OE(t.getAttribute("enctype"))||OM,s=new FormData(t)}else if(mJ(t)||xJ(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?mp(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||IM,i=OE(t.getAttribute("formenctype"))||OE(a.getAttribute("enctype"))||OM,s=new FormData(a,t),!_J()){let{name:c,type:d,value:p}=t;if(d==="image"){let m=c?`${c}.`:"";s.append(`${m}x`,"0"),s.append(`${m}y`,"0")}else c&&s.append(c,p)}}else{if(Y5(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=IM,r=null,i=OM,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nk(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function MJ(t,e,n,r){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&mp(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function TJ(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 CJ(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 EJ(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await TJ(s,n);return o.links?o.links():[]}return[]}));return kJ(r.flat(1).filter(CJ).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function eP(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>{var d;return n[c].pathname!==l.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{var p;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function AJ(t,e,{includeHydrateFallback:n}={}){return NJ(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function NJ(t){return[...new Set(t)]}function RJ(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function kJ(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(RJ(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function oU(){let t=M.useContext(yy);return Nk(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function DJ(){let t=M.useContext(q5);return Nk(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Rk=M.createContext(void 0);Rk.displayName="FrameworkContext";function aU(){let t=M.useContext(Rk);return Nk(t,"You must render this element inside a <HydratedRouter> element"),t}function PJ(t,e){let n=M.useContext(Rk),[r,i]=M.useState(!1),[s,o]=M.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:p}=e,m=M.useRef(null);M.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let _=w=>{w.forEach(C=>{o(C.isIntersecting)})},S=new IntersectionObserver(_,{threshold:.5});return m.current&&S.observe(m.current),()=>{S.disconnect()}}},[t]),M.useEffect(()=>{if(r){let _=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(_)}}},[r]);let x=()=>{i(!0)},b=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,m,{}]:[s,m,{onFocus:qb(a,x),onBlur:qb(l,b),onMouseEnter:qb(c,x),onMouseLeave:qb(d,b),onTouchStart:qb(p,x)}]:[!1,m,{}]}function qb(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function IJ({page:t,...e}){let{router:n}=oU(),r=M.useMemo(()=>$F(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?M.createElement(LJ,{page:t,matches:r,...e}):null}function OJ(t){let{manifest:e,routeModules:n}=aU(),[r,i]=M.useState([]);return M.useEffect(()=>{let s=!1;return EJ(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function LJ({page:t,matches:e,...n}){let r=hh(),{future:i,manifest:s,routeModules:o}=aU(),{basename:a}=oU(),{loaderData:l,matches:c}=DJ(),d=M.useMemo(()=>eP(t,e,c,s,r,"data"),[t,e,c,s,r]),p=M.useMemo(()=>eP(t,e,c,s,r,"assets"),[t,e,c,s,r]),m=M.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let _=new Set,S=!1;if(e.forEach(C=>{var N;let A=s.routes[C.route.id];!A||!A.hasLoader||(!d.some(D=>D.route.id===C.route.id)&&C.route.id in l&&((N=o[C.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?S=!0:_.add(C.route.id))}),_.size===0)return[];let w=MJ(t,a,i.unstable_trailingSlashAwareDataRequests,"data");return S&&_.size>0&&w.searchParams.set("_routes",e.filter(C=>_.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[a,i.unstable_trailingSlashAwareDataRequests,l,r,s,d,e,t,o]),x=M.useMemo(()=>AJ(p,s),[p,s]),b=OJ(p);return M.createElement(M.Fragment,null,m.map(_=>M.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),x.map(_=>M.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:S})=>M.createElement("link",{key:_,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function jJ(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var zJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{zJ&&(window.__reactRouterVersion="7.13.1")}catch{}function FJ({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=M.useRef();i.current==null&&(i.current=vQ({window:r,v5Compat:!0}));let s=i.current,[o,a]=M.useState({action:s.action,location:s.location}),l=M.useCallback(c=>{n===!1?a(c):M.startTransition(()=>a(c))},[n]);return M.useLayoutEffect(()=>s.listen(l),[s,l]),M.createElement(hJ,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var lU=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,QM=M.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,unstable_mask:a,state:l,target:c,to:d,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:x,...b},_){let{basename:S,navigator:w,unstable_useTransitions:C}=M.useContext(sd),A=typeof d=="string"&&lU.test(d),N=ZF(d,S);d=N.to;let D=QQ(d,{relative:i}),P=hh(),O=null;if(a){let $=Tk(a,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);S!=="/"&&($.pathname=$.pathname==="/"?S:th([S,$.pathname])),O=w.createHref($)}let[R,L,V]=PJ(r,b),F=VJ(d,{replace:o,unstable_mask:a,state:l,target:c,preventScrollReset:p,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:x,unstable_useTransitions:C});function U($){e&&e($),$.defaultPrevented||F($)}let W=!(N.isExternal||s),Y=M.createElement("a",{...b,...V,href:(W?O:void 0)||N.absoluteURL||D,onClick:W?U:e,ref:jJ(_,L),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?M.createElement(M.Fragment,null,Y,M.createElement(IJ,{page:D})):Y});QM.displayName="Link";var UJ=M.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},d){let p=JS(o,{relative:c.relative}),m=hh(),x=M.useContext(q5),{navigator:b,basename:_}=M.useContext(sd),S=x!=null&&XJ(p)&&a===!0,w=b.encodeLocation?b.encodeLocation(p).pathname:p.pathname,C=m.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(C=C.toLowerCase(),A=A?A.toLowerCase():null,w=w.toLowerCase()),A&&_&&(A=mp(A,_)||A);const N=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let D=C===w||!i&&C.startsWith(w)&&C.charAt(N)==="/",P=A!=null&&(A===w||!i&&A.startsWith(w)&&A.charAt(w.length)==="/"),O={isActive:D,isPending:P,isTransitioning:S},R=D?e:void 0,L;typeof r=="function"?L=r(O):L=[r,D?"active":null,P?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let V=typeof s=="function"?s(O):s;return M.createElement(QM,{...c,"aria-current":R,className:L,ref:d,style:V,to:o,viewTransition:a},typeof l=="function"?l(O):l)});UJ.displayName="NavLink";var BJ=M.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=IM,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m,...x},b)=>{let{unstable_useTransitions:_}=M.useContext(sd),S=$J(),w=qJ(a,{relative:c}),C=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&lU.test(a),N=D=>{if(l&&l(D),D.defaultPrevented)return;D.preventDefault();let P=D.nativeEvent.submitter,O=(P==null?void 0:P.getAttribute("formmethod"))||o,R=()=>S(P||D.currentTarget,{fetcherKey:e,method:O,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m});_&&n!==!1?M.startTransition(()=>R()):R()};return M.createElement("form",{ref:b,method:C,action:w,onSubmit:r?l:N,...x,"data-discover":!A&&t==="render"?"true":void 0})});BJ.displayName="Form";function HJ(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function cU(t){let e=M.useContext(yy);return to(e,HJ(t)),e}function VJ(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=X5(),p=hh(),m=JS(t,{relative:o});return M.useCallback(x=>{if(yJ(x,e)){x.preventDefault();let b=n!==void 0?n:eS(p)===eS(m),_=()=>d(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l});c?M.startTransition(()=>_()):_()}},[p,d,m,n,r,i,e,t,s,o,a,l,c])}function kk(t){Zd(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=M.useRef(dN(t)),n=M.useRef(!1),r=hh(),i=M.useMemo(()=>bJ(r.search,n.current?null:e.current),[r.search]),s=X5(),o=M.useCallback((a,l)=>{const c=dN(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var GJ=0,WJ=()=>`__${String(++GJ)}__`;function $J(){let{router:t}=cU("useSubmit"),{basename:e}=M.useContext(sd),n=cJ(),r=t.fetch,i=t.navigate;return M.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:p}=wJ(s,e);if(o.navigate===!1){let m=o.fetcherKey||WJ();await r(m,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function qJ(t,{relative:e}={}){let{basename:n}=M.useContext(sd),r=M.useContext(wp);to(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...JS(t||".",{relative:e})},o=hh();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(d=>d==="")){a.delete("index"),l.filter(p=>p).forEach(p=>a.append("index",p));let d=a.toString();s.search=d?`?${d}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:th([n,s.pathname])),eS(s)}function XJ(t,{relative:e}={}){let n=M.useContext(JF);to(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=cU("useViewTransitionState"),i=JS(t,{relative:e});if(!n.isTransitioning)return!1;let s=mp(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=mp(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ZM(i.pathname,o)!=null||ZM(i.pathname,s)!=null}var Wd=GF();const YJ=xy(Wd);var by=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},KJ={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},O0,Mk,kF,ZJ=(kF=class{constructor(){jn(this,O0,KJ);jn(this,Mk,!1)}setTimeoutProvider(t){pn(this,O0,t)}setTimeout(t,e){return ot(this,O0).setTimeout(t,e)}clearTimeout(t){ot(this,O0).clearTimeout(t)}setInterval(t,e){return ot(this,O0).setInterval(t,e)}clearInterval(t){ot(this,O0).clearInterval(t)}},O0=new WeakMap,Mk=new WeakMap,kF),Lg=new ZJ;function QJ(t){setTimeout(t,0)}var ix=typeof window>"u"||"Deno"in globalThis;function zl(){}function JJ(t,e){return typeof t=="function"?t(e):t}function fN(t){return typeof t=="number"&&t>=0&&t!==1/0}function uU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function X0(t,e){return typeof t=="function"?t(e):t}function Vu(t,e){return typeof t=="function"?t(e):t}function tP(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==Dk(o,e.options))return!1}else if(!nS(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function nP(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(tS(e.options.mutationKey)!==tS(s))return!1}else if(!nS(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Dk(t,e){return((e==null?void 0:e.queryKeyHashFn)||tS)(t)}function tS(t){return JSON.stringify(t,(e,n)=>hN(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function nS(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>nS(t[n],e[n])):!1}var eee=Object.prototype.hasOwnProperty;function Pk(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=rP(t)&&rP(e);if(!r&&!(hN(t)&&hN(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d<a;d++){const p=r?d:o[d],m=t[p],x=e[p];if(m===x){l[p]=m,(r?d<s:eee.call(t,p))&&c++;continue}if(m===null||x===null||typeof m!="object"||typeof x!="object"){l[p]=x;continue}const b=Pk(m,x,n+1);l[p]=b,b===m&&c++}return s===a&&c===s?t:l}function JM(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function rP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function hN(t){if(!iP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!iP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function iP(t){return Object.prototype.toString.call(t)==="[object Object]"}function tee(t){return new Promise(e=>{Lg.setTimeout(e,t)})}function pN(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Pk(t,e):e}function od(t){return t}function nee(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function ree(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Ik=Symbol();function dU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ik?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function fU(t,e){return typeof t=="function"?t(...e):!!t}function iee(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Hg,L0,k1,DF,see=(DF=class extends by{constructor(){super();jn(this,Hg);jn(this,L0);jn(this,k1);pn(this,k1,e=>{if(!ix&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ot(this,L0)||this.setEventListener(ot(this,k1))}onUnsubscribe(){var e;this.hasListeners()||((e=ot(this,L0))==null||e.call(this),pn(this,L0,void 0))}setEventListener(e){var n;pn(this,k1,e),(n=ot(this,L0))==null||n.call(this),pn(this,L0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ot(this,Hg)!==e&&(pn(this,Hg,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ot(this,Hg)=="boolean"?ot(this,Hg):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Hg=new WeakMap,L0=new WeakMap,k1=new WeakMap,DF),Ok=new see;function mN(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var oee=QJ;function aee(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=oee;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Vo=aee(),D1,j0,P1,PF,lee=(PF=class extends by{constructor(){super();jn(this,D1,!0);jn(this,j0);jn(this,P1);pn(this,P1,e=>{if(!ix&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ot(this,j0)||this.setEventListener(ot(this,P1))}onUnsubscribe(){var e;this.hasListeners()||((e=ot(this,j0))==null||e.call(this),pn(this,j0,void 0))}setEventListener(e){var n;pn(this,P1,e),(n=ot(this,j0))==null||n.call(this),pn(this,j0,e(this.setOnline.bind(this)))}setOnline(e){ot(this,D1)!==e&&(pn(this,D1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ot(this,D1)}},D1=new WeakMap,j0=new WeakMap,P1=new WeakMap,PF),e2=new lee;function cee(t){return Math.min(1e3*2**t,3e4)}function hU(t){return(t??"online")==="online"?e2.isOnline():!0}var gN=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function pU(t){let e=!1,n=0,r;const i=mN(),s=()=>i.status!=="pending",o=_=>{var S;if(!s()){const w=new gN(_);m(w),(S=t.onCancel)==null||S.call(t,w)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>Ok.isFocused()&&(t.networkMode==="always"||e2.isOnline())&&t.canRun(),d=()=>hU(t.networkMode)&&t.canRun(),p=_=>{s()||(r==null||r(),i.resolve(_))},m=_=>{s()||(r==null||r(),i.reject(_))},x=()=>new Promise(_=>{var S;r=w=>{(s()||c())&&_(w)},(S=t.onPause)==null||S.call(t)}).then(()=>{var _;r=void 0,s()||(_=t.onContinue)==null||_.call(t)}),b=()=>{if(s())return;let _;const S=n===0?t.initialPromise:void 0;try{_=S??t.fn()}catch(w){_=Promise.reject(w)}Promise.resolve(_).then(p).catch(w=>{var P;if(s())return;const C=t.retry??(ix?0:3),A=t.retryDelay??cee,N=typeof A=="function"?A(n,w):A,D=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,w);if(e||!D){m(w);return}n++,(P=t.onFail)==null||P.call(t,n,w),tee(N).then(()=>c()?void 0:x()).then(()=>{e?m(w):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?b():x().then(b),i)}}var Vg,IF,mU=(IF=class{constructor(){jn(this,Vg)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fN(this.gcTime)&&pn(this,Vg,Lg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ix?1/0:300*1e3))}clearGcTimeout(){ot(this,Vg)&&(Lg.clearTimeout(ot(this,Vg)),pn(this,Vg,void 0))}},Vg=new WeakMap,IF),Gg,I1,Bu,Wg,Ma,BS,$g,Ud,ep,OF,uee=(OF=class extends mU{constructor(e){super();jn(this,Ud);jn(this,Gg);jn(this,I1);jn(this,Bu);jn(this,Wg);jn(this,Ma);jn(this,BS);jn(this,$g);pn(this,$g,!1),pn(this,BS,e.defaultOptions),this.setOptions(e.options),this.observers=[],pn(this,Wg,e.client),pn(this,Bu,ot(this,Wg).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,pn(this,Gg,oP(this.options)),this.state=e.state??ot(this,Gg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ot(this,Ma))==null?void 0:e.promise}setOptions(e){if(this.options={...ot(this,BS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=oP(this.options);n.data!==void 0&&(this.setState(sP(n.data,n.dataUpdatedAt)),pn(this,Gg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ot(this,Bu).remove(this)}setData(e,n){const r=pN(this.state.data,e,this.options);return mr(this,Ud,ep).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){mr(this,Ud,ep).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ot(this,Ma))==null?void 0:r.promise;return(i=ot(this,Ma))==null||i.cancel(e),n?n.then(zl).catch(zl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ot(this,Gg))}isActive(){return this.observers.some(e=>Vu(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ik||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>X0(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!uU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ot(this,Ma))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ot(this,Ma))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ot(this,Bu).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ot(this,Ma)&&(ot(this,$g)?ot(this,Ma).cancel({revert:!0}):ot(this,Ma).cancelRetry()),this.scheduleGc()),ot(this,Bu).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||mr(this,Ud,ep).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,d,p,m,x,b,_,S,w,C,A;if(this.state.fetchStatus!=="idle"&&((l=ot(this,Ma))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ot(this,Ma))return ot(this,Ma).continueRetry(),ot(this,Ma).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(D=>D.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(pn(this,$g,!0),r.signal)})},s=()=>{const N=dU(this.options,n),P=(()=>{const O={client:ot(this,Wg),queryKey:this.queryKey,meta:this.meta};return i(O),O})();return pn(this,$g,!1),this.options.persister?this.options.persister(N,P,this):N(P)},a=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ot(this,Wg),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(a,this),pn(this,I1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&mr(this,Ud,ep).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta}),pn(this,Ma,pU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:N=>{N instanceof gN&&N.revert&&this.setState({...ot(this,I1),fetchStatus:"idle"}),r.abort()},onFail:(N,D)=>{mr(this,Ud,ep).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{mr(this,Ud,ep).call(this,{type:"pause"})},onContinue:()=>{mr(this,Ud,ep).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const N=await ot(this,Ma).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(x=(m=ot(this,Bu).config).onSuccess)==null||x.call(m,N,this),(_=(b=ot(this,Bu).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof gN){if(N.silent)return ot(this,Ma).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw mr(this,Ud,ep).call(this,{type:"error",error:N}),(w=(S=ot(this,Bu).config).onError)==null||w.call(S,N,this),(A=(C=ot(this,Bu).config).onSettled)==null||A.call(C,this.state.data,N,this),N}finally{this.scheduleGc()}}},Gg=new WeakMap,I1=new WeakMap,Bu=new WeakMap,Wg=new WeakMap,Ma=new WeakMap,BS=new WeakMap,$g=new WeakMap,Ud=new WeakSet,ep=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...gU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...sP(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pn(this,I1,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Vo.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ot(this,Bu).notify({query:this,type:"updated",action:e})})},OF);function gU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oP(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Sc,ui,HS,jl,qg,O1,ip,z0,VS,L1,j1,Xg,Yg,F0,z1,Vi,v_,xN,vN,yN,bN,_N,SN,wN,xU,LF,Lk=(LF=class extends by{constructor(e,n){super();jn(this,Vi);jn(this,Sc);jn(this,ui);jn(this,HS);jn(this,jl);jn(this,qg);jn(this,O1);jn(this,ip);jn(this,z0);jn(this,VS);jn(this,L1);jn(this,j1);jn(this,Xg);jn(this,Yg);jn(this,F0);jn(this,z1,new Set);this.options=n,pn(this,Sc,e),pn(this,z0,null),pn(this,ip,mN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ot(this,ui).addObserver(this),aP(ot(this,ui),this.options)?mr(this,Vi,v_).call(this):this.updateResult(),mr(this,Vi,bN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return MN(ot(this,ui),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return MN(ot(this,ui),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,mr(this,Vi,_N).call(this),mr(this,Vi,SN).call(this),ot(this,ui).removeObserver(this)}setOptions(e){const n=this.options,r=ot(this,ui);if(this.options=ot(this,Sc).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Vu(this.options.enabled,ot(this,ui))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");mr(this,Vi,wN).call(this),ot(this,ui).setOptions(this.options),n._defaulted&&!JM(this.options,n)&&ot(this,Sc).getQueryCache().notify({type:"observerOptionsUpdated",query:ot(this,ui),observer:this});const i=this.hasListeners();i&&lP(ot(this,ui),r,this.options,n)&&mr(this,Vi,v_).call(this),this.updateResult(),i&&(ot(this,ui)!==r||Vu(this.options.enabled,ot(this,ui))!==Vu(n.enabled,ot(this,ui))||X0(this.options.staleTime,ot(this,ui))!==X0(n.staleTime,ot(this,ui)))&&mr(this,Vi,xN).call(this);const s=mr(this,Vi,vN).call(this);i&&(ot(this,ui)!==r||Vu(this.options.enabled,ot(this,ui))!==Vu(n.enabled,ot(this,ui))||s!==ot(this,F0))&&mr(this,Vi,yN).call(this,s)}getOptimisticResult(e){const n=ot(this,Sc).getQueryCache().build(ot(this,Sc),e),r=this.createResult(n,e);return fee(this,r)&&(pn(this,jl,r),pn(this,O1,this.options),pn(this,qg,ot(this,ui).state)),r}getCurrentResult(){return ot(this,jl)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ot(this,ip).status==="pending"&&ot(this,ip).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ot(this,z1).add(e)}getCurrentQuery(){return ot(this,ui)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ot(this,Sc).defaultQueryOptions(e),r=ot(this,Sc).getQueryCache().build(ot(this,Sc),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return mr(this,Vi,v_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ot(this,jl)))}createResult(e,n){var L;const r=ot(this,ui),i=this.options,s=ot(this,jl),o=ot(this,qg),a=ot(this,O1),c=e!==r?e.state:ot(this,HS),{state:d}=e;let p={...d},m=!1,x;if(n._optimisticResults){const V=this.hasListeners(),F=!V&&aP(e,n),U=V&&lP(e,r,n,i);(F||U)&&(p={...p,...gU(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:_,status:S}=p;x=p.data;let w=!1;if(n.placeholderData!==void 0&&x===void 0&&S==="pending"){let V;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(V=s.data,w=!0):V=typeof n.placeholderData=="function"?n.placeholderData((L=ot(this,j1))==null?void 0:L.state.data,ot(this,j1)):n.placeholderData,V!==void 0&&(S="success",x=pN(s==null?void 0:s.data,V,n),m=!0)}if(n.select&&x!==void 0&&!w)if(s&&x===(o==null?void 0:o.data)&&n.select===ot(this,VS))x=ot(this,L1);else try{pn(this,VS,n.select),x=n.select(x),x=pN(s==null?void 0:s.data,x,n),pn(this,L1,x),pn(this,z0,null)}catch(V){pn(this,z0,V)}ot(this,z0)&&(b=ot(this,z0),x=ot(this,L1),_=Date.now(),S="error");const C=p.fetchStatus==="fetching",A=S==="pending",N=S==="error",D=A&&C,P=x!==void 0,R={status:S,fetchStatus:p.fetchStatus,isPending:A,isSuccess:S==="success",isError:N,isInitialLoading:D,isLoading:D,data:x,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>c.dataUpdateCount||p.errorUpdateCount>c.errorUpdateCount,isFetching:C,isRefetching:C&&!A,isLoadingError:N&&!P,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&P,isStale:jk(e,n),refetch:this.refetch,promise:ot(this,ip),isEnabled:Vu(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const V=R.data!==void 0,F=R.status==="error"&&!V,U=$=>{F?$.reject(R.error):V&&$.resolve(R.data)},W=()=>{const $=pn(this,ip,R.promise=mN());U($)},Y=ot(this,ip);switch(Y.status){case"pending":e.queryHash===r.queryHash&&U(Y);break;case"fulfilled":(F||R.data!==Y.value)&&W();break;case"rejected":(!F||R.error!==Y.reason)&&W();break}}return R}updateResult(){const e=ot(this,jl),n=this.createResult(ot(this,ui),this.options);if(pn(this,qg,ot(this,ui).state),pn(this,O1,this.options),ot(this,qg).data!==void 0&&pn(this,j1,ot(this,ui)),JM(n,e))return;pn(this,jl,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ot(this,z1).size)return!0;const o=new Set(s??ot(this,z1));return this.options.throwOnError&&o.add("error"),Object.keys(ot(this,jl)).some(a=>{const l=a;return ot(this,jl)[l]!==e[l]&&o.has(l)})};mr(this,Vi,xU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&mr(this,Vi,bN).call(this)}},Sc=new WeakMap,ui=new WeakMap,HS=new WeakMap,jl=new WeakMap,qg=new WeakMap,O1=new WeakMap,ip=new WeakMap,z0=new WeakMap,VS=new WeakMap,L1=new WeakMap,j1=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,F0=new WeakMap,z1=new WeakMap,Vi=new WeakSet,v_=function(e){mr(this,Vi,wN).call(this);let n=ot(this,ui).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(zl)),n},xN=function(){mr(this,Vi,_N).call(this);const e=X0(this.options.staleTime,ot(this,ui));if(ix||ot(this,jl).isStale||!fN(e))return;const r=uU(ot(this,jl).dataUpdatedAt,e)+1;pn(this,Xg,Lg.setTimeout(()=>{ot(this,jl).isStale||this.updateResult()},r))},vN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ot(this,ui)):this.options.refetchInterval)??!1},yN=function(e){mr(this,Vi,SN).call(this),pn(this,F0,e),!(ix||Vu(this.options.enabled,ot(this,ui))===!1||!fN(ot(this,F0))||ot(this,F0)===0)&&pn(this,Yg,Lg.setInterval(()=>{(this.options.refetchIntervalInBackground||Ok.isFocused())&&mr(this,Vi,v_).call(this)},ot(this,F0)))},bN=function(){mr(this,Vi,xN).call(this),mr(this,Vi,yN).call(this,mr(this,Vi,vN).call(this))},_N=function(){ot(this,Xg)&&(Lg.clearTimeout(ot(this,Xg)),pn(this,Xg,void 0))},SN=function(){ot(this,Yg)&&(Lg.clearInterval(ot(this,Yg)),pn(this,Yg,void 0))},wN=function(){const e=ot(this,Sc).getQueryCache().build(ot(this,Sc),this.options);if(e===ot(this,ui))return;const n=ot(this,ui);pn(this,ui,e),pn(this,HS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},xU=function(e){Vo.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ot(this,jl))}),ot(this,Sc).getQueryCache().notify({query:ot(this,ui),type:"observerResultsUpdated"})})},LF);function dee(t,e){return Vu(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function aP(t,e){return dee(t,e)||t.state.data!==void 0&&MN(t,e,e.refetchOnMount)}function MN(t,e,n){if(Vu(e.enabled,t)!==!1&&X0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&jk(t,e)}return!1}function lP(t,e,n,r){return(t!==e||Vu(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&jk(t,n)}function jk(t,e){return Vu(e.enabled,t)!==!1&&t.isStaleByTime(X0(e.staleTime,t))}function fee(t,e){return!JM(t.getCurrentResult(),e)}function cP(t){return{onFetch:(e,n)=>{var d,p,m,x,b;const r=e.options,i=(m=(p=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,s=((x=e.state.data)==null?void 0:x.pages)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const S=A=>{iee(A,()=>e.signal,()=>_=!0)},w=dU(e.options,e.fetchOptions),C=async(A,N,D)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const O=(()=>{const F={client:e.client,queryKey:e.queryKey,pageParam:N,direction:D?"backward":"forward",meta:e.options.meta};return S(F),F})(),R=await w(O),{maxPages:L}=e.options,V=D?ree:nee;return{pages:V(A.pages,R,L),pageParams:V(A.pageParams,N,L)}};if(i&&s.length){const A=i==="backward",N=A?hee:uP,D={pages:s,pageParams:o},P=N(r,D);a=await C(D,P,A)}else{const A=t??s.length;do{const N=l===0?o[0]??r.initialPageParam:uP(r,a);if(l>0&&N==null)break;a=await C(a,N),l++}while(l<A)}return a};e.options.persister?e.fetchFn=()=>{var _,S;return(S=(_=e.options).persister)==null?void 0:S.call(_,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function uP(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function hee(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var GS,Hf,fl,Kg,Vf,A0,jF,pee=(jF=class extends mU{constructor(e){super();jn(this,Vf);jn(this,GS);jn(this,Hf);jn(this,fl);jn(this,Kg);pn(this,GS,e.client),this.mutationId=e.mutationId,pn(this,fl,e.mutationCache),pn(this,Hf,[]),this.state=e.state||mee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ot(this,Hf).includes(e)||(ot(this,Hf).push(e),this.clearGcTimeout(),ot(this,fl).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){pn(this,Hf,ot(this,Hf).filter(n=>n!==e)),this.scheduleGc(),ot(this,fl).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ot(this,Hf).length||(this.state.status==="pending"?this.scheduleGc():ot(this,fl).remove(this))}continue(){var e;return((e=ot(this,Kg))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,p,m,x,b,_,S,w,C,A,N,D,P,O;const n=()=>{mr(this,Vf,A0).call(this,{type:"continue"})},r={client:ot(this,GS),meta:this.options.meta,mutationKey:this.options.mutationKey};pn(this,Kg,pU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{mr(this,Vf,A0).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{mr(this,Vf,A0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ot(this,fl).canRun(this)}));const i=this.state.status==="pending",s=!ot(this,Kg).canStart();try{if(i)n();else{mr(this,Vf,A0).call(this,{type:"pending",variables:e,isPaused:s}),ot(this,fl).config.onMutate&&await ot(this,fl).config.onMutate(e,this,r);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));L!==this.state.context&&mr(this,Vf,A0).call(this,{type:"pending",context:L,variables:e,isPaused:s})}const R=await ot(this,Kg).start();return await((c=(l=ot(this,fl).config).onSuccess)==null?void 0:c.call(l,R,e,this.state.context,this,r)),await((p=(d=this.options).onSuccess)==null?void 0:p.call(d,R,e,this.state.context,r)),await((x=(m=ot(this,fl).config).onSettled)==null?void 0:x.call(m,R,null,this.state.variables,this.state.context,this,r)),await((_=(b=this.options).onSettled)==null?void 0:_.call(b,R,null,e,this.state.context,r)),mr(this,Vf,A0).call(this,{type:"success",data:R}),R}catch(R){try{await((w=(S=ot(this,fl).config).onError)==null?void 0:w.call(S,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((A=(C=this.options).onError)==null?void 0:A.call(C,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((D=(N=ot(this,fl).config).onSettled)==null?void 0:D.call(N,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((O=(P=this.options).onSettled)==null?void 0:O.call(P,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw mr(this,Vf,A0).call(this,{type:"error",error:R}),R}finally{ot(this,fl).runNext(this)}}},GS=new WeakMap,Hf=new WeakMap,fl=new WeakMap,Kg=new WeakMap,Vf=new WeakSet,A0=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Vo.batch(()=>{ot(this,Hf).forEach(r=>{r.onMutationUpdate(e)}),ot(this,fl).notify({mutation:this,type:"updated",action:e})})},jF);function mee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var sp,Bd,WS,zF,gee=(zF=class extends by{constructor(e={}){super();jn(this,sp);jn(this,Bd);jn(this,WS);this.config=e,pn(this,sp,new Set),pn(this,Bd,new Map),pn(this,WS,0)}build(e,n,r){const i=new pee({client:e,mutationCache:this,mutationId:++$3(this,WS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ot(this,sp).add(e);const n=X3(e);if(typeof n=="string"){const r=ot(this,Bd).get(n);r?r.push(e):ot(this,Bd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ot(this,sp).delete(e)){const n=X3(e);if(typeof n=="string"){const r=ot(this,Bd).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&ot(this,Bd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=X3(e);if(typeof n=="string"){const r=ot(this,Bd).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=X3(e);if(typeof n=="string"){const i=(r=ot(this,Bd).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Vo.batch(()=>{ot(this,sp).forEach(e=>{this.notify({type:"removed",mutation:e})}),ot(this,sp).clear(),ot(this,Bd).clear()})}getAll(){return Array.from(ot(this,sp))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>nP(n,r))}findAll(e={}){return this.getAll().filter(n=>nP(e,n))}notify(e){Vo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Vo.batch(()=>Promise.all(e.map(n=>n.continue().catch(zl))))}},sp=new WeakMap,Bd=new WeakMap,WS=new WeakMap,zF);function X3(t){var e;return(e=t.options.scope)==null?void 0:e.id}function dP(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function xee(t,e,n){const r=t.slice(0);return r[e]=n,r}var F1,Xc,U1,B1,Hu,U0,$S,qS,XS,YS,qa,TN,CN,EN,AN,NN,FF,vee=(FF=class extends by{constructor(e,n,r){super();jn(this,qa);jn(this,F1);jn(this,Xc);jn(this,U1);jn(this,B1);jn(this,Hu);jn(this,U0);jn(this,$S);jn(this,qS);jn(this,XS);jn(this,YS,[]);pn(this,F1,e),pn(this,B1,r),pn(this,U1,[]),pn(this,Hu,[]),pn(this,Xc,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&ot(this,Hu).forEach(e=>{e.subscribe(n=>{mr(this,qa,AN).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,ot(this,Hu).forEach(e=>{e.destroy()})}setQueries(e,n){pn(this,U1,e),pn(this,B1,n),Vo.batch(()=>{const r=ot(this,Hu),i=mr(this,qa,EN).call(this,ot(this,U1));i.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const s=i.map(p=>p.observer),o=s.map(p=>p.getCurrentResult()),a=r.length!==s.length,l=s.some((p,m)=>p!==r[m]),c=a||l,d=c?!0:o.some((p,m)=>{const x=ot(this,Xc)[m];return!x||!JM(p,x)});!c&&!d||(c&&(pn(this,YS,i),pn(this,Hu,s)),pn(this,Xc,o),this.hasListeners()&&(c&&(dP(r,s).forEach(p=>{p.destroy()}),dP(s,r).forEach(p=>{p.subscribe(m=>{mr(this,qa,AN).call(this,p,m)})})),mr(this,qa,NN).call(this)))})}getCurrentResult(){return ot(this,Xc)}getQueries(){return ot(this,Hu).map(e=>e.getCurrentQuery())}getObservers(){return ot(this,Hu)}getOptimisticResult(e,n){const r=mr(this,qa,EN).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>mr(this,qa,CN).call(this,o??i,n,s),()=>mr(this,qa,TN).call(this,i,r)]}},F1=new WeakMap,Xc=new WeakMap,U1=new WeakMap,B1=new WeakMap,Hu=new WeakMap,U0=new WeakMap,$S=new WeakMap,qS=new WeakMap,XS=new WeakMap,YS=new WeakMap,qa=new WeakSet,TN=function(e,n){return n.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,o=>{n.forEach(a=>{a.observer.trackProp(o)})})})},CN=function(e,n,r){if(n){const i=ot(this,XS),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!ot(this,U0)||ot(this,Xc)!==ot(this,qS)||s||n!==ot(this,$S))&&(pn(this,$S,n),pn(this,qS,ot(this,Xc)),r!==void 0&&pn(this,XS,r),pn(this,U0,Pk(ot(this,U0),n(e)))),ot(this,U0)}return e},EN=function(e){const n=new Map;ot(this,Hu).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=n.get(s);o?o.push(i):n.set(s,[i])});const r=[];return e.forEach(i=>{var l;const s=ot(this,F1).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new Lk(ot(this,F1),s);r.push({defaultedQueryOptions:s,observer:a})}),r},AN=function(e,n){const r=ot(this,Hu).indexOf(e);r!==-1&&(pn(this,Xc,xee(ot(this,Xc),r,n)),mr(this,qa,NN).call(this))},NN=function(){var e;if(this.hasListeners()){const n=ot(this,U0),r=mr(this,qa,TN).call(this,ot(this,Xc),ot(this,YS)),i=mr(this,qa,CN).call(this,r,(e=ot(this,B1))==null?void 0:e.combine);n!==i&&Vo.batch(()=>{this.listeners.forEach(s=>{s(ot(this,Xc))})})}},FF),Gf,UF,yee=(UF=class extends by{constructor(e={}){super();jn(this,Gf);this.config=e,pn(this,Gf,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??Dk(i,n);let o=this.get(s);return o||(o=new uee({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ot(this,Gf).has(e.queryHash)||(ot(this,Gf).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ot(this,Gf).get(e.queryHash);n&&(e.destroy(),n===e&&ot(this,Gf).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Vo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ot(this,Gf).get(e)}getAll(){return[...ot(this,Gf).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>tP(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>tP(e,r)):n}notify(e){Vo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Vo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Vo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Gf=new WeakMap,UF),po,B0,H0,H1,V1,V0,G1,W1,BF,bee=(BF=class{constructor(t={}){jn(this,po);jn(this,B0);jn(this,H0);jn(this,H1);jn(this,V1);jn(this,V0);jn(this,G1);jn(this,W1);pn(this,po,t.queryCache||new yee),pn(this,B0,t.mutationCache||new gee),pn(this,H0,t.defaultOptions||{}),pn(this,H1,new Map),pn(this,V1,new Map),pn(this,V0,0)}mount(){$3(this,V0)._++,ot(this,V0)===1&&(pn(this,G1,Ok.subscribe(async t=>{t&&(await this.resumePausedMutations(),ot(this,po).onFocus())})),pn(this,W1,e2.subscribe(async t=>{t&&(await this.resumePausedMutations(),ot(this,po).onOnline())})))}unmount(){var t,e;$3(this,V0)._--,ot(this,V0)===0&&((t=ot(this,G1))==null||t.call(this),pn(this,G1,void 0),(e=ot(this,W1))==null||e.call(this),pn(this,W1,void 0))}isFetching(t){return ot(this,po).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ot(this,B0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ot(this,po).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ot(this,po).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(X0(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ot(this,po).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ot(this,po).get(r.queryHash),s=i==null?void 0:i.state.data,o=JJ(e,s);if(o!==void 0)return ot(this,po).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Vo.batch(()=>ot(this,po).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ot(this,po).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ot(this,po);Vo.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ot(this,po);return Vo.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Vo.batch(()=>ot(this,po).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(zl).catch(zl)}invalidateQueries(t,e={}){return Vo.batch(()=>(ot(this,po).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Vo.batch(()=>ot(this,po).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(zl)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(zl)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ot(this,po).build(this,e);return n.isStaleByTime(X0(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(zl).catch(zl)}fetchInfiniteQuery(t){return t.behavior=cP(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(zl).catch(zl)}ensureInfiniteQueryData(t){return t.behavior=cP(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return e2.isOnline()?ot(this,B0).resumePausedMutations():Promise.resolve()}getQueryCache(){return ot(this,po)}getMutationCache(){return ot(this,B0)}getDefaultOptions(){return ot(this,H0)}setDefaultOptions(t){pn(this,H0,t)}setQueryDefaults(t,e){ot(this,H1).set(tS(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ot(this,H1).values()],n={};return e.forEach(r=>{nS(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ot(this,V1).set(tS(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ot(this,V1).values()],n={};return e.forEach(r=>{nS(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ot(this,H0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Dk(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ik&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ot(this,H0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ot(this,po).clear(),ot(this,B0).clear()}},po=new WeakMap,B0=new WeakMap,H0=new WeakMap,H1=new WeakMap,V1=new WeakMap,V0=new WeakMap,G1=new WeakMap,W1=new WeakMap,BF),vU=M.createContext(void 0),bx=t=>{const e=M.useContext(vU);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},_ee=({client:t,children:e})=>(M.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),f.jsx(vU.Provider,{value:t,children:e})),yU=M.createContext(!1),bU=()=>M.useContext(yU);yU.Provider;function See(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var wee=M.createContext(See()),_U=()=>M.useContext(wee),SU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?fU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},wU=t=>{M.useEffect(()=>{t.clearReset()},[t])},MU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||fU(n,[t.error,r])),TU=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Mee=(t,e)=>t.isLoading&&t.isFetching&&!e,RN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,kN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function Tee({queries:t,...e},n){const r=bx(),i=bU(),s=_U(),o=M.useMemo(()=>t.map(_=>{const S=r.defaultQueryOptions(_);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,r,i]);o.forEach(_=>{TU(_);const S=r.getQueryCache().get(_.queryHash);SU(_,s,S)}),wU(s);const[a]=M.useState(()=>new vee(r,o,e)),[l,c,d]=a.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;M.useSyncExternalStore(M.useCallback(_=>p?a.subscribe(Vo.batchCalls(_)):zl,[a,p]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),M.useEffect(()=>{a.setQueries(o,e)},[o,e,a]);const x=l.some((_,S)=>RN(o[S],_))?l.flatMap((_,S)=>{const w=o[S];if(w&&RN(w,_)){const C=new Lk(r,w);return kN(w,C,s)}return[]}):[];if(x.length>0)throw Promise.all(x);const b=l.find((_,S)=>{const w=o[S];return w&&MU({result:_,errorResetBoundary:s,throwOnError:w.throwOnError,query:r.getQueryCache().get(w.queryHash),suspense:w.suspense})});if(b!=null&&b.error)throw b.error;return c(d())}function Cee(t,e,n){var m,x,b,_;const r=bU(),i=_U(),s=bx(),o=s.defaultQueryOptions(t);(x=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||x.call(m,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",TU(o),SU(o,i,a),wU(i);const l=!s.getQueryCache().get(o.queryHash),[c]=M.useState(()=>new e(s,o)),d=c.getOptimisticResult(o),p=!r&&t.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(S=>{const w=p?c.subscribe(Vo.batchCalls(S)):zl;return c.updateResult(),w},[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(o)},[o,c]),RN(o,d))throw kN(o,c,i);if(MU({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,o,d),o.experimental_prefetchInRender&&!ix&&Mee(d,r)){const S=l?kN(o,c,i):a==null?void 0:a.promise;S==null||S.catch(zl).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function $i(t,e){return Cee(t,Lk)}const $f={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function CU(t){return"init"in t}function DN(t){return!!t.write}function fP(t){return"v"in t||"e"in t}function t2(t){if("e"in t)throw t.e;if(($f?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function n2(t){return typeof(t==null?void 0:t.then)=="function"}function EU(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function AU(t,e,n){var r;const i=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])i.add(s);for(const s of e.p)i.add(s);return i}const Eee=(t,e,...n)=>e.read(...n),Aee=(t,e,...n)=>e.write(...n),Nee=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},Ree=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},kee=(t,e)=>{var n;const r=oa(t),i=r[0],s=r[6],o=r[9];if(($f?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let a=i.get(e);return a||(a={d:new Map,p:new Set,n:0},i.set(e,a),(n=s.i)==null||n.call(s,e),o==null||o(t,e)),a},Dee=t=>{const e=oa(t),n=e[1],r=e[3],i=e[4],s=e[5],o=e[6],a=e[13],l=[],c=d=>{try{d()}catch(p){l.push(p)}};do{o.f&&c(o.f);const d=new Set,p=d.add.bind(d);r.forEach(m=>{var x;return(x=n.get(m))==null?void 0:x.l.forEach(p)}),r.clear(),s.forEach(p),s.clear(),i.forEach(p),i.clear(),d.forEach(c),r.size&&a(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},Pee=t=>{const e=oa(t),n=e[1],r=e[2],i=e[3],s=e[11],o=e[14],a=e[17],l=[],c=new WeakSet,d=new WeakSet,p=Array.from(i);for(;p.length;){const m=p[p.length-1],x=s(t,m);if(d.has(m)){p.pop();continue}if(c.has(m)){if(r.get(m)===x.n)l.push([m,x]);else if(($f?"production":void 0)!=="production"&&r.has(m))throw new Error("[Bug] invalidated atom exists");d.add(m),p.pop();continue}c.add(m);for(const b of AU(m,x,n))c.has(b)||p.push(b)}for(let m=l.length-1;m>=0;--m){const[x,b]=l[m];let _=!1;for(const S of b.d.keys())if(S!==x&&i.has(S)){_=!0;break}_&&(o(t,x),a(t,x)),r.delete(x)}},PN=new WeakSet,Iee=(t,e)=>{var n,r;const i=oa(t),s=i[1],o=i[2],a=i[3],l=i[6],c=i[7],d=i[11],p=i[12],m=i[13],x=i[14],b=i[16],_=i[17],S=i[20],w=i[26],C=d(t,e);if(fP(C)){if(s.has(e)&&o.get(e)!==C.n)return C;let W=!1;for(const[Y,$]of C.d)if(x(t,Y).n!==$){W=!0;break}if(!W)return C}let A=!0;const N=new Set(C.d.keys()),D=new Map,P=()=>{for(const W of N)D.has(W)||C.d.delete(W)},O=()=>{if(s.has(e)){const W=!a.size;_(t,e),W&&(m(t),p(t))}},R=W=>{var Y;if(W===e){const X=d(t,W);if(!fP(X))if(CU(W))S(t,W,W.init);else throw new Error("no atom init");return t2(X)}const $=x(t,W);try{return t2($)}finally{D.set(W,$.n),C.d.set(W,$.n),n2(C.v)&&EU(e,C.v,$),s.has(e)&&((Y=s.get(W))==null||Y.t.add(e)),A||O()}};let L,V;const F={get signal(){return L||(L=new AbortController),L.signal},get setSelf(){return($f?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),($f?"production":void 0)!=="production"&&!DN(e)&&console.warn("setSelf function cannot be used with read-only atom"),!V&&DN(e)&&(V=(...W)=>{if(($f?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...W)}finally{m(t),p(t)}}),V}},U=C.n;try{($f?"production":void 0)!=="production"&&PN.delete(t);const W=c(t,e,R,F);if(($f?"production":void 0)!=="production"&&PN.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),S(t,e,W),n2(W)){w(t,W,()=>L==null?void 0:L.abort());const Y=()=>{P(),O()};W.then(Y,Y)}else P();return(n=l.r)==null||n.call(l,e),C}catch(W){return delete C.v,C.e=W,++C.n,C}finally{A=!1,U!==C.n&&o.get(e)===U&&(o.set(e,C.n),a.add(e),(r=l.c)==null||r.call(l,e))}},Oee=(t,e)=>{const n=oa(t),r=n[1],i=n[2],s=n[11],o=[e];for(;o.length;){const a=o.pop(),l=s(t,a);for(const c of AU(a,l,r)){const d=s(t,c);i.get(c)!==d.n&&(i.set(c,d.n),o.push(c))}}},Lee=(t,e,...n)=>{const r=oa(t),i=r[3],s=r[6],o=r[8],a=r[11],l=r[12],c=r[13],d=r[14],p=r[15],m=r[16],x=r[17],b=r[20];let _=!0;const S=C=>t2(d(t,C)),w=(C,...A)=>{var N;const D=a(t,C);try{if(C===e){if(!CU(C))throw new Error("atom not writable");($f?"production":void 0)!=="production"&&PN.add(t);const P=D.n,O=A[0];b(t,C,O),x(t,C),P!==D.n&&(i.add(C),p(t,C),(N=s.c)==null||N.call(s,C));return}else return m(t,C,...A)}finally{_||(c(t),l(t))}};try{return o(t,e,S,w,...n)}finally{_=!1}},jee=(t,e)=>{var n;const r=oa(t),i=r[1],s=r[3],o=r[6],a=r[11],l=r[15],c=r[18],d=r[19],p=a(t,e),m=i.get(e);if(m){for(const[x,b]of p.d)if(!m.d.has(x)){const _=a(t,x);c(t,x).t.add(e),m.d.add(x),b!==_.n&&(s.add(x),l(t,x),(n=o.c)==null||n.call(o,x))}for(const x of m.d)if(!p.d.has(x)){m.d.delete(x);const b=d(t,x);b==null||b.t.delete(e)}}},zee=(t,e)=>{var n;const r=oa(t),i=r[1],s=r[4],o=r[6],a=r[10],l=r[11],c=r[12],d=r[13],p=r[14],m=r[16],x=r[18],b=l(t,e);let _=i.get(e);if(!_){p(t,e);for(const S of b.d.keys())x(t,S).t.add(e);if(_={l:new Set,d:new Set(b.d.keys()),t:new Set},i.set(e,_),DN(e)){const S=()=>{let w=!0;const C=(...A)=>{try{return m(t,e,...A)}finally{w||(d(t),c(t))}};try{const A=a(t,e,C);A&&(_.u=()=>{w=!0;try{A()}finally{w=!1}})}finally{w=!1}};s.add(S)}(n=o.m)==null||n.call(o,e)}return _},Fee=(t,e)=>{var n,r;const i=oa(t),s=i[1],o=i[5],a=i[6],l=i[11],c=i[19],d=l(t,e);let p=s.get(e);if(!p||p.l.size)return p;let m=!1;for(const x of p.t)if((n=s.get(x))!=null&&n.d.has(e)){m=!0;break}if(!m){p.u&&o.add(p.u),p=void 0,s.delete(e);for(const x of d.d.keys()){const b=c(t,x);b==null||b.t.delete(e)}(r=a.u)==null||r.call(a,e);return}return p},Uee=(t,e,n)=>{const r=oa(t),i=r[11],s=r[27],o=i(t,e),a="v"in o,l=o.v;if(n2(n))for(const c of o.d.keys())EU(e,n,i(t,c));o.v=n,delete o.e,(!a||!Object.is(l,o.v))&&(++o.n,n2(l)&&s(t,l))},Bee=(t,e)=>{const n=oa(t)[14];return t2(n(t,e))},Hee=(t,e,...n)=>{const r=oa(t),i=r[12],s=r[13],o=r[16];try{return o(t,e,...n)}finally{s(t),i(t)}},Vee=(t,e,n)=>{const r=oa(t),i=r[12],s=r[18],o=r[19],l=s(t,e).l;return l.add(n),i(t),()=>{l.delete(n),o(t,e),i(t)}},Gee=(t,e,n)=>{const i=oa(t)[25];let s=i.get(e);if(!s){s=new Set,i.set(e,s);const o=()=>i.delete(e);e.then(o,o)}s.add(n)},Wee=(t,e)=>{const i=oa(t)[25].get(e);i==null||i.forEach(s=>s())},NU=new WeakMap,oa=t=>{const e=NU.get(t);if(($f?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function $ee(t){const e=oa(t),n=e[24];return n?n(e):e}function qee(...t){const e={get(r){const i=oa(e)[21];return i(e,r)},set(r,...i){const s=oa(e)[22];return s(e,r,...i)},sub(r,i){const s=oa(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Eee,Aee,Nee,Ree,kee,Dee,Pee,Iee,Oee,Lee,jee,zee,Fee,Uee,Bee,Hee,Vee,void 0,new WeakMap,Gee,Wee].map((r,i)=>t[i]||r);return NU.set(e,Object.freeze(n)),e}const RU={};let Xee=0;function Lr(t,e){const n=`atom${++Xee}`,r={toString(){return(RU?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Yee,r.write=Kee),e&&(r.write=e),r}function Yee(t){return t(this)}function Kee(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function kU(){return qee()}let Xb;function Zee(){return Xb||(Xb=kU(),(RU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Xb),globalThis.__JOTAI_DEFAULT_STORE__!==Xb&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Xb}const Qee={},IN=M.createContext(void 0);function DU(t){return M.useContext(IN)||Zee()}function Jee({children:t,store:e}){const n=M.useRef(null);return e?M.createElement(IN.Provider,{value:e},t):(n.current===null&&(n.current=kU()),M.createElement(IN.Provider,{value:n.current},t))}const ON=t=>typeof(t==null?void 0:t.then)=="function",LN=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},ete=ei.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(LN(t),t)}),LE=new WeakMap,hP=(t,e,n)=>{const i=$ee(t)[26];let s=LE.get(e);return s||(s=new Promise((o,a)=>{let l=e;const c=m=>x=>{l===m&&o(x)},d=m=>x=>{l===m&&a(x)},p=()=>{try{const m=n();ON(m)?(LE.set(m,s),l=m,m.then(c(m),d(m)),i(t,m,p)):o(m)}catch(m){a(m)}};e.then(c(e),d(e)),i(t,e,p)}),LE.set(e,s)),s};function Jn(t,e){const{delay:n,unstable_promiseStatus:r=!ei.use}={},i=DU(),[[s,o,a],l]=M.useReducer(d=>{const p=i.get(t);return Object.is(d[0],p)&&d[1]===i&&d[2]===t?d:[p,i,t]},void 0,()=>[i.get(t),i,t]);let c=s;if((o!==i||a!==t)&&(l(),c=i.get(t)),M.useEffect(()=>{const d=i.sub(t,()=>{if(r)try{const p=i.get(t);ON(p)&&LN(hP(i,p,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[i,t,n,r]),M.useDebugValue(c),ON(c)){const d=hP(i,c,()=>i.get(t));return r&&LN(d),ete(d)}return c}function $d(t,e){const n=DU();return M.useCallback((...i)=>{if((Qee?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function dn(t,e){return[Jn(t),$d(t)]}function pP(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function K5(...t){return e=>{let n=!1;const r=t.map(i=>{const s=pP(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():pP(t[i],null)}}}}function Ur(...t){return M.useCallback(K5(...t),t)}function K0(t){const e=tte(t),n=M.forwardRef((r,i)=>{const{children:s,...o}=r,a=M.Children.toArray(s),l=a.find(nte);if(l){const c=l.props.children,d=a.map(p=>p===l?M.Children.count(c)>1?M.Children.only(null):M.isValidElement(c)?c.props.children:null:p);return f.jsx(e,{...o,ref:i,children:M.isValidElement(c)?M.cloneElement(c,void 0,d):null})}return f.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var PU=K0("Slot");function tte(t){const e=M.forwardRef((n,r)=>{const{children:i,...s}=n;if(M.isValidElement(i)){const o=ite(i),a=rte(s,i.props);return i.type!==M.Fragment&&(a.ref=r?K5(r,o):o),M.cloneElement(i,a)}return M.Children.count(i)>1?M.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var IU=Symbol("radix.slottable");function OU(t){const e=({children:n})=>f.jsx(f.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=IU,e}function nte(t){return M.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===IU}function rte(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function ite(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ste=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cr=ste.reduce((t,e)=>{const n=K0(`Primitive.${e}`),r=M.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function LU(t,e){t&&Wd.flushSync(()=>t.dispatchEvent(e))}var jU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ote="VisuallyHidden",zU=M.forwardRef((t,e)=>f.jsx(cr.span,{...t,ref:e,style:{...jU,...t.style}}));zU.displayName=ote;var ate=zU;function lte(t,e){const n=M.createContext(e),r=s=>{const{children:o,...a}=s,l=M.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=M.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function du(t,e=[]){let n=[];function r(s,o){const a=M.createContext(o),l=n.length;n=[...n,o];const c=p=>{var w;const{scope:m,children:x,...b}=p,_=((w=m==null?void 0:m[t])==null?void 0:w[l])||a,S=M.useMemo(()=>b,Object.values(b));return f.jsx(_.Provider,{value:S,children:x})};c.displayName=s+"Provider";function d(p,m){var _;const x=((_=m==null?void 0:m[t])==null?void 0:_[l])||a,b=M.useContext(x);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>M.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return M.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,cte(i,...e)]}function cte(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const p=l(s)[`__scope${c}`];return{...a,...p}},{});return M.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function zk(t){const e=t+"CollectionProvider",[n,r]=du(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:S,children:w}=_,C=ei.useRef(null),A=ei.useRef(new Map).current;return f.jsx(i,{scope:S,itemMap:A,collectionRef:C,children:w})};o.displayName=e;const a=t+"CollectionSlot",l=K0(a),c=ei.forwardRef((_,S)=>{const{scope:w,children:C}=_,A=s(a,w),N=Ur(S,A.collectionRef);return f.jsx(l,{ref:N,children:C})});c.displayName=a;const d=t+"CollectionItemSlot",p="data-radix-collection-item",m=K0(d),x=ei.forwardRef((_,S)=>{const{scope:w,children:C,...A}=_,N=ei.useRef(null),D=Ur(S,N),P=s(d,w);return ei.useEffect(()=>(P.itemMap.set(N,{ref:N,...A}),()=>void P.itemMap.delete(N))),f.jsx(m,{[p]:"",ref:D,children:C})});x.displayName=d;function b(_){const S=s(t+"CollectionConsumer",_);return ei.useCallback(()=>{const C=S.collectionRef.current;if(!C)return[];const A=Array.from(C.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((P,O)=>A.indexOf(P.ref.current)-A.indexOf(O.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:c,ItemSlot:x},b,r]}function bn(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}var Ea=globalThis!=null&&globalThis.document?M.useLayoutEffect:()=>{},ute=HF[" useInsertionEffect ".trim().toString()]||Ea;function ed({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=dte({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=M.useRef(t!==void 0);M.useEffect(()=>{const p=d.current;p!==a&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=M.useCallback(d=>{var p;if(a){const m=fte(d)?d(t):d;m!==t&&((p=o.current)==null||p.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function dte({defaultProp:t,onChange:e}){const[n,r]=M.useState(t),i=M.useRef(n),s=M.useRef(e);return ute(()=>{s.current=e},[e]),M.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function fte(t){return typeof t=="function"}function hte(t,e){return M.useReducer((n,r)=>e[n][r]??n,t)}var Xa=t=>{const{present:e,children:n}=t,r=pte(e),i=typeof n=="function"?n({present:r.isPresent}):M.Children.only(n),s=Ur(r.ref,mte(i));return typeof n=="function"||r.isPresent?M.cloneElement(i,{ref:s}):null};Xa.displayName="Presence";function pte(t){const[e,n]=M.useState(),r=M.useRef(null),i=M.useRef(t),s=M.useRef("none"),o=t?"mounted":"unmounted",[a,l]=hte(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return M.useEffect(()=>{const c=Y3(r.current);s.current=a==="mounted"?c:"none"},[a]),Ea(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,x=Y3(c);t?l("MOUNT"):x==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==x?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ea(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,p=x=>{const _=Y3(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&_&&(l("ANIMATION_END"),!i.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},m=x=>{x.target===e&&(s.current=Y3(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:M.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Y3(t){return(t==null?void 0:t.animationName)||"none"}function mte(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gte=HF[" useId ".trim().toString()]||(()=>{}),xte=0;function Ac(t){const[e,n]=M.useState(gte());return Ea(()=>{n(r=>r??String(xte++))},[t]),t||(e?`radix-${e}`:"")}var Z5="Collapsible",[vte]=du(Z5),[yte,Fk]=vte(Z5),FU=M.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=ed({prop:r,defaultProp:i??!1,onChange:o,caller:Z5});return f.jsx(yte,{scope:n,disabled:s,contentId:Ac(),open:l,onOpenToggle:M.useCallback(()=>c(d=>!d),[c]),children:f.jsx(cr.div,{"data-state":Bk(l),"data-disabled":s?"":void 0,...a,ref:e})})});FU.displayName=Z5;var UU="CollapsibleTrigger",BU=M.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=Fk(UU,n);return f.jsx(cr.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Bk(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:bn(t.onClick,i.onOpenToggle)})});BU.displayName=UU;var Uk="CollapsibleContent",HU=M.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Fk(Uk,t.__scopeCollapsible);return f.jsx(Xa,{present:n||i.open,children:({present:s})=>f.jsx(bte,{...r,ref:e,present:s})})});HU.displayName=Uk;var bte=M.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=Fk(Uk,n),[a,l]=M.useState(r),c=M.useRef(null),d=Ur(e,c),p=M.useRef(0),m=p.current,x=M.useRef(0),b=x.current,_=o.open||a,S=M.useRef(_),w=M.useRef(void 0);return M.useEffect(()=>{const C=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(C)},[]),Ea(()=>{const C=c.current;if(C){w.current=w.current||{transitionDuration:C.style.transitionDuration,animationName:C.style.animationName},C.style.transitionDuration="0s",C.style.animationName="none";const A=C.getBoundingClientRect();p.current=A.height,x.current=A.width,S.current||(C.style.transitionDuration=w.current.transitionDuration,C.style.animationName=w.current.animationName),l(r)}},[o.open,r]),f.jsx(cr.div,{"data-state":Bk(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!_,...s,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:_&&i})});function Bk(t){return t?"open":"closed"}var _te=FU,Ste=BU,wte=HU,Mte=M.createContext(void 0);function ew(t){const e=M.useContext(Mte);return t||e||"ltr"}function Ca(t){const e=M.useRef(t);return M.useEffect(()=>{e.current=t}),M.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Tte(t,e=globalThis==null?void 0:globalThis.document){const n=Ca(t);M.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Cte="DismissableLayer",jN="dismissableLayer.update",Ete="dismissableLayer.pointerDownOutside",Ate="dismissableLayer.focusOutside",mP,VU=M.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_y=M.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=M.useContext(VU),[d,p]=M.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=M.useState({}),b=Ur(e,O=>p(O)),_=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=_.indexOf(S),C=d?_.indexOf(d):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=C>=w,D=kte(O=>{const R=O.target,L=[...c.branches].some(V=>V.contains(R));!N||L||(i==null||i(O),o==null||o(O),O.defaultPrevented||a==null||a())},m),P=Dte(O=>{const R=O.target;[...c.branches].some(V=>V.contains(R))||(s==null||s(O),o==null||o(O),O.defaultPrevented||a==null||a())},m);return Tte(O=>{C===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},m),M.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(mP=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),gP(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=mP)}},[d,m,n,c]),M.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),gP())},[d,c]),M.useEffect(()=>{const O=()=>x({});return document.addEventListener(jN,O),()=>document.removeEventListener(jN,O)},[]),f.jsx(cr.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:bn(t.onFocusCapture,P.onFocusCapture),onBlurCapture:bn(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:bn(t.onPointerDownCapture,D.onPointerDownCapture)})});_y.displayName=Cte;var Nte="DismissableLayerBranch",Rte=M.forwardRef((t,e)=>{const n=M.useContext(VU),r=M.useRef(null),i=Ur(e,r);return M.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),f.jsx(cr.div,{...t,ref:i})});Rte.displayName=Nte;function kte(t,e=globalThis==null?void 0:globalThis.document){const n=Ca(t),r=M.useRef(!1),i=M.useRef(()=>{});return M.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){GU(Ete,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Dte(t,e=globalThis==null?void 0:globalThis.document){const n=Ca(t),r=M.useRef(!1);return M.useEffect(()=>{const i=s=>{s.target&&!r.current&&GU(Ate,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gP(){const t=new CustomEvent(jN);document.dispatchEvent(t)}function GU(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?LU(i,s):i.dispatchEvent(s)}var jE="focusScope.autoFocusOnMount",zE="focusScope.autoFocusOnUnmount",xP={bubbles:!1,cancelable:!0},Pte="FocusScope",tw=M.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=M.useState(null),c=Ca(i),d=Ca(s),p=M.useRef(null),m=Ur(e,_=>l(_)),x=M.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;M.useEffect(()=>{if(r){let _=function(A){if(x.paused||!a)return;const N=A.target;a.contains(N)?p.current=N:N0(p.current,{select:!0})},S=function(A){if(x.paused||!a)return;const N=A.relatedTarget;N!==null&&(a.contains(N)||N0(p.current,{select:!0}))},w=function(A){if(document.activeElement===document.body)for(const D of A)D.removedNodes.length>0&&N0(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",S);const C=new MutationObserver(w);return a&&C.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),C.disconnect()}}},[r,a,x.paused]),M.useEffect(()=>{if(a){yP.add(x);const _=document.activeElement;if(!a.contains(_)){const w=new CustomEvent(jE,xP);a.addEventListener(jE,c),a.dispatchEvent(w),w.defaultPrevented||(Ite(Fte(WU(a)),{select:!0}),document.activeElement===_&&N0(a))}return()=>{a.removeEventListener(jE,c),setTimeout(()=>{const w=new CustomEvent(zE,xP);a.addEventListener(zE,d),a.dispatchEvent(w),w.defaultPrevented||N0(_??document.body,{select:!0}),a.removeEventListener(zE,d),yP.remove(x)},0)}}},[a,c,d,x]);const b=M.useCallback(_=>{if(!n&&!r||x.paused)return;const S=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,w=document.activeElement;if(S&&w){const C=_.currentTarget,[A,N]=Ote(C);A&&N?!_.shiftKey&&w===N?(_.preventDefault(),n&&N0(A,{select:!0})):_.shiftKey&&w===A&&(_.preventDefault(),n&&N0(N,{select:!0})):w===C&&_.preventDefault()}},[n,r,x.paused]);return f.jsx(cr.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});tw.displayName=Pte;function Ite(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(N0(r,{select:e}),document.activeElement!==n)return}function Ote(t){const e=WU(t),n=vP(e,t),r=vP(e.reverse(),t);return[n,r]}function WU(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vP(t,e){for(const n of t)if(!Lte(n,{upTo:e}))return n}function Lte(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function jte(t){return t instanceof HTMLInputElement&&"select"in t}function N0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&jte(t)&&e&&t.select()}}var yP=zte();function zte(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=bP(t,e),t.unshift(e)},remove(e){var n;t=bP(t,e),(n=t[0])==null||n.resume()}}}function bP(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Fte(t){return t.filter(e=>e.tagName!=="A")}var Ute="Portal",Sy=M.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=M.useState(!1);Ea(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?YJ.createPortal(f.jsx(cr.div,{...r,ref:e}),o):null});Sy.displayName=Ute;var FE=0;function Q5(){M.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??_P()),document.body.insertAdjacentElement("beforeend",t[1]??_P()),FE++,()=>{FE===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),FE--}},[])}function _P(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var qf=function(){return qf=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qf.apply(this,arguments)};function $U(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Bte(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var LM="right-scroll-bar-position",jM="width-before-scroll-bar",Hte="with-scroll-bars-hidden",Vte="--removed-body-scroll-bar-size";function UE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Gte(t,e){var n=M.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var Wte=typeof window<"u"?M.useLayoutEffect:M.useEffect,SP=new WeakMap;function $te(t,e){var n=Gte(null,function(r){return t.forEach(function(i){return UE(i,r)})});return Wte(function(){var r=SP.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||UE(a,null)}),s.forEach(function(a){i.has(a)||UE(a,o)})}SP.set(n,t)},[t]),n}function qte(t){return t}function Xte(t,e){e===void 0&&(e=qte);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var d=o;o=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function Yte(t){t===void 0&&(t={});var e=Xte(null);return e.options=qf({async:!0,ssr:!1},t),e}var qU=function(t){var e=t.sideCar,n=$U(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return M.createElement(r,qf({},n))};qU.isSideCarExport=!0;function Kte(t,e){return t.useMedium(e),qU}var XU=Yte(),BE=function(){},J5=M.forwardRef(function(t,e){var n=M.useRef(null),r=M.useState({onScrollCapture:BE,onWheelCapture:BE,onTouchMoveCapture:BE}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,p=t.shards,m=t.sideCar,x=t.noRelative,b=t.noIsolation,_=t.inert,S=t.allowPinchZoom,w=t.as,C=w===void 0?"div":w,A=t.gapMode,N=$U(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=m,P=$te([n,e]),O=qf(qf({},N),i);return M.createElement(M.Fragment,null,d&&M.createElement(D,{sideCar:XU,removeScrollBar:c,shards:p,noRelative:x,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!S,lockRef:n,gapMode:A}),o?M.cloneElement(M.Children.only(a),qf(qf({},O),{ref:P})):M.createElement(C,qf({},O,{className:l,ref:P}),a))});J5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};J5.classNames={fullWidth:jM,zeroRight:LM};var Zte=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Qte(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Zte();return e&&t.setAttribute("nonce",e),t}function Jte(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ene(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var tne=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Qte())&&(Jte(e,n),ene(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},nne=function(){var t=tne();return function(e,n){M.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},YU=function(){var t=nne(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},rne={left:0,top:0,right:0,gap:0},HE=function(t){return parseInt(t||"",10)||0},ine=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[HE(n),HE(r),HE(i)]},sne=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return rne;var e=ine(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},one=YU(),g1="data-scroll-locked",ane=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(Hte,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(g1,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(i,`px;
    padding-top: `).concat(s,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(LM,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(jM,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(LM," .").concat(LM,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(jM," .").concat(jM,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(g1,`] {
    `).concat(Vte,": ").concat(a,`px;
  }
`)},wP=function(){var t=parseInt(document.body.getAttribute(g1)||"0",10);return isFinite(t)?t:0},lne=function(){M.useEffect(function(){return document.body.setAttribute(g1,(wP()+1).toString()),function(){var t=wP()-1;t<=0?document.body.removeAttribute(g1):document.body.setAttribute(g1,t.toString())}},[])},cne=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;lne();var s=M.useMemo(function(){return sne(i)},[i]);return M.createElement(one,{styles:ane(s,!e,i,n?"":"!important")})},zN=!1;if(typeof window<"u")try{var K3=Object.defineProperty({},"passive",{get:function(){return zN=!0,!0}});window.addEventListener("test",K3,K3),window.removeEventListener("test",K3,K3)}catch{zN=!1}var Av=zN?{passive:!1}:!1,une=function(t){return t.tagName==="TEXTAREA"},KU=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!une(t)&&n[e]==="visible")},dne=function(t){return KU(t,"overflowY")},fne=function(t){return KU(t,"overflowX")},MP=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=ZU(t,r);if(i){var s=QU(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hne=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},pne=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ZU=function(t,e){return t==="v"?dne(e):fne(e)},QU=function(t,e){return t==="v"?hne(e):pne(e)},mne=function(t,e){return t==="h"&&e==="rtl"?-1:1},gne=function(t,e,n,r,i){var s=mne(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,p=0,m=0;do{if(!a)break;var x=QU(t,a),b=x[0],_=x[1],S=x[2],w=_-S-s*b;(b||w)&&ZU(t,a)&&(p+=w,m+=b);var C=a.parentNode;a=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(p)<1||!d&&Math.abs(m)<1)&&(c=!0),c},Z3=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},TP=function(t){return[t.deltaX,t.deltaY]},CP=function(t){return t&&"current"in t?t.current:t},xne=function(t,e){return t[0]===e[0]&&t[1]===e[1]},vne=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},yne=0,Nv=[];function bne(t){var e=M.useRef([]),n=M.useRef([0,0]),r=M.useRef(),i=M.useState(yne++)[0],s=M.useState(YU)[0],o=M.useRef(t);M.useEffect(function(){o.current=t},[t]),M.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=Bte([t.lockRef.current],(t.shards||[]).map(CP),!0).filter(Boolean);return _.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=M.useCallback(function(_,S){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var w=Z3(_),C=n.current,A="deltaX"in _?_.deltaX:C[0]-w[0],N="deltaY"in _?_.deltaY:C[1]-w[1],D,P=_.target,O=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&O==="h"&&P.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,V=L?L===P||L.contains(P):!1;if(V)return!1;var F=MP(O,P);if(!F)return!0;if(F?D=O:(D=O==="v"?"h":"v",F=MP(O,P)),!F)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=D),!D)return!0;var U=r.current||D;return gne(U,S,_,U==="h"?A:N)},[]),l=M.useCallback(function(_){var S=_;if(!(!Nv.length||Nv[Nv.length-1]!==s)){var w="deltaY"in S?TP(S):Z3(S),C=e.current.filter(function(D){return D.name===S.type&&(D.target===S.target||S.target===D.shadowParent)&&xne(D.delta,w)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var A=(o.current.shards||[]).map(CP).filter(Boolean).filter(function(D){return D.contains(S.target)}),N=A.length>0?a(S,A[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),c=M.useCallback(function(_,S,w,C){var A={name:_,delta:S,target:w,should:C,shadowParent:_ne(w)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),d=M.useCallback(function(_){n.current=Z3(_),r.current=void 0},[]),p=M.useCallback(function(_){c(_.type,TP(_),_.target,a(_,t.lockRef.current))},[]),m=M.useCallback(function(_){c(_.type,Z3(_),_.target,a(_,t.lockRef.current))},[]);M.useEffect(function(){return Nv.push(s),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Av),document.addEventListener("touchmove",l,Av),document.addEventListener("touchstart",d,Av),function(){Nv=Nv.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,Av),document.removeEventListener("touchmove",l,Av),document.removeEventListener("touchstart",d,Av)}},[]);var x=t.removeScrollBar,b=t.inert;return M.createElement(M.Fragment,null,b?M.createElement(s,{styles:vne(i)}):null,x?M.createElement(cne,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function _ne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Sne=Kte(XU,bne);var nw=M.forwardRef(function(t,e){return M.createElement(J5,qf({},t,{ref:e,sideCar:Sne}))});nw.classNames=J5.classNames;var wne=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Rv=new WeakMap,Q3=new WeakMap,J3={},VE=0,JU=function(t){return t&&(t.host||JU(t.parentNode))},Mne=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=JU(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Tne=function(t,e,n,r){var i=Mne(e,Array.isArray(t)?t:[t]);J3[n]||(J3[n]=new WeakMap);var s=J3[n],o=[],a=new Set,l=new Set(i),c=function(p){!p||a.has(p)||(a.add(p),c(p.parentNode))};i.forEach(c);var d=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(m){if(a.has(m))d(m);else try{var x=m.getAttribute(r),b=x!==null&&x!=="false",_=(Rv.get(m)||0)+1,S=(s.get(m)||0)+1;Rv.set(m,_),s.set(m,S),o.push(m),_===1&&b&&Q3.set(m,!0),S===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return d(e),a.clear(),VE++,function(){o.forEach(function(p){var m=Rv.get(p)-1,x=s.get(p)-1;Rv.set(p,m),s.set(p,x),m||(Q3.has(p)||p.removeAttribute(r),Q3.delete(p)),x||p.removeAttribute(n)}),VE--,VE||(Rv=new WeakMap,Rv=new WeakMap,Q3=new WeakMap,J3={})}},eT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=wne(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Tne(r,i,n,"aria-hidden")):function(){return null}},tT="Dialog",[eB,tB]=du(tT),[Cne,tf]=eB(tT),nB=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=M.useRef(null),l=M.useRef(null),[c,d]=ed({prop:r,defaultProp:i??!1,onChange:s,caller:tT});return f.jsx(Cne,{scope:e,triggerRef:a,contentRef:l,contentId:Ac(),titleId:Ac(),descriptionId:Ac(),open:c,onOpenChange:d,onOpenToggle:M.useCallback(()=>d(p=>!p),[d]),modal:o,children:n})};nB.displayName=tT;var rB="DialogTrigger",iB=M.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=tf(rB,n),s=Ur(e,i.triggerRef);return f.jsx(cr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Gk(i.open),...r,ref:s,onClick:bn(t.onClick,i.onOpenToggle)})});iB.displayName=rB;var Hk="DialogPortal",[Ene,sB]=eB(Hk,{forceMount:void 0}),oB=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=tf(Hk,e);return f.jsx(Ene,{scope:e,forceMount:n,children:M.Children.map(r,o=>f.jsx(Xa,{present:n||s.open,children:f.jsx(Sy,{asChild:!0,container:i,children:o})}))})};oB.displayName=Hk;var r2="DialogOverlay",aB=M.forwardRef((t,e)=>{const n=sB(r2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=tf(r2,t.__scopeDialog);return s.modal?f.jsx(Xa,{present:r||s.open,children:f.jsx(Nne,{...i,ref:e})}):null});aB.displayName=r2;var Ane=K0("DialogOverlay.RemoveScroll"),Nne=M.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=tf(r2,n);return f.jsx(nw,{as:Ane,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(cr.div,{"data-state":Gk(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),sx="DialogContent",lB=M.forwardRef((t,e)=>{const n=sB(sx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=tf(sx,t.__scopeDialog);return f.jsx(Xa,{present:r||s.open,children:s.modal?f.jsx(Rne,{...i,ref:e}):f.jsx(kne,{...i,ref:e})})});lB.displayName=sx;var Rne=M.forwardRef((t,e)=>{const n=tf(sx,t.__scopeDialog),r=M.useRef(null),i=Ur(e,n.contentRef,r);return M.useEffect(()=>{const s=r.current;if(s)return eT(s)},[]),f.jsx(cB,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bn(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:bn(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:bn(t.onFocusOutside,s=>s.preventDefault())})}),kne=M.forwardRef((t,e)=>{const n=tf(sx,t.__scopeDialog),r=M.useRef(!1),i=M.useRef(!1);return f.jsx(cB,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),cB=M.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=tf(sx,n),l=M.useRef(null),c=Ur(e,l);return Q5(),f.jsxs(f.Fragment,{children:[f.jsx(tw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:f.jsx(_y,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Gk(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(Pne,{titleId:a.titleId}),f.jsx(One,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Vk="DialogTitle",uB=M.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=tf(Vk,n);return f.jsx(cr.h2,{id:i.titleId,...r,ref:e})});uB.displayName=Vk;var dB="DialogDescription",fB=M.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=tf(dB,n);return f.jsx(cr.p,{id:i.descriptionId,...r,ref:e})});fB.displayName=dB;var hB="DialogClose",pB=M.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=tf(hB,n);return f.jsx(cr.button,{type:"button",...r,ref:e,onClick:bn(t.onClick,()=>i.onOpenChange(!1))})});pB.displayName=hB;function Gk(t){return t?"open":"closed"}var mB="DialogTitleWarning",[Dne,gB]=lte(mB,{contentName:sx,titleName:Vk,docsSlug:"dialog"}),Pne=({titleId:t})=>{const e=gB(mB),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return M.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Ine="DialogDescriptionWarning",One=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gB(Ine).contentName}}.`;return M.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},xB=nB,vB=iB,yB=oB,bB=aB,_B=lB,SB=uB,wB=fB,Wk=pB,MB="AlertDialog",[Lne]=du(MB,[tB]),Mp=tB(),TB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Mp(e);return f.jsx(xB,{...r,...n,modal:!0})};TB.displayName=MB;var jne="AlertDialogTrigger",zne=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Mp(n);return f.jsx(vB,{...i,...r,ref:e})});zne.displayName=jne;var Fne="AlertDialogPortal",CB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Mp(e);return f.jsx(yB,{...r,...n})};CB.displayName=Fne;var Une="AlertDialogOverlay",EB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Mp(n);return f.jsx(bB,{...i,...r,ref:e})});EB.displayName=Une;var x1="AlertDialogContent",[Bne,Hne]=Lne(x1),Vne=OU("AlertDialogContent"),AB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=Mp(n),o=M.useRef(null),a=Ur(e,o),l=M.useRef(null);return f.jsx(Dne,{contentName:x1,titleName:NB,docsSlug:"alert-dialog",children:f.jsx(Bne,{scope:n,cancelRef:l,children:f.jsxs(_B,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:bn(i.onOpenAutoFocus,c=>{var d;c.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[f.jsx(Vne,{children:r}),f.jsx(Wne,{contentRef:o})]})})})});AB.displayName=x1;var NB="AlertDialogTitle",RB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Mp(n);return f.jsx(SB,{...i,...r,ref:e})});RB.displayName=NB;var kB="AlertDialogDescription",DB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Mp(n);return f.jsx(wB,{...i,...r,ref:e})});DB.displayName=kB;var Gne="AlertDialogAction",PB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Mp(n);return f.jsx(Wk,{...i,...r,ref:e})});PB.displayName=Gne;var IB="AlertDialogCancel",OB=M.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=Hne(IB,n),s=Mp(n),o=Ur(e,i);return f.jsx(Wk,{...s,...r,ref:o})});OB.displayName=IB;var Wne=({contentRef:t})=>{const e=`\`${x1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${x1}\` by passing a \`${kB}\` component as a child, which also benefits sighted users by adding visible context to the dialog.

Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${x1}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.

For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return M.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},$ne=TB,qne=CB,Xne=EB,Yne=AB,Kne=PB,Zne=OB,Qne=RB,Jne=DB,GE={exports:{}},WE={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var EP;function ere(){if(EP)return WE;EP=1;var t=KS();function e(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(p,m){var x=m(),b=r({inst:{value:x,getSnapshot:m}}),_=b[0].inst,S=b[1];return s(function(){_.value=x,_.getSnapshot=m,l(_)&&S({inst:_})},[p,x,m]),i(function(){return l(_)&&S({inst:_}),p(function(){l(_)&&S({inst:_})})},[p]),o(x),x}function l(p){var m=p.getSnapshot;p=p.value;try{var x=m();return!n(p,x)}catch{return!0}}function c(p,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return WE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,WE}var AP;function tre(){return AP||(AP=1,GE.exports=ere()),GE.exports}function nre(t){const e=M.useRef({value:t,previous:t});return M.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function rre(t){const[e,n]=M.useState(void 0);return Ea(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const ire=["top","right","bottom","left"],Z0=Math.min,Yc=Math.max,i2=Math.round,e4=Math.floor,nh=t=>({x:t,y:t}),sre={left:"right",right:"left",bottom:"top",top:"bottom"},ore={start:"end",end:"start"};function FN(t,e,n){return Yc(t,Z0(e,n))}function gp(t,e){return typeof t=="function"?t(e):t}function xp(t){return t.split("-")[0]}function wy(t){return t.split("-")[1]}function $k(t){return t==="x"?"y":"x"}function qk(t){return t==="y"?"height":"width"}const are=new Set(["top","bottom"]);function Kf(t){return are.has(xp(t))?"y":"x"}function Xk(t){return $k(Kf(t))}function lre(t,e,n){n===void 0&&(n=!1);const r=wy(t),i=Xk(t),s=qk(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=s2(o)),[o,s2(o)]}function cre(t){const e=s2(t);return[UN(t),e,UN(e)]}function UN(t){return t.replace(/start|end/g,e=>ore[e])}const NP=["left","right"],RP=["right","left"],ure=["top","bottom"],dre=["bottom","top"];function fre(t,e,n){switch(t){case"top":case"bottom":return n?e?RP:NP:e?NP:RP;case"left":case"right":return e?ure:dre;default:return[]}}function hre(t,e,n,r){const i=wy(t);let s=fre(xp(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(UN)))),s}function s2(t){return t.replace(/left|right|bottom|top/g,e=>sre[e])}function pre(t){return{top:0,right:0,bottom:0,left:0,...t}}function LB(t){return typeof t!="number"?pre(t):{top:t,right:t,bottom:t,left:t}}function o2(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function kP(t,e,n){let{reference:r,floating:i}=t;const s=Kf(e),o=Xk(e),a=qk(o),l=xp(e),c=s==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let x;switch(l){case"top":x={x:d,y:r.y-i.height};break;case"bottom":x={x:d,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-i.width,y:p};break;default:x={x:r.x,y:r.y}}switch(wy(e)){case"start":x[o]-=m*(n&&c?-1:1);break;case"end":x[o]+=m*(n&&c?-1:1);break}return x}async function mre(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:m=!1,padding:x=0}=gp(e,t),b=LB(x),S=a[m?p==="floating"?"reference":"floating":p],w=o2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),C=p==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),N=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},D=o2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:A,strategy:l}):C);return{top:(w.top-D.top+b.top)/N.y,bottom:(D.bottom-w.bottom+b.bottom)/N.y,left:(w.left-D.left+b.left)/N.x,right:(D.right-w.right+b.right)/N.x}}const gre=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:p}=kP(c,r,l),m=r,x={},b=0;for(let S=0;S<a.length;S++){var _;const{name:w,fn:C}=a[S],{x:A,y:N,data:D,reset:P}=await C({x:d,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:x,rects:c,platform:{...o,detectOverflow:(_=o.detectOverflow)!=null?_:mre},elements:{reference:t,floating:e}});d=A??d,p=N??p,x={...x,[w]:{...x[w],...D}},P&&b<=50&&(b++,typeof P=="object"&&(P.placement&&(m=P.placement),P.rects&&(c=P.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):P.rects),{x:d,y:p}=kP(c,m,l)),S=-1)}return{x:d,y:p,placement:m,strategy:i,middlewareData:x}},xre=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=gp(t,e)||{};if(c==null)return{};const p=LB(d),m={x:n,y:r},x=Xk(i),b=qk(x),_=await o.getDimensions(c),S=x==="y",w=S?"top":"left",C=S?"bottom":"right",A=S?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[x]-m[x]-s.floating[b],D=m[x]-s.reference[x],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=P?P[A]:0;(!O||!await(o.isElement==null?void 0:o.isElement(P)))&&(O=a.floating[A]||s.floating[b]);const R=N/2-D/2,L=O/2-_[b]/2-1,V=Z0(p[w],L),F=Z0(p[C],L),U=V,W=O-_[b]-F,Y=O/2-_[b]/2+R,$=FN(U,Y,W),X=!l.arrow&&wy(i)!=null&&Y!==$&&s.reference[b]/2-(Y<U?V:F)-_[b]/2<0,Z=X?Y<U?Y-U:Y-W:0;return{[x]:m[x]+Z,data:{[x]:$,centerOffset:Y-$-Z,...X&&{alignmentOffset:Z}},reset:X}}}),vre=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...S}=gp(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=xp(i),C=Kf(a),A=xp(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=m||(A||!_?[s2(a)]:cre(a)),P=b!=="none";!m&&P&&D.push(...hre(a,_,b,N));const O=[a,...D],R=await l.detectOverflow(e,S),L=[];let V=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&L.push(R[w]),p){const Y=lre(i,o,N);L.push(R[Y[0]],R[Y[1]])}if(V=[...V,{placement:i,overflows:L}],!L.every(Y=>Y<=0)){var F,U;const Y=(((F=s.flip)==null?void 0:F.index)||0)+1,$=O[Y];if($&&(!(p==="alignment"?C!==Kf($):!1)||V.every(K=>Kf(K.placement)===C?K.overflows[0]>0:!0)))return{data:{index:Y,overflows:V},reset:{placement:$}};let X=(U=V.filter(Z=>Z.overflows[0]<=0).sort((Z,K)=>Z.overflows[1]-K.overflows[1])[0])==null?void 0:U.placement;if(!X)switch(x){case"bestFit":{var W;const Z=(W=V.filter(K=>{if(P){const ne=Kf(K.placement);return ne===C||ne==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(ne=>ne>0).reduce((ne,H)=>ne+H,0)]).sort((K,ne)=>K[1]-ne[1])[0])==null?void 0:W[0];Z&&(X=Z);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};function DP(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function PP(t){return ire.some(e=>t[e]>=0)}const yre=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=gp(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=DP(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:PP(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=DP(o,n.floating);return{data:{escapedOffsets:a,escaped:PP(a)}}}default:return{}}}}},jB=new Set(["left","top"]);async function bre(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xp(n),a=wy(n),l=Kf(n)==="y",c=jB.has(o)?-1:1,d=s&&l?-1:1,p=gp(e,t);let{mainAxis:m,crossAxis:x,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof b=="number"&&(x=a==="end"?b*-1:b),l?{x:x*d,y:m*c}:{x:m*c,y:x*d}}const _re=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await bre(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Sre=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:C,y:A}=w;return{x:C,y:A}}},...c}=gp(t,e),d={x:n,y:r},p=await s.detectOverflow(e,c),m=Kf(xp(i)),x=$k(m);let b=d[x],_=d[m];if(o){const w=x==="y"?"top":"left",C=x==="y"?"bottom":"right",A=b+p[w],N=b-p[C];b=FN(A,b,N)}if(a){const w=m==="y"?"top":"left",C=m==="y"?"bottom":"right",A=_+p[w],N=_-p[C];_=FN(A,_,N)}const S=l.fn({...e,[x]:b,[m]:_});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[x]:o,[m]:a}}}}}},wre=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=gp(t,e),d={x:n,y:r},p=Kf(i),m=$k(p);let x=d[m],b=d[p];const _=gp(a,e),S=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const A=m==="y"?"height":"width",N=s.reference[m]-s.floating[A]+S.mainAxis,D=s.reference[m]+s.reference[A]-S.mainAxis;x<N?x=N:x>D&&(x=D)}if(c){var w,C;const A=m==="y"?"width":"height",N=jB.has(xp(i)),D=s.reference[p]-s.floating[A]+(N&&((w=o.offset)==null?void 0:w[p])||0)+(N?0:S.crossAxis),P=s.reference[p]+s.reference[A]+(N?0:((C=o.offset)==null?void 0:C[p])||0)-(N?S.crossAxis:0);b<D?b=D:b>P&&(b=P)}return{[m]:x,[p]:b}}}},Mre=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=gp(t,e),d=await o.detectOverflow(e,c),p=xp(i),m=wy(i),x=Kf(i)==="y",{width:b,height:_}=s.floating;let S,w;p==="top"||p==="bottom"?(S=p,w=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(w=p,S=m==="end"?"top":"bottom");const C=_-d.top-d.bottom,A=b-d.left-d.right,N=Z0(_-d[S],C),D=Z0(b-d[w],A),P=!e.middlewareData.shift;let O=N,R=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=C),P&&!m){const V=Yc(d.left,0),F=Yc(d.right,0),U=Yc(d.top,0),W=Yc(d.bottom,0);x?R=b-2*(V!==0||F!==0?V+F:Yc(d.left,d.right)):O=_-2*(U!==0||W!==0?U+W:Yc(d.top,d.bottom))}await l({...e,availableWidth:R,availableHeight:O});const L=await o.getDimensions(a.floating);return b!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function nT(){return typeof window<"u"}function My(t){return zB(t)?(t.nodeName||"").toLowerCase():"#document"}function ru(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ph(t){var e;return(e=(zB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function zB(t){return nT()?t instanceof Node||t instanceof ru(t).Node:!1}function Qd(t){return nT()?t instanceof Element||t instanceof ru(t).Element:!1}function oh(t){return nT()?t instanceof HTMLElement||t instanceof ru(t).HTMLElement:!1}function IP(t){return!nT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ru(t).ShadowRoot}const Tre=new Set(["inline","contents"]);function rw(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Jd(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Tre.has(i)}const Cre=new Set(["table","td","th"]);function Ere(t){return Cre.has(My(t))}const Are=[":popover-open",":modal"];function rT(t){return Are.some(e=>{try{return t.matches(e)}catch{return!1}})}const Nre=["transform","translate","scale","rotate","perspective"],Rre=["transform","translate","scale","rotate","perspective","filter"],kre=["paint","layout","strict","content"];function Yk(t){const e=Kk(),n=Qd(t)?Jd(t):t;return Nre.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Rre.some(r=>(n.willChange||"").includes(r))||kre.some(r=>(n.contain||"").includes(r))}function Dre(t){let e=Q0(t);for(;oh(e)&&!$1(e);){if(Yk(e))return e;if(rT(e))return null;e=Q0(e)}return null}function Kk(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pre=new Set(["html","body","#document"]);function $1(t){return Pre.has(My(t))}function Jd(t){return ru(t).getComputedStyle(t)}function iT(t){return Qd(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Q0(t){if(My(t)==="html")return t;const e=t.assignedSlot||t.parentNode||IP(t)&&t.host||ph(t);return IP(e)?e.host:e}function FB(t){const e=Q0(t);return $1(e)?t.ownerDocument?t.ownerDocument.body:t.body:oh(e)&&rw(e)?e:FB(e)}function rS(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=FB(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=ru(i);if(s){const a=BN(o);return e.concat(o,o.visualViewport||[],rw(i)?i:[],a&&n?rS(a):[])}return e.concat(i,rS(i,[],n))}function BN(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function UB(t){const e=Jd(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=oh(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=i2(n)!==s||i2(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function Zk(t){return Qd(t)?t:t.contextElement}function v1(t){const e=Zk(t);if(!oh(e))return nh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=UB(e);let o=(s?i2(n.width):n.width)/r,a=(s?i2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ire=nh(0);function BB(t){const e=ru(t);return!Kk()||!e.visualViewport?Ire:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ore(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ru(t)?!1:e}function ox(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=Zk(t);let o=nh(1);e&&(r?Qd(r)&&(o=v1(r)):o=v1(t));const a=Ore(s,n,r)?BB(s):nh(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,d=i.width/o.x,p=i.height/o.y;if(s){const m=ru(s),x=r&&Qd(r)?ru(r):r;let b=m,_=BN(b);for(;_&&r&&x!==b;){const S=v1(_),w=_.getBoundingClientRect(),C=Jd(_),A=w.left+(_.clientLeft+parseFloat(C.paddingLeft))*S.x,N=w.top+(_.clientTop+parseFloat(C.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,p*=S.y,l+=A,c+=N,b=ru(_),_=BN(b)}}return o2({width:d,height:p,x:l,y:c})}function sT(t,e){const n=iT(t).scrollLeft;return e?e.left+n:ox(ph(t)).left+n}function HB(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-sT(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Lre(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=ph(r),a=e?rT(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=nh(1);const d=nh(0),p=oh(r);if((p||!p&&!s)&&((My(r)!=="body"||rw(o))&&(l=iT(r)),oh(r))){const x=ox(r);c=v1(r),d.x=x.x+r.clientLeft,d.y=x.y+r.clientTop}const m=o&&!p&&!s?HB(o,l):nh(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-l.scrollTop*c.y+d.y+m.y}}function jre(t){return Array.from(t.getClientRects())}function zre(t){const e=ph(t),n=iT(t),r=t.ownerDocument.body,i=Yc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Yc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+sT(t);const a=-n.scrollTop;return Jd(r).direction==="rtl"&&(o+=Yc(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const OP=25;function Fre(t,e){const n=ru(t),r=ph(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const d=Kk();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=sT(r);if(c<=0){const d=r.ownerDocument,p=d.body,m=getComputedStyle(p),x=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-x);b<=OP&&(s-=b)}else c<=OP&&(s+=c);return{width:s,height:o,x:a,y:l}}const Ure=new Set(["absolute","fixed"]);function Bre(t,e){const n=ox(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=oh(t)?v1(t):nh(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function LP(t,e,n){let r;if(e==="viewport")r=Fre(t,n);else if(e==="document")r=zre(ph(t));else if(Qd(e))r=Bre(e,n);else{const i=BB(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return o2(r)}function VB(t,e){const n=Q0(t);return n===e||!Qd(n)||$1(n)?!1:Jd(n).position==="fixed"||VB(n,e)}function Hre(t,e){const n=e.get(t);if(n)return n;let r=rS(t,[],!1).filter(a=>Qd(a)&&My(a)!=="body"),i=null;const s=Jd(t).position==="fixed";let o=s?Q0(t):t;for(;Qd(o)&&!$1(o);){const a=Jd(o),l=Yk(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Ure.has(i.position)||rw(o)&&!l&&VB(t,o))?r=r.filter(d=>d!==o):i=a,o=Q0(o)}return e.set(t,r),r}function Vre(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?rT(e)?[]:Hre(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,d)=>{const p=LP(e,d,i);return c.top=Yc(p.top,c.top),c.right=Z0(p.right,c.right),c.bottom=Z0(p.bottom,c.bottom),c.left=Yc(p.left,c.left),c},LP(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Gre(t){const{width:e,height:n}=UB(t);return{width:e,height:n}}function Wre(t,e,n){const r=oh(e),i=ph(e),s=n==="fixed",o=ox(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=nh(0);function c(){l.x=sT(i)}if(r||!r&&!s)if((My(e)!=="body"||rw(i))&&(a=iT(e)),r){const x=ox(e,!0,s,e);l.x=x.x+e.clientLeft,l.y=x.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?HB(i,a):nh(0),p=o.left+a.scrollLeft-l.x-d.x,m=o.top+a.scrollTop-l.y-d.y;return{x:p,y:m,width:o.width,height:o.height}}function $E(t){return Jd(t).position==="static"}function jP(t,e){if(!oh(t)||Jd(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ph(t)===n&&(n=n.ownerDocument.body),n}function GB(t,e){const n=ru(t);if(rT(t))return n;if(!oh(t)){let i=Q0(t);for(;i&&!$1(i);){if(Qd(i)&&!$E(i))return i;i=Q0(i)}return n}let r=jP(t,e);for(;r&&Ere(r)&&$E(r);)r=jP(r,e);return r&&$1(r)&&$E(r)&&!Yk(r)?n:r||Dre(t)||n}const $re=async function(t){const e=this.getOffsetParent||GB,n=this.getDimensions,r=await n(t.floating);return{reference:Wre(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qre(t){return Jd(t).direction==="rtl"}const Xre={convertOffsetParentRelativeRectToViewportRelativeRect:Lre,getDocumentElement:ph,getClippingRect:Vre,getOffsetParent:GB,getElementRects:$re,getClientRects:jre,getDimensions:Gre,getScale:v1,isElement:Qd,isRTL:qre};function WB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Yre(t,e){let n=null,r;const i=ph(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:d,top:p,width:m,height:x}=c;if(a||e(),!m||!x)return;const b=e4(p),_=e4(i.clientWidth-(d+m)),S=e4(i.clientHeight-(p+x)),w=e4(d),A={rootMargin:-b+"px "+-_+"px "+-S+"px "+-w+"px",threshold:Yc(0,Z0(1,l))||1};let N=!0;function D(P){const O=P[0].intersectionRatio;if(O!==l){if(!N)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!WB(c,t.getBoundingClientRect())&&o(),N=!1}try{n=new IntersectionObserver(D,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,A)}n.observe(t)}return o(!0),s}function Kre(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Zk(t),d=i||s?[...c?rS(c):[],...rS(e)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=c&&a?Yre(c,n):null;let m=-1,x=null;o&&(x=new ResizeObserver(w=>{let[C]=w;C&&C.target===c&&x&&(x.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var A;(A=x)==null||A.observe(e)})),n()}),c&&!l&&x.observe(c),x.observe(e));let b,_=l?ox(t):null;l&&S();function S(){const w=ox(t);_&&!WB(_,w)&&n(),_=w,b=requestAnimationFrame(S)}return n(),()=>{var w;d.forEach(C=>{i&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),p==null||p(),(w=x)==null||w.disconnect(),x=null,l&&cancelAnimationFrame(b)}}const Zre=_re,Qre=Sre,Jre=vre,eie=Mre,tie=yre,zP=xre,nie=wre,rie=(t,e,n)=>{const r=new Map,i={platform:Xre,...n},s={...i.platform,_c:r};return gre(t,e,{...i,platform:s})};var iie=typeof document<"u",sie=function(){},zM=iie?M.useLayoutEffect:sie;function a2(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!a2(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!a2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function $B(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function FP(t,e){const n=$B(t);return Math.round(e*n)/n}function qE(t){const e=M.useRef(t);return zM(()=>{e.current=t}),e}function oie(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[d,p]=M.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,x]=M.useState(r);a2(m,r)||x(r);const[b,_]=M.useState(null),[S,w]=M.useState(null),C=M.useCallback(K=>{K!==P.current&&(P.current=K,_(K))},[]),A=M.useCallback(K=>{K!==O.current&&(O.current=K,w(K))},[]),N=s||b,D=o||S,P=M.useRef(null),O=M.useRef(null),R=M.useRef(d),L=l!=null,V=qE(l),F=qE(i),U=qE(c),W=M.useCallback(()=>{if(!P.current||!O.current)return;const K={placement:e,strategy:n,middleware:m};F.current&&(K.platform=F.current),rie(P.current,O.current,K).then(ne=>{const H={...ne,isPositioned:U.current!==!1};Y.current&&!a2(R.current,H)&&(R.current=H,Wd.flushSync(()=>{p(H)}))})},[m,e,n,F,U]);zM(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[c]);const Y=M.useRef(!1);zM(()=>(Y.current=!0,()=>{Y.current=!1}),[]),zM(()=>{if(N&&(P.current=N),D&&(O.current=D),N&&D){if(V.current)return V.current(N,D,W);W()}},[N,D,W,V,L]);const $=M.useMemo(()=>({reference:P,floating:O,setReference:C,setFloating:A}),[C,A]),X=M.useMemo(()=>({reference:N,floating:D}),[N,D]),Z=M.useMemo(()=>{const K={position:n,left:0,top:0};if(!X.floating)return K;const ne=FP(X.floating,d.x),H=FP(X.floating,d.y);return a?{...K,transform:"translate("+ne+"px, "+H+"px)",...$B(X.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:H}},[n,a,X.floating,d.x,d.y]);return M.useMemo(()=>({...d,update:W,refs:$,elements:X,floatingStyles:Z}),[d,W,$,X,Z])}const aie=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?zP({element:r.current,padding:i}).fn(n):{}:r?zP({element:r,padding:i}).fn(n):{}}}},lie=(t,e)=>({...Zre(t),options:[t,e]}),cie=(t,e)=>({...Qre(t),options:[t,e]}),uie=(t,e)=>({...nie(t),options:[t,e]}),die=(t,e)=>({...Jre(t),options:[t,e]}),fie=(t,e)=>({...eie(t),options:[t,e]}),hie=(t,e)=>({...tie(t),options:[t,e]}),pie=(t,e)=>({...aie(t),options:[t,e]});var mie="Arrow",qB=M.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return f.jsx(cr.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});qB.displayName=mie;var gie=qB,Qk="Popper",[XB,dm]=du(Qk),[xie,YB]=XB(Qk),KB=t=>{const{__scopePopper:e,children:n}=t,[r,i]=M.useState(null);return f.jsx(xie,{scope:e,anchor:r,onAnchorChange:i,children:n})};KB.displayName=Qk;var ZB="PopperAnchor",QB=M.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=YB(ZB,n),o=M.useRef(null),a=Ur(e,o),l=M.useRef(null);return M.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:f.jsx(cr.div,{...i,ref:a})});QB.displayName=ZB;var Jk="PopperContent",[vie,yie]=XB(Jk),JB=M.forwardRef((t,e)=>{var se,le,re,pe,be,xe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,..._}=t,S=YB(Jk,n),[w,C]=M.useState(null),A=Ur(e,Pe=>C(Pe)),[N,D]=M.useState(null),P=rre(N),O=(P==null?void 0:P.width)??0,R=(P==null?void 0:P.height)??0,L=r+(s!=="center"?"-"+s:""),V=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},F=Array.isArray(c)?c:[c],U=F.length>0,W={padding:V,boundary:F.filter(_ie),altBoundary:U},{refs:Y,floatingStyles:$,placement:X,isPositioned:Z,middlewareData:K}=oie({strategy:"fixed",placement:L,whileElementsMounted:(...Pe)=>Kre(...Pe,{animationFrame:x==="always"}),elements:{reference:S.anchor},middleware:[lie({mainAxis:i+R,alignmentAxis:o}),l&&cie({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?uie():void 0,...W}),l&&die({...W}),fie({...W,apply:({elements:Pe,rects:me,availableWidth:ke,availableHeight:we})=>{const{width:Te,height:oe}=me.reference,_e=Pe.floating.style;_e.setProperty("--radix-popper-available-width",`${ke}px`),_e.setProperty("--radix-popper-available-height",`${we}px`),_e.setProperty("--radix-popper-anchor-width",`${Te}px`),_e.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),N&&pie({element:N,padding:a}),Sie({arrowWidth:O,arrowHeight:R}),m&&hie({strategy:"referenceHidden",...W})]}),[ne,H]=nH(X),B=Ca(b);Ea(()=>{Z&&(B==null||B())},[Z,B]);const G=(se=K.arrow)==null?void 0:se.x,j=(le=K.arrow)==null?void 0:le.y,ie=((re=K.arrow)==null?void 0:re.centerOffset)!==0,[ce,te]=M.useState();return Ea(()=>{w&&te(window.getComputedStyle(w).zIndex)},[w]),f.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:Z?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(pe=K.transformOrigin)==null?void 0:pe.x,(be=K.transformOrigin)==null?void 0:be.y].join(" "),...((xe=K.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:f.jsx(vie,{scope:n,placedSide:ne,onArrowChange:D,arrowX:G,arrowY:j,shouldHideArrow:ie,children:f.jsx(cr.div,{"data-side":ne,"data-align":H,..._,ref:A,style:{..._.style,animation:Z?void 0:"none"}})})})});JB.displayName=Jk;var eH="PopperArrow",bie={top:"bottom",right:"left",bottom:"top",left:"right"},tH=M.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=yie(eH,r),o=bie[s.placedSide];return f.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:f.jsx(gie,{...i,ref:n,style:{...i.style,display:"block"}})})});tH.displayName=eH;function _ie(t){return t!==null}var Sie=t=>({name:"transformOrigin",options:t,fn(e){var S,w,C;const{placement:n,rects:r,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,d]=nH(n),p={start:"0%",center:"50%",end:"100%"}[d],m=(((w=i.arrow)==null?void 0:w.x)??0)+a/2,x=(((C=i.arrow)==null?void 0:C.y)??0)+l/2;let b="",_="";return c==="bottom"?(b=o?p:`${m}px`,_=`${-l}px`):c==="top"?(b=o?p:`${m}px`,_=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,_=o?p:`${x}px`):c==="left"&&(b=`${r.floating.width+l}px`,_=o?p:`${x}px`),{data:{x:b,y:_}}}});function nH(t){const[e,n="center"]=t.split("-");return[e,n]}var iw=KB,sw=QB,oT=JB,aT=tH,XE="rovingFocusGroup.onEntryFocus",wie={bubbles:!1,cancelable:!0},ow="RovingFocusGroup",[HN,rH,Mie]=zk(ow),[Tie,lT]=du(ow,[Mie]),[Cie,Eie]=Tie(ow),iH=M.forwardRef((t,e)=>f.jsx(HN.Provider,{scope:t.__scopeRovingFocusGroup,children:f.jsx(HN.Slot,{scope:t.__scopeRovingFocusGroup,children:f.jsx(Aie,{...t,ref:e})})}));iH.displayName=ow;var Aie=M.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...p}=t,m=M.useRef(null),x=Ur(e,m),b=ew(s),[_,S]=ed({prop:o,defaultProp:a??null,onChange:l,caller:ow}),[w,C]=M.useState(!1),A=Ca(c),N=rH(n),D=M.useRef(!1),[P,O]=M.useState(0);return M.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(XE,A),()=>R.removeEventListener(XE,A)},[A]),f.jsx(Cie,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:M.useCallback(R=>S(R),[S]),onItemShiftTab:M.useCallback(()=>C(!0),[]),onFocusableItemAdd:M.useCallback(()=>O(R=>R+1),[]),onFocusableItemRemove:M.useCallback(()=>O(R=>R-1),[]),children:f.jsx(cr.div,{tabIndex:w||P===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...t.style},onMouseDown:bn(t.onMouseDown,()=>{D.current=!0}),onFocus:bn(t.onFocus,R=>{const L=!D.current;if(R.target===R.currentTarget&&L&&!w){const V=new CustomEvent(XE,wie);if(R.currentTarget.dispatchEvent(V),!V.defaultPrevented){const F=N().filter(X=>X.focusable),U=F.find(X=>X.active),W=F.find(X=>X.id===_),$=[U,W,...F].filter(Boolean).map(X=>X.ref.current);aH($,d)}}D.current=!1}),onBlur:bn(t.onBlur,()=>C(!1))})})}),sH="RovingFocusGroupItem",oH=M.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=Ac(),c=s||l,d=Eie(sH,n),p=d.currentTabStopId===c,m=rH(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:_}=d;return M.useEffect(()=>{if(r)return x(),()=>b()},[r,x,b]),f.jsx(HN.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:f.jsx(cr.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...a,ref:e,onMouseDown:bn(t.onMouseDown,S=>{r?d.onItemFocus(c):S.preventDefault()}),onFocus:bn(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:bn(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){d.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const w=kie(S,d.orientation,d.dir);if(w!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=m().filter(N=>N.focusable).map(N=>N.ref.current);if(w==="last")A.reverse();else if(w==="prev"||w==="next"){w==="prev"&&A.reverse();const N=A.indexOf(S.currentTarget);A=d.loop?Die(A,N+1):A.slice(N+1)}setTimeout(()=>aH(A))}}),children:typeof o=="function"?o({isCurrentTabStop:p,hasTabStop:_!=null}):o})})});oH.displayName=sH;var Nie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Rie(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function kie(t,e,n){const r=Rie(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Nie[r]}function aH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Die(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lH=iH,cH=oH,VN=["Enter"," "],Pie=["ArrowDown","PageUp","Home"],uH=["ArrowUp","PageDown","End"],Iie=[...Pie,...uH],Oie={ltr:[...VN,"ArrowRight"],rtl:[...VN,"ArrowLeft"]},Lie={ltr:["ArrowLeft"],rtl:["ArrowRight"]},aw="Menu",[iS,jie,zie]=zk(aw),[_x,dH]=du(aw,[zie,dm,lT]),lw=dm(),fH=lT(),[hH,fm]=_x(aw),[Fie,cw]=_x(aw),pH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=lw(e),[l,c]=M.useState(null),d=M.useRef(!1),p=Ca(s),m=ew(i);return M.useEffect(()=>{const x=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),f.jsx(iw,{...a,children:f.jsx(hH,{scope:e,open:n,onOpenChange:p,content:l,onContentChange:c,children:f.jsx(Fie,{scope:e,onClose:M.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};pH.displayName=aw;var Uie="MenuAnchor",e7=M.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=lw(n);return f.jsx(sw,{...i,...r,ref:e})});e7.displayName=Uie;var t7="MenuPortal",[Bie,mH]=_x(t7,{forceMount:void 0}),gH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=fm(t7,e);return f.jsx(Bie,{scope:e,forceMount:n,children:f.jsx(Xa,{present:n||s.open,children:f.jsx(Sy,{asChild:!0,container:i,children:r})})})};gH.displayName=t7;var Qu="MenuContent",[Hie,n7]=_x(Qu),xH=M.forwardRef((t,e)=>{const n=mH(Qu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=fm(Qu,t.__scopeMenu),o=cw(Qu,t.__scopeMenu);return f.jsx(iS.Provider,{scope:t.__scopeMenu,children:f.jsx(Xa,{present:r||s.open,children:f.jsx(iS.Slot,{scope:t.__scopeMenu,children:o.modal?f.jsx(Vie,{...i,ref:e}):f.jsx(Gie,{...i,ref:e})})})})}),Vie=M.forwardRef((t,e)=>{const n=fm(Qu,t.__scopeMenu),r=M.useRef(null),i=Ur(e,r);return M.useEffect(()=>{const s=r.current;if(s)return eT(s)},[]),f.jsx(r7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:bn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Gie=M.forwardRef((t,e)=>{const n=fm(Qu,t.__scopeMenu);return f.jsx(r7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Wie=K0("MenuContent.ScrollLock"),r7=M.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,..._}=t,S=fm(Qu,n),w=cw(Qu,n),C=lw(n),A=fH(n),N=jie(n),[D,P]=M.useState(null),O=M.useRef(null),R=Ur(e,O,S.onContentChange),L=M.useRef(0),V=M.useRef(""),F=M.useRef(0),U=M.useRef(null),W=M.useRef("right"),Y=M.useRef(0),$=b?nw:M.Fragment,X=b?{as:Wie,allowPinchZoom:!0}:void 0,Z=ne=>{var se,le;const H=V.current+ne,B=N().filter(re=>!re.disabled),G=document.activeElement,j=(se=B.find(re=>re.ref.current===G))==null?void 0:se.textValue,ie=B.map(re=>re.textValue),ce=rse(ie,H,j),te=(le=B.find(re=>re.textValue===ce))==null?void 0:le.ref.current;(function re(pe){V.current=pe,window.clearTimeout(L.current),pe!==""&&(L.current=window.setTimeout(()=>re(""),1e3))})(H),te&&setTimeout(()=>te.focus())};M.useEffect(()=>()=>window.clearTimeout(L.current),[]),Q5();const K=M.useCallback(ne=>{var B,G;return W.current===((B=U.current)==null?void 0:B.side)&&sse(ne,(G=U.current)==null?void 0:G.area)},[]);return f.jsx(Hie,{scope:n,searchRef:V,onItemEnter:M.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),onItemLeave:M.useCallback(ne=>{var H;K(ne)||((H=O.current)==null||H.focus(),P(null))},[K]),onTriggerLeave:M.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),pointerGraceTimerRef:F,onPointerGraceIntentChange:M.useCallback(ne=>{U.current=ne},[]),children:f.jsx($,{...X,children:f.jsx(tw,{asChild:!0,trapped:i,onMountAutoFocus:bn(s,ne=>{var H;ne.preventDefault(),(H=O.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:f.jsx(_y,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:x,children:f.jsx(lH,{asChild:!0,...A,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:P,onEntryFocus:bn(l,ne=>{w.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(oT,{role:"menu","aria-orientation":"vertical","data-state":IH(S.open),"data-radix-menu-content":"",dir:w.dir,...C,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:bn(_.onKeyDown,ne=>{const B=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,G=ne.ctrlKey||ne.altKey||ne.metaKey,j=ne.key.length===1;B&&(ne.key==="Tab"&&ne.preventDefault(),!G&&j&&Z(ne.key));const ie=O.current;if(ne.target!==ie||!Iie.includes(ne.key))return;ne.preventDefault();const te=N().filter(se=>!se.disabled).map(se=>se.ref.current);uH.includes(ne.key)&&te.reverse(),tse(te)}),onBlur:bn(t.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(L.current),V.current="")}),onPointerMove:bn(t.onPointerMove,sS(ne=>{const H=ne.target,B=Y.current!==ne.clientX;if(ne.currentTarget.contains(H)&&B){const G=ne.clientX>Y.current?"right":"left";W.current=G,Y.current=ne.clientX}}))})})})})})})});xH.displayName=Qu;var $ie="MenuGroup",i7=M.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(cr.div,{role:"group",...r,ref:e})});i7.displayName=$ie;var qie="MenuLabel",vH=M.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(cr.div,{...r,ref:e})});vH.displayName=qie;var l2="MenuItem",UP="menu.itemSelect",cT=M.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=M.useRef(null),o=cw(l2,t.__scopeMenu),a=n7(l2,t.__scopeMenu),l=Ur(e,s),c=M.useRef(!1),d=()=>{const p=s.current;if(!n&&p){const m=new CustomEvent(UP,{bubbles:!0,cancelable:!0});p.addEventListener(UP,x=>r==null?void 0:r(x),{once:!0}),LU(p,m),m.defaultPrevented?c.current=!1:o.onClose()}};return f.jsx(yH,{...i,ref:l,disabled:n,onClick:bn(t.onClick,d),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),c.current=!0},onPointerUp:bn(t.onPointerUp,p=>{var m;c.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:bn(t.onKeyDown,p=>{const m=a.searchRef.current!=="";n||m&&p.key===" "||VN.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});cT.displayName=l2;var yH=M.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=n7(l2,n),a=fH(n),l=M.useRef(null),c=Ur(e,l),[d,p]=M.useState(!1),[m,x]=M.useState("");return M.useEffect(()=>{const b=l.current;b&&x((b.textContent??"").trim())},[s.children]),f.jsx(iS.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:f.jsx(cH,{asChild:!0,...a,focusable:!r,children:f.jsx(cr.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:bn(t.onPointerMove,sS(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:bn(t.onPointerLeave,sS(b=>o.onItemLeave(b))),onFocus:bn(t.onFocus,()=>p(!0)),onBlur:bn(t.onBlur,()=>p(!1))})})})}),Xie="MenuCheckboxItem",bH=M.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return f.jsx(TH,{scope:t.__scopeMenu,checked:n,children:f.jsx(cT,{role:"menuitemcheckbox","aria-checked":c2(n)?"mixed":n,...i,ref:e,"data-state":a7(n),onSelect:bn(i.onSelect,()=>r==null?void 0:r(c2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});bH.displayName=Xie;var _H="MenuRadioGroup",[Yie,Kie]=_x(_H,{value:void 0,onValueChange:()=>{}}),SH=M.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Ca(r);return f.jsx(Yie,{scope:t.__scopeMenu,value:n,onValueChange:s,children:f.jsx(i7,{...i,ref:e})})});SH.displayName=_H;var wH="MenuRadioItem",MH=M.forwardRef((t,e)=>{const{value:n,...r}=t,i=Kie(wH,t.__scopeMenu),s=n===i.value;return f.jsx(TH,{scope:t.__scopeMenu,checked:s,children:f.jsx(cT,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":a7(s),onSelect:bn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});MH.displayName=wH;var s7="MenuItemIndicator",[TH,Zie]=_x(s7,{checked:!1}),CH=M.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Zie(s7,n);return f.jsx(Xa,{present:r||c2(s.checked)||s.checked===!0,children:f.jsx(cr.span,{...i,ref:e,"data-state":a7(s.checked)})})});CH.displayName=s7;var Qie="MenuSeparator",EH=M.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(cr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});EH.displayName=Qie;var Jie="MenuArrow",AH=M.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=lw(n);return f.jsx(aT,{...i,...r,ref:e})});AH.displayName=Jie;var o7="MenuSub",[ese,NH]=_x(o7),RH=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:i}=t,s=fm(o7,e),o=lw(e),[a,l]=M.useState(null),[c,d]=M.useState(null),p=Ca(i);return M.useEffect(()=>(s.open===!1&&p(!1),()=>p(!1)),[s.open,p]),f.jsx(iw,{...o,children:f.jsx(hH,{scope:e,open:r,onOpenChange:p,content:c,onContentChange:d,children:f.jsx(ese,{scope:e,contentId:Ac(),triggerId:Ac(),trigger:a,onTriggerChange:l,children:n})})})};RH.displayName=o7;var y_="MenuSubTrigger",kH=M.forwardRef((t,e)=>{const n=fm(y_,t.__scopeMenu),r=cw(y_,t.__scopeMenu),i=NH(y_,t.__scopeMenu),s=n7(y_,t.__scopeMenu),o=M.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},d=M.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return M.useEffect(()=>d,[d]),M.useEffect(()=>{const p=a.current;return()=>{window.clearTimeout(p),l(null)}},[a,l]),f.jsx(e7,{asChild:!0,...c,children:f.jsx(yH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":IH(n.open),...t,ref:K5(e,i.onTriggerChange),onClick:p=>{var m;(m=t.onClick)==null||m.call(t,p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:bn(t.onPointerMove,sS(p=>{s.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:bn(t.onPointerLeave,sS(p=>{var x,b;d();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const _=(b=n.content)==null?void 0:b.dataset.side,S=_==="right",w=S?-5:5,C=m[S?"left":"right"],A=m[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+w,y:p.clientY},{x:C,y:m.top},{x:A,y:m.top},{x:A,y:m.bottom},{x:C,y:m.bottom}],side:_}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(p),p.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:bn(t.onKeyDown,p=>{var x;const m=s.searchRef.current!=="";t.disabled||m&&p.key===" "||Oie[r.dir].includes(p.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),p.preventDefault())})})})});kH.displayName=y_;var DH="MenuSubContent",PH=M.forwardRef((t,e)=>{const n=mH(Qu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=fm(Qu,t.__scopeMenu),o=cw(Qu,t.__scopeMenu),a=NH(DH,t.__scopeMenu),l=M.useRef(null),c=Ur(e,l);return f.jsx(iS.Provider,{scope:t.__scopeMenu,children:f.jsx(Xa,{present:r||s.open,children:f.jsx(iS.Slot,{scope:t.__scopeMenu,children:f.jsx(r7,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var p;o.isUsingKeyboardRef.current&&((p=l.current)==null||p.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:bn(t.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:bn(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:bn(t.onKeyDown,d=>{var x;const p=d.currentTarget.contains(d.target),m=Lie[o.dir].includes(d.key);p&&m&&(s.onOpenChange(!1),(x=a.trigger)==null||x.focus(),d.preventDefault())})})})})})});PH.displayName=DH;function IH(t){return t?"open":"closed"}function c2(t){return t==="indeterminate"}function a7(t){return c2(t)?"indeterminate":t?"checked":"unchecked"}function tse(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function nse(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function rse(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=nse(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function ise(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,d=a.y,p=l.x,m=l.y;d>r!=m>r&&n<(p-c)*(r-d)/(m-d)+c&&(i=!i)}return i}function sse(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return ise(n,e)}function sS(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ose=pH,ase=e7,lse=gH,cse=xH,use=i7,dse=vH,fse=cT,hse=bH,pse=SH,mse=MH,gse=CH,xse=EH,vse=AH,yse=RH,bse=kH,_se=PH,uT="DropdownMenu",[Sse]=du(uT,[dH]),vl=dH(),[wse,OH]=Sse(uT),LH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=vl(e),c=M.useRef(null),[d,p]=ed({prop:i,defaultProp:s??!1,onChange:o,caller:uT});return f.jsx(wse,{scope:e,triggerId:Ac(),triggerRef:c,contentId:Ac(),open:d,onOpenChange:p,onOpenToggle:M.useCallback(()=>p(m=>!m),[p]),modal:a,children:f.jsx(ose,{...l,open:d,onOpenChange:p,dir:r,modal:a,children:n})})};LH.displayName=uT;var jH="DropdownMenuTrigger",zH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=OH(jH,n),o=vl(n);return f.jsx(ase,{asChild:!0,...o,children:f.jsx(cr.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:K5(e,s.triggerRef),onPointerDown:bn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:bn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});zH.displayName=jH;var Mse="DropdownMenuPortal",FH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=vl(e);return f.jsx(lse,{...r,...n})};FH.displayName=Mse;var UH="DropdownMenuContent",BH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=OH(UH,n),s=vl(n),o=M.useRef(!1);return f.jsx(cse,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:bn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:bn(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});BH.displayName=UH;var Tse="DropdownMenuGroup",Cse=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(use,{...i,...r,ref:e})});Cse.displayName=Tse;var Ese="DropdownMenuLabel",HH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(dse,{...i,...r,ref:e})});HH.displayName=Ese;var Ase="DropdownMenuItem",VH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(fse,{...i,...r,ref:e})});VH.displayName=Ase;var Nse="DropdownMenuCheckboxItem",GH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(hse,{...i,...r,ref:e})});GH.displayName=Nse;var Rse="DropdownMenuRadioGroup",kse=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(pse,{...i,...r,ref:e})});kse.displayName=Rse;var Dse="DropdownMenuRadioItem",Pse=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(mse,{...i,...r,ref:e})});Pse.displayName=Dse;var Ise="DropdownMenuItemIndicator",WH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(gse,{...i,...r,ref:e})});WH.displayName=Ise;var Ose="DropdownMenuSeparator",$H=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(xse,{...i,...r,ref:e})});$H.displayName=Ose;var Lse="DropdownMenuArrow",jse=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(vse,{...i,...r,ref:e})});jse.displayName=Lse;var zse=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:i,defaultOpen:s}=t,o=vl(e),[a,l]=ed({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return f.jsx(yse,{...o,open:a,onOpenChange:l,children:n})},Fse="DropdownMenuSubTrigger",qH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(bse,{...i,...r,ref:e})});qH.displayName=Fse;var Use="DropdownMenuSubContent",XH=M.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=vl(n);return f.jsx(_se,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});XH.displayName=Use;var Bse=LH,Hse=zH,Vse=FH,Gse=BH,Wse=HH,$se=VH,qse=GH,Xse=WH,Yse=$H,Kse=zse,Zse=qH,Qse=XH,Jse="Label",YH=M.forwardRef((t,e)=>f.jsx(cr.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));YH.displayName=Jse;var eoe=YH;function GN(t,[e,n]){return Math.min(n,Math.max(e,t))}var dT="Popover",[KH]=du(dT,[dm]),uw=dm(),[toe,hm]=KH(dT),ZH=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=uw(e),l=M.useRef(null),[c,d]=M.useState(!1),[p,m]=ed({prop:r,defaultProp:i??!1,onChange:s,caller:dT});return f.jsx(iw,{...a,children:f.jsx(toe,{scope:e,contentId:Ac(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:M.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:c,onCustomAnchorAdd:M.useCallback(()=>d(!0),[]),onCustomAnchorRemove:M.useCallback(()=>d(!1),[]),modal:o,children:n})})};ZH.displayName=dT;var QH="PopoverAnchor",noe=M.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=hm(QH,n),s=uw(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return M.useEffect(()=>(o(),()=>a()),[o,a]),f.jsx(sw,{...s,...r,ref:e})});noe.displayName=QH;var JH="PopoverTrigger",eV=M.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=hm(JH,n),s=uw(n),o=Ur(e,i.triggerRef),a=f.jsx(cr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sV(i.open),...r,ref:o,onClick:bn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:f.jsx(sw,{asChild:!0,...s,children:a})});eV.displayName=JH;var l7="PopoverPortal",[roe,ioe]=KH(l7,{forceMount:void 0}),tV=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=hm(l7,e);return f.jsx(roe,{scope:e,forceMount:n,children:f.jsx(Xa,{present:n||s.open,children:f.jsx(Sy,{asChild:!0,container:i,children:r})})})};tV.displayName=l7;var q1="PopoverContent",nV=M.forwardRef((t,e)=>{const n=ioe(q1,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=hm(q1,t.__scopePopover);return f.jsx(Xa,{present:r||s.open,children:s.modal?f.jsx(ooe,{...i,ref:e}):f.jsx(aoe,{...i,ref:e})})});nV.displayName=q1;var soe=K0("PopoverContent.RemoveScroll"),ooe=M.forwardRef((t,e)=>{const n=hm(q1,t.__scopePopover),r=M.useRef(null),i=Ur(e,r),s=M.useRef(!1);return M.useEffect(()=>{const o=r.current;if(o)return eT(o)},[]),f.jsx(nw,{as:soe,allowPinchZoom:!0,children:f.jsx(rV,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bn(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:bn(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:bn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),aoe=M.forwardRef((t,e)=>{const n=hm(q1,t.__scopePopover),r=M.useRef(!1),i=M.useRef(!1);return f.jsx(rV,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),rV=M.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...p}=t,m=hm(q1,n),x=uw(n);return Q5(),f.jsx(tw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:f.jsx(_y,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:f.jsx(oT,{"data-state":sV(m.open),role:"dialog",id:m.contentId,...x,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),iV="PopoverClose",loe=M.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=hm(iV,n);return f.jsx(cr.button,{type:"button",...r,ref:e,onClick:bn(t.onClick,()=>i.onOpenChange(!1))})});loe.displayName=iV;var coe="PopoverArrow",uoe=M.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=uw(n);return f.jsx(aT,{...i,...r,ref:e})});uoe.displayName=coe;function sV(t){return t?"open":"closed"}var doe=ZH,foe=eV,hoe=tV,poe=nV;function moe(t,e){return M.useReducer((n,r)=>e[n][r]??n,t)}var c7="ScrollArea",[oV]=du(c7),[goe,ad]=oV(c7),aV=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=M.useState(null),[c,d]=M.useState(null),[p,m]=M.useState(null),[x,b]=M.useState(null),[_,S]=M.useState(null),[w,C]=M.useState(0),[A,N]=M.useState(0),[D,P]=M.useState(!1),[O,R]=M.useState(!1),L=Ur(e,F=>l(F)),V=ew(i);return f.jsx(goe,{scope:n,type:r,dir:V,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:p,onContentChange:m,scrollbarX:x,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:P,scrollbarY:_,onScrollbarYChange:S,scrollbarYEnabled:O,onScrollbarYEnabledChange:R,onCornerWidthChange:C,onCornerHeightChange:N,children:f.jsx(cr.div,{dir:V,...o,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});aV.displayName=c7;var lV="ScrollAreaViewport",cV=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=ad(lV,n),a=M.useRef(null),l=Ur(e,a,o.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(cr.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:f.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});cV.displayName=lV;var mh="ScrollAreaScrollbar",uV=M.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ad(mh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return M.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?f.jsx(xoe,{...r,ref:e,forceMount:n}):i.type==="scroll"?f.jsx(voe,{...r,ref:e,forceMount:n}):i.type==="auto"?f.jsx(dV,{...r,ref:e,forceMount:n}):i.type==="always"?f.jsx(u7,{...r,ref:e}):null});uV.displayName=mh;var xoe=M.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ad(mh,t.__scopeScrollArea),[s,o]=M.useState(!1);return M.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),f.jsx(Xa,{present:n||s,children:f.jsx(dV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),voe=M.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ad(mh,t.__scopeScrollArea),s=t.orientation==="horizontal",o=hT(()=>l("SCROLL_END"),100),[a,l]=moe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return M.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),M.useEffect(()=>{const c=i.viewport,d=s?"scrollLeft":"scrollTop";if(c){let p=c[d];const m=()=>{const x=c[d];p!==x&&(l("SCROLL"),o()),p=x};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[i.viewport,s,l,o]),f.jsx(Xa,{present:n||a!=="hidden",children:f.jsx(u7,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:bn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:bn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),dV=M.forwardRef((t,e)=>{const n=ad(mh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=M.useState(!1),a=t.orientation==="horizontal",l=hT(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:d)}},10);return X1(n.viewport,l),X1(n.content,l),f.jsx(Xa,{present:r||s,children:f.jsx(u7,{"data-state":s?"visible":"hidden",...i,ref:e})})}),u7=M.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=ad(mh,t.__scopeScrollArea),s=M.useRef(null),o=M.useRef(0),[a,l]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=gV(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:m=>s.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function p(m,x){return Moe(m,o.current,a,x)}return n==="horizontal"?f.jsx(yoe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,x=BP(m,a,i.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=p(m,i.dir))}}):n==="vertical"?f.jsx(boe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,x=BP(m,a);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=p(m))}}):null}),yoe=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=ad(mh,t.__scopeScrollArea),[o,a]=M.useState(),l=M.useRef(null),c=Ur(e,l,s.onScrollbarXChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(hV,{"data-orientation":"horizontal",...i,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":fT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,p)=>{if(s.viewport){const m=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(m),vV(m,p)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:d2(o.paddingLeft),paddingEnd:d2(o.paddingRight)}})}})}),boe=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=ad(mh,t.__scopeScrollArea),[o,a]=M.useState(),l=M.useRef(null),c=Ur(e,l,s.onScrollbarYChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(hV,{"data-orientation":"vertical",...i,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":fT(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,p)=>{if(s.viewport){const m=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(m),vV(m,p)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:d2(o.paddingTop),paddingEnd:d2(o.paddingBottom)}})}})}),[_oe,fV]=oV(mh),hV=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:p,...m}=t,x=ad(mh,n),[b,_]=M.useState(null),S=Ur(e,L=>_(L)),w=M.useRef(null),C=M.useRef(""),A=x.viewport,N=r.content-r.viewport,D=Ca(d),P=Ca(l),O=hT(p,10);function R(L){if(w.current){const V=L.clientX-w.current.left,F=L.clientY-w.current.top;c({x:V,y:F})}}return M.useEffect(()=>{const L=V=>{const F=V.target;(b==null?void 0:b.contains(F))&&D(V,N)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[A,b,N,D]),M.useEffect(P,[r,P]),X1(b,O),X1(x.content,O),f.jsx(_oe,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:Ca(s),onThumbPointerUp:Ca(o),onThumbPositionChange:P,onThumbPointerDown:Ca(a),children:f.jsx(cr.div,{...m,ref:S,style:{position:"absolute",...m.style},onPointerDown:bn(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),w.current=b.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),R(L))}),onPointerMove:bn(t.onPointerMove,R),onPointerUp:bn(t.onPointerUp,L=>{const V=L.target;V.hasPointerCapture(L.pointerId)&&V.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=C.current,x.viewport&&(x.viewport.style.scrollBehavior=""),w.current=null})})})}),u2="ScrollAreaThumb",pV=M.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=fV(u2,t.__scopeScrollArea);return f.jsx(Xa,{present:n||i.hasThumb,children:f.jsx(Soe,{ref:e,...r})})}),Soe=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=ad(u2,n),o=fV(u2,n),{onThumbPositionChange:a}=o,l=Ur(e,p=>o.onThumbChange(p)),c=M.useRef(void 0),d=hT(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(d(),!c.current){const x=Toe(p,a);c.current=x,a()}};return a(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,d,a]),f.jsx(cr.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:bn(t.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),b=p.clientX-x.left,_=p.clientY-x.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:bn(t.onPointerUp,o.onThumbPointerUp)})});pV.displayName=u2;var d7="ScrollAreaCorner",mV=M.forwardRef((t,e)=>{const n=ad(d7,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.jsx(woe,{...t,ref:e}):null});mV.displayName=d7;var woe=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=ad(d7,n),[s,o]=M.useState(0),[a,l]=M.useState(0),c=!!(s&&a);return X1(i.scrollbarX,()=>{var p;const d=((p=i.scrollbarX)==null?void 0:p.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),X1(i.scrollbarY,()=>{var p;const d=((p=i.scrollbarY)==null?void 0:p.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),c?f.jsx(cr.div,{...r,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function d2(t){return t?parseInt(t,10):0}function gV(t,e){const n=t/e;return isNaN(n)?0:n}function fT(t){const e=gV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Moe(t,e,n,r="ltr"){const i=fT(n),s=i/2,o=e||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,p=r==="ltr"?[0,d]:[d*-1,0];return xV([l,c],p)(t)}function BP(t,e,n="ltr"){const r=fT(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-r,l=n==="ltr"?[0,o]:[o*-1,0],c=GN(t,l);return xV([0,o],[0,a])(c)}function xV(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function vV(t,e){return t>0&&t<e}var Toe=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&e(),n=s,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function hT(t,e){const n=Ca(t),r=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),M.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function X1(t,e){const n=Ca(e);Ea(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}var Coe=aV,Eoe=cV,Aoe=mV,Noe=[" ","Enter","ArrowUp","ArrowDown"],Roe=[" ","Enter"],ax="Select",[pT,mT,koe]=zk(ax),[Ty]=du(ax,[koe,dm]),gT=dm(),[Doe,pm]=Ty(ax),[Poe,Ioe]=Ty(ax),yV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:d,autoComplete:p,disabled:m,required:x,form:b}=t,_=gT(e),[S,w]=M.useState(null),[C,A]=M.useState(null),[N,D]=M.useState(!1),P=ew(c),[O,R]=ed({prop:r,defaultProp:i??!1,onChange:s,caller:ax}),[L,V]=ed({prop:o,defaultProp:a,onChange:l,caller:ax}),F=M.useRef(null),U=S?b||!!S.closest("form"):!0,[W,Y]=M.useState(new Set),$=Array.from(W).map(X=>X.props.value).join(";");return f.jsx(iw,{..._,children:f.jsxs(Doe,{required:x,scope:e,trigger:S,onTriggerChange:w,valueNode:C,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:D,contentId:Ac(),value:L,onValueChange:V,open:O,onOpenChange:R,dir:P,triggerPointerDownPosRef:F,disabled:m,children:[f.jsx(pT.Provider,{scope:e,children:f.jsx(Poe,{scope:t.__scopeSelect,onNativeOptionAdd:M.useCallback(X=>{Y(Z=>new Set(Z).add(X))},[]),onNativeOptionRemove:M.useCallback(X=>{Y(Z=>{const K=new Set(Z);return K.delete(X),K})},[]),children:n})}),U?f.jsxs(BV,{"aria-hidden":!0,required:x,tabIndex:-1,name:d,autoComplete:p,value:L,onChange:X=>V(X.target.value),disabled:m,form:b,children:[L===void 0?f.jsx("option",{value:""}):null,Array.from(W)]},$):null]})})};yV.displayName=ax;var bV="SelectTrigger",_V=M.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=gT(n),o=pm(bV,n),a=o.disabled||r,l=Ur(e,o.onTriggerChange),c=mT(n),d=M.useRef("touch"),[p,m,x]=VV(_=>{const S=c().filter(A=>!A.disabled),w=S.find(A=>A.value===o.value),C=GV(S,_,w);C!==void 0&&o.onValueChange(C.value)}),b=_=>{a||(o.onOpenChange(!0),x()),_&&(o.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return f.jsx(sw,{asChild:!0,...s,children:f.jsx(cr.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":HV(o.value)?"":void 0,...i,ref:l,onClick:bn(i.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&b(_)}),onPointerDown:bn(i.onPointerDown,_=>{d.current=_.pointerType;const S=_.target;S.hasPointerCapture(_.pointerId)&&S.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:bn(i.onKeyDown,_=>{const S=p.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&m(_.key),!(S&&_.key===" ")&&Noe.includes(_.key)&&(b(),_.preventDefault())})})})});_V.displayName=bV;var SV="SelectValue",wV=M.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=pm(SV,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,p=Ur(e,l.onValueNodeChange);return Ea(()=>{c(d)},[c,d]),f.jsx(cr.span,{...a,ref:p,style:{pointerEvents:"none"},children:HV(l.value)?f.jsx(f.Fragment,{children:o}):s})});wV.displayName=SV;var Ooe="SelectIcon",MV=M.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return f.jsx(cr.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});MV.displayName=Ooe;var Loe="SelectPortal",TV=t=>f.jsx(Sy,{asChild:!0,...t});TV.displayName=Loe;var lx="SelectContent",CV=M.forwardRef((t,e)=>{const n=pm(lx,t.__scopeSelect),[r,i]=M.useState();if(Ea(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Wd.createPortal(f.jsx(EV,{scope:t.__scopeSelect,children:f.jsx(pT.Slot,{scope:t.__scopeSelect,children:f.jsx("div",{children:t.children})})}),s):null}return f.jsx(AV,{...t,ref:e})});CV.displayName=lx;var Fd=10,[EV,mm]=Ty(lx),joe="SelectContentImpl",zoe=K0("SelectContent.RemoveScroll"),AV=M.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S,...w}=t,C=pm(lx,n),[A,N]=M.useState(null),[D,P]=M.useState(null),O=Ur(e,se=>N(se)),[R,L]=M.useState(null),[V,F]=M.useState(null),U=mT(n),[W,Y]=M.useState(!1),$=M.useRef(!1);M.useEffect(()=>{if(A)return eT(A)},[A]),Q5();const X=M.useCallback(se=>{const[le,...re]=U().map(xe=>xe.ref.current),[pe]=re.slice(-1),be=document.activeElement;for(const xe of se)if(xe===be||(xe==null||xe.scrollIntoView({block:"nearest"}),xe===le&&D&&(D.scrollTop=0),xe===pe&&D&&(D.scrollTop=D.scrollHeight),xe==null||xe.focus(),document.activeElement!==be))return},[U,D]),Z=M.useCallback(()=>X([R,A]),[X,R,A]);M.useEffect(()=>{W&&Z()},[W,Z]);const{onOpenChange:K,triggerPointerDownPosRef:ne}=C;M.useEffect(()=>{if(A){let se={x:0,y:0};const le=pe=>{var be,xe;se={x:Math.abs(Math.round(pe.pageX)-(((be=ne.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(pe.pageY)-(((xe=ne.current)==null?void 0:xe.y)??0))}},re=pe=>{se.x<=10&&se.y<=10?pe.preventDefault():A.contains(pe.target)||K(!1),document.removeEventListener("pointermove",le),ne.current=null};return ne.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",re,{capture:!0})}}},[A,K,ne]),M.useEffect(()=>{const se=()=>K(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[K]);const[H,B]=VV(se=>{const le=U().filter(be=>!be.disabled),re=le.find(be=>be.ref.current===document.activeElement),pe=GV(le,se,re);pe&&setTimeout(()=>pe.ref.current.focus())}),G=M.useCallback((se,le,re)=>{const pe=!$.current&&!re;(C.value!==void 0&&C.value===le||pe)&&(L(se),pe&&($.current=!0))},[C.value]),j=M.useCallback(()=>A==null?void 0:A.focus(),[A]),ie=M.useCallback((se,le,re)=>{const pe=!$.current&&!re;(C.value!==void 0&&C.value===le||pe)&&F(se)},[C.value]),ce=r==="popper"?WN:NV,te=ce===WN?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S}:{};return f.jsx(EV,{scope:n,content:A,viewport:D,onViewportChange:P,itemRefCallback:G,selectedItem:R,onItemLeave:j,itemTextRefCallback:ie,focusSelectedItem:Z,selectedItemText:V,position:r,isPositioned:W,searchRef:H,children:f.jsx(nw,{as:zoe,allowPinchZoom:!0,children:f.jsx(tw,{asChild:!0,trapped:C.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:bn(i,se=>{var le;(le=C.trigger)==null||le.focus({preventScroll:!0}),se.preventDefault()}),children:f.jsx(_y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:f.jsx(ce,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:se=>se.preventDefault(),...w,...te,onPlaced:()=>Y(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:bn(w.onKeyDown,se=>{const le=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!le&&se.key.length===1&&B(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let pe=U().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(se.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const be=se.target,xe=pe.indexOf(be);pe=pe.slice(xe+1)}setTimeout(()=>X(pe)),se.preventDefault()}})})})})})})});AV.displayName=joe;var Foe="SelectItemAlignedPosition",NV=M.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=pm(lx,n),o=mm(lx,n),[a,l]=M.useState(null),[c,d]=M.useState(null),p=Ur(e,O=>d(O)),m=mT(n),x=M.useRef(!1),b=M.useRef(!0),{viewport:_,selectedItem:S,selectedItemText:w,focusSelectedItem:C}=o,A=M.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&_&&S&&w){const O=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),L=s.valueNode.getBoundingClientRect(),V=w.getBoundingClientRect();if(s.dir!=="rtl"){const be=V.left-R.left,xe=L.left-be,Pe=O.left-xe,me=O.width+Pe,ke=Math.max(me,R.width),we=window.innerWidth-Fd,Te=GN(xe,[Fd,Math.max(Fd,we-ke)]);a.style.minWidth=me+"px",a.style.left=Te+"px"}else{const be=R.right-V.right,xe=window.innerWidth-L.right-be,Pe=window.innerWidth-O.right-xe,me=O.width+Pe,ke=Math.max(me,R.width),we=window.innerWidth-Fd,Te=GN(xe,[Fd,Math.max(Fd,we-ke)]);a.style.minWidth=me+"px",a.style.right=Te+"px"}const F=m(),U=window.innerHeight-Fd*2,W=_.scrollHeight,Y=window.getComputedStyle(c),$=parseInt(Y.borderTopWidth,10),X=parseInt(Y.paddingTop,10),Z=parseInt(Y.borderBottomWidth,10),K=parseInt(Y.paddingBottom,10),ne=$+X+W+K+Z,H=Math.min(S.offsetHeight*5,ne),B=window.getComputedStyle(_),G=parseInt(B.paddingTop,10),j=parseInt(B.paddingBottom,10),ie=O.top+O.height/2-Fd,ce=U-ie,te=S.offsetHeight/2,se=S.offsetTop+te,le=$+X+se,re=ne-le;if(le<=ie){const be=F.length>0&&S===F[F.length-1].ref.current;a.style.bottom="0px";const xe=c.clientHeight-_.offsetTop-_.offsetHeight,Pe=Math.max(ce,te+(be?j:0)+xe+Z),me=le+Pe;a.style.height=me+"px"}else{const be=F.length>0&&S===F[0].ref.current;a.style.top="0px";const Pe=Math.max(ie,$+_.offsetTop+(be?G:0)+te)+re;a.style.height=Pe+"px",_.scrollTop=le-ie+_.offsetTop}a.style.margin=`${Fd}px 0`,a.style.minHeight=H+"px",a.style.maxHeight=U+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,a,c,_,S,w,s.dir,r]);Ea(()=>A(),[A]);const[N,D]=M.useState();Ea(()=>{c&&D(window.getComputedStyle(c).zIndex)},[c]);const P=M.useCallback(O=>{O&&b.current===!0&&(A(),C==null||C(),b.current=!1)},[A,C]);return f.jsx(Boe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:P,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(cr.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});NV.displayName=Foe;var Uoe="SelectPopperPosition",WN=M.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Fd,...s}=t,o=gT(n);return f.jsx(oT,{...o,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});WN.displayName=Uoe;var[Boe,f7]=Ty(lx,{}),$N="SelectViewport",RV=M.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=mm($N,n),o=f7($N,n),a=Ur(e,s.onViewportChange),l=M.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(pT.Slot,{scope:n,children:f.jsx(cr.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:bn(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&p){const x=Math.abs(l.current-d.scrollTop);if(x>0){const b=window.innerHeight-Fd*2,_=parseFloat(p.style.minHeight),S=parseFloat(p.style.height),w=Math.max(_,S);if(w<b){const C=w+x,A=Math.min(b,C),N=C-A;p.style.height=A+"px",p.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});RV.displayName=$N;var kV="SelectGroup",[Hoe,Voe]=Ty(kV),Goe=M.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Ac();return f.jsx(Hoe,{scope:n,id:i,children:f.jsx(cr.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Goe.displayName=kV;var DV="SelectLabel",Woe=M.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Voe(DV,n);return f.jsx(cr.div,{id:i.id,...r,ref:e})});Woe.displayName=DV;var f2="SelectItem",[$oe,PV]=Ty(f2),IV=M.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=pm(f2,n),l=mm(f2,n),c=a.value===r,[d,p]=M.useState(s??""),[m,x]=M.useState(!1),b=Ur(e,C=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,C,r,i)}),_=Ac(),S=M.useRef("touch"),w=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx($oe,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:M.useCallback(C=>{p(A=>A||((C==null?void 0:C.textContent)??"").trim())},[]),children:f.jsx(pT.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:f.jsx(cr.div,{role:"option","aria-labelledby":_,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:bn(o.onFocus,()=>x(!0)),onBlur:bn(o.onBlur,()=>x(!1)),onClick:bn(o.onClick,()=>{S.current!=="mouse"&&w()}),onPointerUp:bn(o.onPointerUp,()=>{S.current==="mouse"&&w()}),onPointerDown:bn(o.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:bn(o.onPointerMove,C=>{var A;S.current=C.pointerType,i?(A=l.onItemLeave)==null||A.call(l):S.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:bn(o.onPointerLeave,C=>{var A;C.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:bn(o.onKeyDown,C=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&C.key===" "||(Roe.includes(C.key)&&w(),C.key===" "&&C.preventDefault())})})})})});IV.displayName=f2;var b_="SelectItemText",OV=M.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=pm(b_,n),a=mm(b_,n),l=PV(b_,n),c=Ioe(b_,n),[d,p]=M.useState(null),m=Ur(e,w=>p(w),l.onItemTextChange,w=>{var C;return(C=a.itemTextRefCallback)==null?void 0:C.call(a,w,l.value,l.disabled)}),x=d==null?void 0:d.textContent,b=M.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:_,onNativeOptionRemove:S}=c;return Ea(()=>(_(b),()=>S(b)),[_,S,b]),f.jsxs(f.Fragment,{children:[f.jsx(cr.span,{id:l.textId,...s,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Wd.createPortal(s.children,o.valueNode):null]})});OV.displayName=b_;var LV="SelectItemIndicator",jV=M.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return PV(LV,n).isSelected?f.jsx(cr.span,{"aria-hidden":!0,...r,ref:e}):null});jV.displayName=LV;var qN="SelectScrollUpButton",zV=M.forwardRef((t,e)=>{const n=mm(qN,t.__scopeSelect),r=f7(qN,t.__scopeSelect),[i,s]=M.useState(!1),o=Ur(e,r.onScrollButtonChange);return Ea(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?f.jsx(UV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});zV.displayName=qN;var XN="SelectScrollDownButton",FV=M.forwardRef((t,e)=>{const n=mm(XN,t.__scopeSelect),r=f7(XN,t.__scopeSelect),[i,s]=M.useState(!1),o=Ur(e,r.onScrollButtonChange);return Ea(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?f.jsx(UV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});FV.displayName=XN;var UV=M.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=mm("SelectScrollButton",n),o=M.useRef(null),a=mT(n),l=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>l(),[l]),Ea(()=>{var d;const c=a().find(p=>p.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),f.jsx(cr.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:bn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:bn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:bn(i.onPointerLeave,()=>{l()})})}),qoe="SelectSeparator",Xoe=M.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return f.jsx(cr.div,{"aria-hidden":!0,...r,ref:e})});Xoe.displayName=qoe;var YN="SelectArrow",Yoe=M.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=gT(n),s=pm(YN,n),o=mm(YN,n);return s.open&&o.position==="popper"?f.jsx(aT,{...i,...r,ref:e}):null});Yoe.displayName=YN;var Koe="SelectBubbleInput",BV=M.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=M.useRef(null),s=Ur(r,i),o=nre(e);return M.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&d){const p=new Event("change",{bubbles:!0});d.call(a,e),a.dispatchEvent(p)}},[o,e]),f.jsx(cr.select,{...n,style:{...jU,...n.style},ref:s,defaultValue:e})});BV.displayName=Koe;function HV(t){return t===""||t===void 0}function VV(t){const e=Ca(t),n=M.useRef(""),r=M.useRef(0),i=M.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),s=M.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function GV(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=Zoe(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Zoe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Qoe=yV,Joe=_V,eae=wV,tae=MV,nae=TV,rae=CV,iae=RV,sae=IV,oae=OV,aae=jV,lae=zV,cae=FV,WV="Toggle",h7=M.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[o,a]=ed({prop:n,onChange:i,defaultProp:r??!1,caller:WV});return f.jsx(cr.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:bn(t.onClick,()=>{t.disabled||a(!o)})})});h7.displayName=WV;var uae=h7,gm="ToggleGroup",[$V]=du(gm,[lT]),qV=lT(),p7=ei.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return f.jsx(dae,{...i,ref:e})}if(n==="multiple"){const i=r;return f.jsx(fae,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${gm}\``)});p7.displayName=gm;var[XV,YV]=$V(gm),dae=ei.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=ed({prop:n,defaultProp:r??"",onChange:i,caller:gm});return f.jsx(XV,{scope:t.__scopeToggleGroup,type:"single",value:ei.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:ei.useCallback(()=>a(""),[a]),children:f.jsx(KV,{...s,ref:e})})}),fae=ei.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=ed({prop:n,defaultProp:r??[],onChange:i,caller:gm}),l=ei.useCallback(d=>a((p=[])=>[...p,d]),[a]),c=ei.useCallback(d=>a((p=[])=>p.filter(m=>m!==d)),[a]);return f.jsx(XV,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:f.jsx(KV,{...s,ref:e})})});p7.displayName=gm;var[hae,pae]=$V(gm),KV=ei.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:o,loop:a=!0,...l}=t,c=qV(n),d=ew(o),p={role:"group",dir:d,...l};return f.jsx(hae,{scope:n,rovingFocus:i,disabled:r,children:i?f.jsx(lH,{asChild:!0,...c,orientation:s,dir:d,loop:a,children:f.jsx(cr.div,{...p,ref:e})}):f.jsx(cr.div,{...p,ref:e})})}),h2="ToggleGroupItem",ZV=ei.forwardRef((t,e)=>{const n=YV(h2,t.__scopeToggleGroup),r=pae(h2,t.__scopeToggleGroup),i=qV(t.__scopeToggleGroup),s=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:s,disabled:o},l=ei.useRef(null);return r.rovingFocus?f.jsx(cH,{asChild:!0,...i,focusable:!o,active:s,ref:l,children:f.jsx(HP,{...a,ref:e})}):f.jsx(HP,{...a,ref:e})});ZV.displayName=h2;var HP=ei.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=YV(h2,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=s.type==="single"?o:void 0;return f.jsx(h7,{...a,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),mae=p7,gae=ZV,[xT]=du("Tooltip",[dm]),vT=dm(),QV="TooltipProvider",xae=700,KN="tooltip.open",[vae,m7]=xT(QV),JV=t=>{const{__scopeTooltip:e,delayDuration:n=xae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=M.useRef(!0),a=M.useRef(!1),l=M.useRef(0);return M.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),f.jsx(vae,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:M.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:M.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:M.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};JV.displayName=QV;var oS="Tooltip",[yae,dw]=xT(oS),eG=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=m7(oS,t.__scopeTooltip),c=vT(e),[d,p]=M.useState(null),m=Ac(),x=M.useRef(0),b=o??l.disableHoverableContent,_=a??l.delayDuration,S=M.useRef(!1),[w,C]=ed({prop:r,defaultProp:i??!1,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(KN))):l.onClose(),s==null||s(O)},caller:oS}),A=M.useMemo(()=>w?S.current?"delayed-open":"instant-open":"closed",[w]),N=M.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,C(!0)},[C]),D=M.useCallback(()=>{window.clearTimeout(x.current),x.current=0,C(!1)},[C]),P=M.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,C(!0),x.current=0},_)},[_,C]);return M.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(iw,{...c,children:f.jsx(yae,{scope:e,contentId:m,open:w,stateAttribute:A,trigger:d,onTriggerChange:p,onTriggerEnter:M.useCallback(()=>{l.isOpenDelayedRef.current?P():N()},[l.isOpenDelayedRef,P,N]),onTriggerLeave:M.useCallback(()=>{b?D():(window.clearTimeout(x.current),x.current=0)},[D,b]),onOpen:N,onClose:D,disableHoverableContent:b,children:n})})};eG.displayName=oS;var ZN="TooltipTrigger",tG=M.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=dw(ZN,n),s=m7(ZN,n),o=vT(n),a=M.useRef(null),l=Ur(e,a,i.onTriggerChange),c=M.useRef(!1),d=M.useRef(!1),p=M.useCallback(()=>c.current=!1,[]);return M.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(sw,{asChild:!0,...o,children:f.jsx(cr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:bn(t.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:bn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:bn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:bn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:bn(t.onBlur,i.onClose),onClick:bn(t.onClick,i.onClose)})})});tG.displayName=ZN;var g7="TooltipPortal",[bae,_ae]=xT(g7,{forceMount:void 0}),nG=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=dw(g7,e);return f.jsx(bae,{scope:e,forceMount:n,children:f.jsx(Xa,{present:n||s.open,children:f.jsx(Sy,{asChild:!0,container:i,children:r})})})};nG.displayName=g7;var Y1="TooltipContent",rG=M.forwardRef((t,e)=>{const n=_ae(Y1,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=dw(Y1,t.__scopeTooltip);return f.jsx(Xa,{present:r||o.open,children:o.disableHoverableContent?f.jsx(iG,{side:i,...s,ref:e}):f.jsx(Sae,{side:i,...s,ref:e})})}),Sae=M.forwardRef((t,e)=>{const n=dw(Y1,t.__scopeTooltip),r=m7(Y1,t.__scopeTooltip),i=M.useRef(null),s=Ur(e,i),[o,a]=M.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:p}=r,m=M.useCallback(()=>{a(null),p(!1)},[p]),x=M.useCallback((b,_)=>{const S=b.currentTarget,w={x:b.clientX,y:b.clientY},C=Eae(w,S.getBoundingClientRect()),A=Aae(w,C),N=Nae(_.getBoundingClientRect()),D=kae([...A,...N]);a(D),p(!0)},[p]);return M.useEffect(()=>()=>m(),[m]),M.useEffect(()=>{if(l&&d){const b=S=>x(S,d),_=S=>x(S,l);return l.addEventListener("pointerleave",b),d.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",_)}}},[l,d,x,m]),M.useEffect(()=>{if(o){const b=_=>{const S=_.target,w={x:_.clientX,y:_.clientY},C=(l==null?void 0:l.contains(S))||(d==null?void 0:d.contains(S)),A=!Rae(w,o);C?m():A&&(m(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,d,o,c,m]),f.jsx(iG,{...t,ref:s})}),[wae,Mae]=xT(oS,{isInside:!1}),Tae=OU("TooltipContent"),iG=M.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=dw(Y1,n),c=vT(n),{onClose:d}=l;return M.useEffect(()=>(document.addEventListener(KN,d),()=>document.removeEventListener(KN,d)),[d]),M.useEffect(()=>{if(l.trigger){const p=m=>{const x=m.target;x!=null&&x.contains(l.trigger)&&d()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,d]),f.jsx(_y,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:f.jsxs(oT,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Tae,{children:r}),f.jsx(wae,{scope:n,isInside:!0,children:f.jsx(ate,{id:l.contentId,role:"tooltip",children:i||r})})]})})});rG.displayName=Y1;var sG="TooltipArrow",Cae=M.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=vT(n);return Mae(sG,n).isInside?null:f.jsx(aT,{...i,...r,ref:e})});Cae.displayName=sG;function Eae(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Aae(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function Nae(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function Rae(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,d=a.y,p=l.x,m=l.y;d>r!=m>r&&n<(p-c)*(r-d)/(m-d)+c&&(i=!i)}return i}function kae(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Dae(e)}function Dae(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Pae=JV,Iae=eG,Oae=tG,Lae=nG,jae=rG;function oG(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=oG(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function aG(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=oG(t))&&(r&&(r+=" "),r+=e);return r}const zae=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},Fae=(t,e)=>({classGroupId:t,validator:e}),lG=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),p2="-",VP=[],Uae="arbitrary..",Bae=t=>{const e=Vae(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Hae(o);const a=o.split(p2),l=a[0]===""&&a.length>1?1:0;return cG(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?zae(c,l):l:c||VP}return n[o]||VP}}},cG=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=cG(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(p2):t.slice(e).join(p2),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(a))return d.classGroupId}},Hae=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?Uae+r:void 0})(),Vae=t=>{const{theme:e,classGroups:n}=t;return Gae(n,e)},Gae=(t,e)=>{const n=lG();for(const r in t){const i=t[r];x7(i,n,r,e)}return n},x7=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];Wae(o,e,n,r)}},Wae=(t,e,n,r)=>{if(typeof t=="string"){$ae(t,e,n);return}if(typeof t=="function"){qae(t,e,n,r);return}Xae(t,e,n,r)},$ae=(t,e,n)=>{const r=t===""?e:uG(e,t);r.classGroupId=n},qae=(t,e,n,r)=>{if(Yae(t)){x7(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(Fae(n,t))},Xae=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];x7(l,uG(e,a),n,r)}},uG=(t,e)=>{let n=t;const r=e.split(p2),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=lG(),n.nextPart.set(o,a)),n=a}return n},Yae=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Kae=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},QN="!",GP=":",Zae=[],WP=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Qae=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const d=i.length;for(let _=0;_<d;_++){const S=i[_];if(o===0&&a===0){if(S===GP){s.push(i.slice(l,_)),l=_+1;continue}if(S==="/"){c=_;continue}}S==="["?o++:S==="]"?o--:S==="("?a++:S===")"&&a--}const p=s.length===0?i:i.slice(l);let m=p,x=!1;p.endsWith(QN)?(m=p.slice(0,-1),x=!0):p.startsWith(QN)&&(m=p.slice(1),x=!0);const b=c&&c>l?c-l:void 0;return WP(s,x,m,b)};if(e){const i=e+GP,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):WP(Zae,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},Jae=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},ele=t=>({cache:Kae(t.cacheSize),parseClassName:Qae(t),sortModifiers:Jae(t),...Bae(t)}),tle=/\s+/,nle=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(tle);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:_}=n(d);if(p){l=d+(l.length>0?" "+l:l);continue}let S=!!_,w=r(S?b.substring(0,_):b);if(!w){if(!S){l=d+(l.length>0?" "+l:l);continue}if(w=r(b),!w){l=d+(l.length>0?" "+l:l);continue}S=!1}const C=m.length===0?"":m.length===1?m[0]:s(m).join(":"),A=x?C+QN:C,N=A+w;if(o.indexOf(N)>-1)continue;o.push(N);const D=i(w,S);for(let P=0;P<D.length;++P){const O=D[P];o.push(A+O)}l=d+(l.length>0?" "+l:l)}return l},rle=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=dG(n))&&(i&&(i+=" "),i+=r);return i},dG=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=dG(t[r]))&&(n&&(n+=" "),n+=e);return n},ile=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((d,p)=>p(d),t());return n=ele(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const d=nle(l,n);return i(l,d),d};return s=o,(...l)=>s(rle(...l))},sle=[],ta=t=>{const e=n=>n[t]||sle;return e.isThemeGetter=!0,e},fG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ole=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ale=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lle=/\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$/,cle=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ule=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dle=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,m0=t=>ole.test(t),$r=t=>!!t&&!Number.isNaN(Number(t)),g0=t=>!!t&&Number.isInteger(Number(t)),YE=t=>t.endsWith("%")&&$r(t.slice(0,-1)),$h=t=>ale.test(t),pG=()=>!0,fle=t=>lle.test(t)&&!cle.test(t),v7=()=>!1,hle=t=>ule.test(t),ple=t=>dle.test(t),mle=t=>!In(t)&&!Ln(t),gle=t=>xm(t,xG,v7),In=t=>fG.test(t),ag=t=>xm(t,vG,fle),$P=t=>xm(t,Mle,$r),xle=t=>xm(t,bG,pG),vle=t=>xm(t,yG,v7),qP=t=>xm(t,mG,v7),yle=t=>xm(t,gG,ple),t4=t=>xm(t,_G,hle),Ln=t=>hG.test(t),Yb=t=>Sx(t,vG),ble=t=>Sx(t,yG),XP=t=>Sx(t,mG),_le=t=>Sx(t,xG),Sle=t=>Sx(t,gG),n4=t=>Sx(t,_G,!0),wle=t=>Sx(t,bG,!0),xm=(t,e,n)=>{const r=fG.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sx=(t,e,n=!1)=>{const r=hG.exec(t);return r?r[1]?e(r[1]):n:!1},mG=t=>t==="position"||t==="percentage",gG=t=>t==="image"||t==="url",xG=t=>t==="length"||t==="size"||t==="bg-size",vG=t=>t==="length",Mle=t=>t==="number",yG=t=>t==="family-name",bG=t=>t==="number"||t==="weight",_G=t=>t==="shadow",Tle=()=>{const t=ta("color"),e=ta("font"),n=ta("text"),r=ta("font-weight"),i=ta("tracking"),s=ta("leading"),o=ta("breakpoint"),a=ta("container"),l=ta("spacing"),c=ta("radius"),d=ta("shadow"),p=ta("inset-shadow"),m=ta("text-shadow"),x=ta("drop-shadow"),b=ta("blur"),_=ta("perspective"),S=ta("aspect"),w=ta("ease"),C=ta("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...N(),Ln,In],P=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],R=()=>[Ln,In,l],L=()=>[m0,"full","auto",...R()],V=()=>[g0,"none","subgrid",Ln,In],F=()=>["auto",{span:["full",g0,Ln,In]},g0,Ln,In],U=()=>[g0,"auto",Ln,In],W=()=>["auto","min","max","fr",Ln,In],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...R()],Z=()=>[m0,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[m0,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ne=()=>[m0,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[t,Ln,In],B=()=>[...N(),XP,qP,{position:[Ln,In]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",_le,gle,{size:[Ln,In]}],ie=()=>[YE,Yb,ag],ce=()=>["","none","full",c,Ln,In],te=()=>["",$r,Yb,ag],se=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[$r,YE,XP,qP],pe=()=>["","none",b,Ln,In],be=()=>["none",$r,Ln,In],xe=()=>["none",$r,Ln,In],Pe=()=>[$r,Ln,In],me=()=>[m0,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$h],breakpoint:[$h],color:[pG],container:[$h],"drop-shadow":[$h],ease:["in","out","in-out"],font:[mle],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$h],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$h],shadow:[$h],spacing:["px",$r],text:[$h],"text-shadow":[$h],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",m0,In,Ln,S]}],container:["container"],columns:[{columns:[$r,In,Ln,a]}],"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:D()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[g0,"auto",Ln,In]}],basis:[{basis:[m0,"full","auto",a,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$r,m0,"auto","initial","none",In]}],grow:[{grow:["",$r,Ln,In]}],shrink:[{shrink:["",$r,Ln,In]}],order:[{order:[g0,"first","last","none",Ln,In]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...ne()]}],"min-block-size":[{"min-block":["auto",...ne()]}],"max-block-size":[{"max-block":["none",...ne()]}],w:[{w:[a,"screen",...Z()]}],"min-w":[{"min-w":[a,"screen","none",...Z()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",n,Yb,ag]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,wle,xle]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",YE,In]}],"font-family":[{font:[ble,vle,e]}],"font-features":[{"font-features":[In]}],"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:[i,Ln,In]}],"line-clamp":[{"line-clamp":[$r,"none",Ln,$P]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",Ln,In]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ln,In]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[$r,"from-font","auto",Ln,ag]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[$r,"auto",Ln,In]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ln,In]}],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",Ln,In]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},g0,Ln,In],radial:["",Ln,In],conic:[g0,Ln,In]},Sle,yle]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$r,Ln,In]}],"outline-w":[{outline:["",$r,Yb,ag]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",d,n4,t4]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",p,n4,t4]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[$r,ag]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",m,n4,t4]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[$r,Ln,In]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":[$r]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Ln,In]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[$r]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ln,In]}],filter:[{filter:["","none",Ln,In]}],blur:[{blur:pe()}],brightness:[{brightness:[$r,Ln,In]}],contrast:[{contrast:[$r,Ln,In]}],"drop-shadow":[{"drop-shadow":["","none",x,n4,t4]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",$r,Ln,In]}],"hue-rotate":[{"hue-rotate":[$r,Ln,In]}],invert:[{invert:["",$r,Ln,In]}],saturate:[{saturate:[$r,Ln,In]}],sepia:[{sepia:["",$r,Ln,In]}],"backdrop-filter":[{"backdrop-filter":["","none",Ln,In]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[$r,Ln,In]}],"backdrop-contrast":[{"backdrop-contrast":[$r,Ln,In]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$r,Ln,In]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$r,Ln,In]}],"backdrop-invert":[{"backdrop-invert":["",$r,Ln,In]}],"backdrop-opacity":[{"backdrop-opacity":[$r,Ln,In]}],"backdrop-saturate":[{"backdrop-saturate":[$r,Ln,In]}],"backdrop-sepia":[{"backdrop-sepia":["",$r,Ln,In]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ln,In]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$r,"initial",Ln,In]}],ease:[{ease:["linear","initial",w,Ln,In]}],delay:[{delay:[$r,Ln,In]}],animate:[{animate:["none",C,Ln,In]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ln,In]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:Pe()}],"skew-x":[{"skew-x":Pe()}],"skew-y":[{"skew-y":Pe()}],transform:[{transform:[Ln,In,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",Ln,In]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Ln,In]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[$r,Yb,ag,$P]}],stroke:[{stroke:["none",...H()]}],"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"]}},Cle=ile(Tle);function Rt(...t){return Cle(aG(t))}function SG({delayDuration:t=0,...e}){return f.jsx(Pae,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function wx({...t}){return f.jsx(SG,{children:f.jsx(Iae,{"data-slot":"tooltip",...t})})}function Mx({...t}){return f.jsx(Oae,{"data-slot":"tooltip-trigger",...t})}function Tx({className:t,sideOffset:e=4,children:n,...r}){return f.jsx(Lae,{children:f.jsx(jae,{"data-slot":"tooltip-content",sideOffset:e,className:Rt("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs bg-foreground text-background z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",t),...r,children:n})})}const y7={},Ele=Symbol((y7?"production":void 0)!=="production"?"RESET":""),wG=t=>typeof(t==null?void 0:t.then)=="function";function Ale(t=()=>{try{return window.localStorage}catch(n){(y7?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,i;const s={getItem:(l,c)=>{var d,p;const m=b=>{if(b=b||"",r!==b){try{i=JSON.parse(b,e==null?void 0:e.reviver)}catch{return c}r=b}return i},x=(p=(d=t())==null?void 0:d.getItem(l))!=null?p:null;return wG(x)?x.then(m):m(x)},setItem:(l,c)=>{var d;return(d=t())==null?void 0:d.setItem(l,JSON.stringify(c,void 0))},removeItem:l=>{var c;return(c=t())==null?void 0:c.removeItem(l)}},o=l=>(c,d,p)=>l(c,m=>{let x;try{x=JSON.parse(m||"")}catch{x=p}d(x)});let a;try{a=(n=t())==null?void 0:n.subscribe}catch{}return!a&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(a=(l,c)=>{if(!(t()instanceof window.Storage))return()=>{};const d=p=>{p.storageArea===t()&&p.key===l&&c(p.newValue)};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),a&&(s.subscribe=o(a)),s}const Nle=Ale();function Ao(t,e,n=Nle,r){const i=Lr(e);return(y7?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=o=>{o(n.getItem(t,e));let a;return n.subscribe&&(a=n.subscribe(t,o,e)),a},Lr(o=>o(i),(o,a,l)=>{const c=typeof l=="function"?l(o(i)):l;return c===Ele?(a(i,e),n.removeItem(t)):wG(c)?c.then(d=>(a(i,d),n.setItem(t,d))):(a(i,c),n.setItem(t,c))})}const No=Ao("dark-mode",!1),MG=Lr(!1),TG=Lr(!1),CG=Lr(!1),Rle=()=>{try{const t=localStorage.getItem("selected-run-path");if(t!==null)return JSON.parse(t)}catch{}return null},YP=Lr(Rle()),xl=Lr(t=>t(YP),(t,e,n)=>{e(YP,n);try{n===null?localStorage.removeItem("selected-run-path"):localStorage.setItem("selected-run-path",JSON.stringify(n))}catch{}}),yT=Ao("visible-runs",[]),EG=Lr(!1),AG=Lr(!1);function ps(t){const e=Lr({});return Lr(n=>{const r=n(xl);if(!r)return t;const i=n(e);return Object.prototype.hasOwnProperty.call(i,r)?i[r]:t},(n,r,i)=>{const s=n(xl);if(!s)return;const o=n(e),a=Object.prototype.hasOwnProperty.call(o,s)?o[s]:t,l=typeof i=="function"?i(a):i;r(e,{...o,[s]:l})})}const NG=Lr(!1),kle=Ao("overview-show-ema",!1),Dle=Ao("overview-ema-span",10),Ple=Ao("overview-show-all-runs",!1),Ile=[{id:"default-reward",metricKey:"reward_sum_mean",label:"Reward",plotType:"step_metric"},{id:"default-timing",metricKey:"timing_step_total",label:"Time per Step",plotType:"step_metric"},{id:"default-grad-norm",metricKey:"grad_norm",label:"Grad Norm",plotType:"step_metric"}],Ole=Ao("overview-plots",Ile),Lle=Lr(!1),jle=Lr(10),zle=Lr("step"),Fle=Lr(!1),Ule=Lr(100),Ble=Lr(3600),Hle=Lr(0),Vle=Lr("all"),Gle=Lr(null),Wle=Lr(null),b7=Lr({}),$le=ps(0),qle=Lr(30),bT=ps(null),KP=ps(null),Xle=Lr(0),Yle=Lr(0),_T=Lr(!0),Kle=Lr(!0),RG=Lr(!1),Zle=Lr(14),Qle=Lr(0),Jle=Ao("inference-max-lanes",128),kG=ps(null),DG=ps(null),ece=Ao("rollouts-selected-metrics",[]),tce=Ao("rollouts-discarded-selected-metrics",[]),_7=Ao("rollouts-metrics-sidebar-open",!0),KE=Ao("rollouts-discarded-metrics-sidebar-open",!0),S7=Ao("rollouts-sample-picker-sidebar-open",!0),ZE=Ao("rollouts-discarded-sample-picker-sidebar-open",!0),PG=ps(null),ZP=ps(null),IG=ps(null),QP=ps(null),OG=ps(null),JP=ps(null),LG=Lr("groups"),nce=Ao("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),rce=Ao("rollouts-sample-picker-tooltips",!0),ice=Ao("rollouts-sample-view-metrics",[]),eI=Lr("groups"),tI=ps(null),sce=ps(null),nI=ps(null),rI=ps(null),iI=ps(null),QE=Ao("evals-sample-picker-sidebar-open",!0),sI=Lr("groups"),JE=Ao("evals-metrics-sidebar-open",!0),oce=Ao("evals-selected-metrics",[]),ace=Lr("metrics"),lce=ps(0),cce=Lr(60),uce=Lr(!0),dce=Lr(!1),fce=Lr(1),hce=ps(0),pce=ps("separated"),mce=ps(!0),gce=ps(!0),xce=ps(!0),vce=ps(!0),yce=ps("combined"),bce=ps("combined"),_ce=ps(!0),ST=Lr(null),wT=Ao("rollouts-render-options",["markdown","latex","code"]),MT=Ao("rollouts-format-think",!0),jG=Lr(null);function Sce(){const t=Jn(No);return M.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]),null}function wce({children:t}){const[e]=M.useState(()=>new bee({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return f.jsxs(Jee,{children:[f.jsx(Sce,{}),f.jsx(_ee,{client:e,children:f.jsx(SG,{children:t})})]})}/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mce=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tce=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),oI=t=>{const e=Tce(t);return e.charAt(0).toUpperCase()+e.slice(1)},zG=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),Cce=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var Ece={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"};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ace=M.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>M.createElement("svg",{ref:l,...Ece,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:zG("lucide",i),...!s&&!Cce(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,d])=>M.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mi=(t,e)=>{const n=M.forwardRef(({className:r,...i},s)=>M.createElement(Ace,{ref:s,iconNode:e,className:zG(`lucide-${Mce(oI(t))}`,`lucide-${t}`,r),...i}));return n.displayName=oI(t),n};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nce=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Rce=mi("arrow-down",Nce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kce=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],eA=mi("arrow-left",kce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dce=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Pce=mi("arrow-right",Dce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ice=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Oce=mi("arrow-up",Ice);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lce=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],vm=mi("check",Lce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jce=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ir=mi("chevron-down",jce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zce=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],w7=mi("chevron-left",zce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fce=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Zg=mi("chevron-right",Fce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uce=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],M7=mi("chevron-up",Uce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bce=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Hce=mi("chevrons-left",Bce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vce=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Gce=mi("chevrons-right",Vce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$ce=mi("circle-check",Wce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Xce=mi("circle-x",qce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yce=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],TT=mi("copy",Yce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kce=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Zce=mi("database",Kce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qce=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Jce=mi("file-code-corner",Qce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eue=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],tue=mi("folder-open",eue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nue=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],rue=mi("folder",nue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iue=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],T7=mi("grip-vertical",iue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sue=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],oue=mi("layers",sue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aue=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ld=mi("loader-circle",aue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lue=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],JN=mi("menu",lue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cue=[["path",{d:"M5 12h14",key:"1ays0h"}]],uue=mi("minus",cue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const due=[["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"}]],fue=mi("moon",due);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],pue=mi("panel-left-close",hue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],gue=mi("panel-right-close",mue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xue=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],FG=mi("pencil",xue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vue=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],lp=mi("plus",vue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yue=[["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"}]],UG=mi("settings",yue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bue=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Cx=mi("sliders-horizontal",bue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _ue=[["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"}]],Sue=mi("sun",_ue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wue=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mue=mi("trash-2",wue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tue=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cue=mi("triangle-alert",Tue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eue=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fu=mi("x",Eue);function qu({...t}){return f.jsx(xB,{"data-slot":"dialog",...t})}function CT({...t}){return f.jsx(vB,{"data-slot":"dialog-trigger",...t})}function Aue({...t}){return f.jsx(yB,{"data-slot":"dialog-portal",...t})}function Nue({className:t,...e}){return f.jsx(bB,{"data-slot":"dialog-overlay",className:Rt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function Xu({className:t,children:e,...n}){return f.jsxs(Aue,{children:[f.jsx(Nue,{}),f.jsxs(_B,{"data-slot":"dialog-content",className:Rt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,f.jsxs(Wk,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[f.jsx(fu,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Zc({className:t,...e}){return f.jsx("div",{"data-slot":"dialog-header",className:Rt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ET({className:t,...e}){return f.jsx("div",{"data-slot":"dialog-footer",className:Rt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Qc({className:t,...e}){return f.jsx(SB,{"data-slot":"dialog-title",className:Rt("text-lg leading-none font-semibold",t),...e})}function jg({className:t,...e}){return f.jsx(wB,{"data-slot":"dialog-description",className:Rt("text-muted-foreground text-sm",t),...e})}function la({...t}){return f.jsx(Bse,{"data-slot":"dropdown-menu",...t})}function ca({...t}){return f.jsx(Hse,{"data-slot":"dropdown-menu-trigger",...t})}function ua({className:t,align:e="start",sideOffset:n=4,...r}){return f.jsx(Vse,{children:f.jsx(Gse,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",t),...r})})}function ra({className:t,inset:e,variant:n="default",...r}){return f.jsx($se,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Rt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function ti({className:t,children:e,checked:n,...r}){return f.jsxs(qse,{"data-slot":"dropdown-menu-checkbox-item",className:Rt("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[f.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-checkbox-item-indicator",children:f.jsx(Xse,{children:f.jsx(vm,{})})}),e]})}function K1({className:t,inset:e,...n}){return f.jsx(Wse,{"data-slot":"dropdown-menu-label","data-inset":e,className:Rt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function aa({className:t,...e}){return f.jsx(Yse,{"data-slot":"dropdown-menu-separator",className:Rt("bg-border -mx-1 my-1 h-px",t),...e})}function Rue({...t}){return f.jsx(Kse,{"data-slot":"dropdown-menu-sub",...t})}function kue({className:t,inset:e,children:n,...r}){return f.jsxs(Zse,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:Rt("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,f.jsx(Zg,{className:"ml-auto"})]})}function Due({className:t,...e}){return f.jsx(Qse,{"data-slot":"dropdown-menu-sub-content",className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden",t),...e})}const aI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,lI=aG,C7=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return lI(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],p=s==null?void 0:s[c];if(d===null)return null;const m=aI(d)||aI(p);return i[c][m]}),a=n&&Object.entries(n).reduce((c,d)=>{let[p,m]=d;return m===void 0||(c[p]=m),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:p,className:m,...x}=d;return Object.entries(x).every(b=>{let[_,S]=b;return Array.isArray(S)?S.includes({...s,...a}[_]):{...s,...a}[_]===S})?[...c,p,m]:c},[]);return lI(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Pue=C7("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Mn({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?PU:"button";return f.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:Rt(Pue({variant:e,size:n,className:t})),...i})}function cp({className:t,type:e,...n}){return f.jsx("input",{type:e,"data-slot":"input",className:Rt("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",t),...n})}function Iue({className:t,...e}){return f.jsx(eoe,{"data-slot":"label",className:Rt("gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",t),...e})}function hl({className:t,...e}){return f.jsx(ld,{role:"status","aria-label":"Loading",className:Rt("size-4 animate-spin",t),...e})}function Ex({className:t,children:e,...n}){return f.jsxs(Coe,{"data-slot":"scroll-area",className:Rt("relative",t),...n,children:[f.jsx(Eoe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:e}),f.jsx(Oue,{}),f.jsx(Aoe,{})]})}function Oue({className:t,orientation:e="vertical",...n}){return f.jsx(uV,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:Rt("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",t),...n,children:f.jsx(pV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function AT({...t}){return f.jsx(doe,{"data-slot":"popover",...t})}function NT({...t}){return f.jsx(foe,{"data-slot":"popover-trigger",...t})}function RT({className:t,align:e="center",sideOffset:n=4,...r}){return f.jsx(hoe,{children:f.jsx(poe,{"data-slot":"popover-content",align:e,sideOffset:n,className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",t),...r})})}function m2({...t}){return f.jsx($ne,{"data-slot":"alert-dialog",...t})}function Lue({...t}){return f.jsx(qne,{"data-slot":"alert-dialog-portal",...t})}function jue({className:t,...e}){return f.jsx(Xne,{"data-slot":"alert-dialog-overlay",className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...e})}function g2({className:t,size:e="default",...n}){return f.jsxs(Lue,{children:[f.jsx(jue,{}),f.jsx(Yne,{"data-slot":"alert-dialog-content","data-size":e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-4 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",t),...n})]})}function x2({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-header",className:Rt("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...e})}function v2({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-footer",className:Rt("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...e})}function zue({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-media",className:Rt("bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",t),...e})}function y2({className:t,...e}){return f.jsx(Qne,{"data-slot":"alert-dialog-title",className:Rt("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...e})}function b2({className:t,...e}){return f.jsx(Jne,{"data-slot":"alert-dialog-description",className:Rt("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...e})}function _2({className:t,variant:e="default",size:n="default",...r}){return f.jsx(Mn,{variant:e,size:n,asChild:!0,children:f.jsx(Kne,{"data-slot":"alert-dialog-action",className:Rt(t),...r})})}function S2({className:t,variant:e="outline",size:n="default",...r}){return f.jsx(Mn,{variant:e,size:n,asChild:!0,children:f.jsx(Zne,{"data-slot":"alert-dialog-cancel",className:Rt(t),...r})})}const ar="",da=5e3,tA={inference_processes_start:"#3b82f6",trainer_process_start:"#8b5cf6",inference_servers_ready:"#22c55e",trainer_ready:"#10b981",weight_update:"#f59e0b",save_batch:"#ef4444",inference_call:"#06b6d4",wandb_initialized:"#6366f1",training_loop_start:"#ec4899",rollouts_group_done:"#4ccf7c",rollout_discarded_max_async:"#bdbdbd",rollout_discarded_zero_advantage:"#969696",rollout_paused_max_async:"#ffabab",rollout_resumed_max_async:"#3856ff",checkpoint_save_start:"#328519",checkpoint_save_done:"#328519"},r4={forward:"#3b82f6",forward_backward:"#4f6edb",loss:"#d6cd1c",loss_computation:"#d6cd1c","loss/shift":"#fbbf24","loss/log_softmax":"#facc15","loss/policy_loss":"#eab308","loss/reduction":"#ca8a04",backward:"#ef4444",optimizer:"#22c55e",data_wait:"#6b7280",weight_broadcast:"#f97316",grad_clip:"#b342f5",grad_norm:"#f9a8d4",data_to_device:"#06b6d4",prepare_tensors:"#14b8a6",compute_entropy:"#f97316",compute_kl:"#ec4899",finalize_model_grads:"#9041c4",checkpoint:"#328519"},FM="#0284c7",nA="#10b981",w2="#ababab",M2="#555555",E7="#c9c9c9",T2="#4a4a4a",cI={request:FM,weight_broadcast:"#f97316"},C2="#e6e9ed",BG="#2a2d32",A7="#6b7280";function N7(t){if(tA[t])return tA[t];for(const[e,n]of Object.entries(tA))if(t.startsWith(e))return n;return A7}function E2(t){if(r4[t])return r4[t];if(t.includes("/")){const e=t.split("/")[0];if(r4[e])return r4[e]}return A7}function HG(t){return cI[t]?cI[t]:A7}function R7(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function VG(t,e,n,r){const i=t.replace(/_/g," ").split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),s=[];return e!==-1&&s.push(`Step ${e}`),r!=null&&r!==-1&&s.push(`Mini Batch ${r}`),n!=null&&n!==-1&&s.push(`Micro Batch ${n}`),{primary:i,secondary:s.length>0?`(${s.join(" ")})`:null}}function ym(){return $i({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${ar}/runs`);if(!t.ok)throw new Error("Failed to fetch runs");return t.json()},refetchInterval:t=>{var n,r;return((r=(n=t.state.data)==null?void 0:n.discovery)==null?void 0:r.status)==="discovering"?1500:da}})}function Fue(t=!0){return $i({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${ar}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function Uue(t=!0){return $i({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${ar}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function Bue(t,e,n,r){return $i({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${ar}/rollouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e})});if(!i.ok)throw new Error("Failed to fetch rollouts");return i.json()},enabled:n&&!!t,refetchInterval:da})}function Hue(t,e,n,r){return $i({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${ar}/rollouts-discarded`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,trainer_step:e})});if(!i.ok)throw new Error("Failed to fetch discarded rollouts");return i.json()},enabled:n&&!!t,refetchInterval:da})}function Vue(t,e,n,r,i){return $i({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${ar}/evals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,eval_name:n})});if(!s.ok)throw new Error("Failed to fetch evals");return s.json()},enabled:r&&!!t,refetchInterval:da})}function GG(t,e,n,r,i){return $i({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${ar}/sample-details`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e,sample_idx:n,is_eval:i??!1})});if(!s.ok)throw new Error("Failed to fetch sample details");return s.json()},enabled:r&&!!t&&e!=null&&n!=null})}function k7(t,e,n){const r=M.useMemo(()=>{const s=new Set,o=[];for(const a of e){const l=`${a.group_id}:${a.sample_idx}`;s.has(l)||(s.add(l),o.push(a))}return o.sort((a,l)=>a.group_id-l.group_id||a.sample_idx-l.sample_idx)},[e]),i=M.useMemo(()=>r.map(s=>`${s.group_id}:${s.sample_idx}`).join("|"),[r]);return $i({queryKey:["sample-statuses",t,i],queryFn:async()=>{const s=await fetch(`${ar}/sample-statuses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,samples:r})});if(!s.ok)throw new Error("Failed to fetch sample statuses");return s.json()},enabled:n&&!!t&&r.length>0})}function cd(t,e,n){return $i({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${ar}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?da:!1})}function uI(t,e){return $i({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${ar}/run-code/tree/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch run code tree");return n.json()},enabled:e&&!!t,staleTime:6e4})}function dI(t,e,n){return $i({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${ar}/run-code/file/${encodeURIComponent(t)}?file_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code file");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:od})}function Gue(t,e,n){return $i({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${ar}/run-code/diff-summary/${encodeURIComponent(t)}?right_run_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code diff summary");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:od})}function Wue(t,e,n,r,i){return $i({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${ar}/events/timeline-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n})});if(!s.ok)throw new Error("Failed to fetch paginated timeline");return s.json()},enabled:r&&!!t,refetchInterval:da,placeholderData:od,gcTime:0})}function $ue(t,e,n){return $i({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${ar}/events/inference-by-group`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e})});if(!r.ok)throw new Error("Failed to fetch inference events by group");return r.json()},enabled:n&&!!t&&e!==null})}function que(t,e,n,r,i){return $i({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${ar}/events/trainer-breakdown`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,parent_event_type:e,rank:n,step:r})});if(!s.ok)throw new Error("Failed to fetch trainer breakdown events");return s.json()},enabled:i&&!!t&&!!e&&n!==null&&r!==null})}function WG(t,e,n,r=60){return $i({queryKey:["inference-performance",t,r],queryFn:async()=>{const i=await fetch(`${ar}/inference-performance`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,bucket_seconds:r})});if(!i.ok)throw new Error("Failed to fetch inference performance");return i.json()},enabled:e&&!!t,refetchInterval:n?da:!1,placeholderData:od})}function Xue(t,e,n,r,i,s,o){const a=n.filter(l=>Number.isFinite(l.rank));return Tee({queries:a.map(l=>({queryKey:["gpu-metrics-rank",t,e,l.rank,l.node_id??null,l.local_rank??null,l.source??null,r,i],queryFn:async()=>{const c=await fetch(`${ar}/system-metrics/gpu`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:e,rank:l.rank,node_id:l.node_id??null,local_rank:l.local_rank??null,source:l.source??null,include_associated_system_metrics:!0,include_edge_points:!0,start_time:r,end_time:i,limit:5e4})});if(!c.ok)throw new Error("Failed to fetch rank-scoped GPU metrics");return c.json()},enabled:s&&!!t&&Number.isFinite(l.rank),refetchInterval:da,placeholderData:od}))})}function Yue(t,e,n,r,i,s){return $i({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const o=await fetch(`${ar}/system-metrics/gpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,align_to_latest:r})});if(!o.ok)throw new Error("Failed to fetch paginated GPU metrics");return o.json()},enabled:i&&!!t,refetchInterval:da,placeholderData:od})}function Kue(t,e,n,r,i,s,o,a){return $i({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${ar}/system-metrics/cpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated CPU metrics");return l.json()},enabled:o&&!!t,refetchInterval:da,placeholderData:od})}function Zue(t,e,n,r,i,s,o,a){return $i({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${ar}/vllm-metrics/paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated vLLM metrics");return l.json()},enabled:o&&!!t,refetchInterval:da,placeholderData:od})}function Que(t,e,n,r,i){const s=bx(),o=M.useRef([]),a=t.join("\0"),l=o.current.join("\0");if(a!==l){const c=o.current;if(c.length>0&&t.length<c.length){const d=new Set(c);if(t.every(m=>d.has(m))){const m=["step-metrics-multi",c,e,i],x=s.getQueryData(m);if(x){const b=new Set(t),_=["step-metrics-multi",t,e,i];s.setQueryData(_,{runs:x.runs.filter(S=>b.has(S.run_path))})}}}o.current=t}return $i({queryKey:["step-metrics-multi",t,e,i],queryFn:async()=>{const c={run_paths:t,metric_names:e,limit:1e5};i&&Object.keys(i).length>0&&(c.tag_filters=i);const d=await fetch(`${ar}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw new Error("Failed to fetch step metrics (multi-run)");return d.json()},enabled:n&&t.length>0,refetchInterval:r?da:!1,staleTime:da})}function Fr(t,e,n){return $i({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${ar}/step-times`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t})});if(!r.ok)throw new Error("Failed to fetch step times");return r.json()},enabled:e&&!!t,refetchInterval:n?da:!1})}function $G(t,e,n,r){return $i({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${ar}/step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:[e],limit:1e5})});if(!i.ok)throw new Error("Failed to fetch step metric");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?da:!1,placeholderData:od})}function Jue(t,e,n,r,i,s){return $i({queryKey:["eval-step-metric-single",t,e,n,s??null],queryFn:async()=>{const o={run_path:t,eval_name:e,metric_names:[n],limit:1e5};s!==void 0&&(o.sample_idx=s);const a=await fetch(`${ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error("Failed to fetch eval step metric");return a.json()},enabled:r&&!!t&&!!e&&!!n,refetchInterval:i?da:!1,placeholderData:od})}function ede(t,e,n,r,i){const s=bx(),o=M.useRef([]),a=t.join("\0"),l=o.current.join("\0");if(a!==l){const c=o.current;if(c.length>0&&t.length<c.length){const d=new Set(c);if(t.every(m=>d.has(m))){const m=["eval-step-metrics-multi",c,e,n],x=s.getQueryData(m);if(x){const b=new Set(t),_=["eval-step-metrics-multi",t,e,n];s.setQueryData(_,{runs:x.runs.filter(S=>b.has(S.run_path))})}}}o.current=t}return $i({queryKey:["eval-step-metrics-multi",t,e,n],queryFn:async()=>({runs:await Promise.all(t.map(async d=>{const p=await fetch(`${ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:d,eval_name:e,metric_names:n,limit:1e5})});if(!p.ok)return{run_path:d,metrics:[]};const m=await p.json();return{run_path:d,metrics:m.metrics??[]}}))}),enabled:r&&t.length>0&&!!e&&n.length>0,refetchInterval:i?da:!1,staleTime:da})}function tde(t,e,n,r){return $i({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${ar}/step-histogram`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,metric_type:n})});if(!i.ok)throw new Error("Failed to fetch step histogram");return i.json()},enabled:r&&!!t&&e!==null&&!!n,staleTime:6e4,placeholderData:od})}function qG(t,e,n,r){return $i({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${ar}/step-distribution-over-time`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_type:e,num_bins:10})});if(!i.ok)throw new Error("Failed to fetch step distribution over time");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?da:!1,staleTime:3e4,placeholderData:od})}function XG(){return $i({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${ar}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function nde(){return $i({queryKey:["custom-metrics-templates"],queryFn:async()=>{const t=await fetch(`${ar}/custom-metrics-templates`);if(!t.ok)throw new Error("Failed to fetch custom metrics templates");return t.json()},staleTime:6e4})}function rde(t){return $i({queryKey:["custom-metrics-template",t],queryFn:async()=>{const e=await fetch(`${ar}/custom-metrics-templates/${t}`);if(!e.ok)throw new Error("Failed to fetch template");return e.json()},enabled:!!t,staleTime:6e4})}function J0(t,e){const n=Math.abs(e)<600;return new Date(t*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",...n?{second:"2-digit"}:{},hour12:!1})}function up(t){return`${t.toFixed(0)}s`}function td(t){if(Number.isInteger(t))return t.toLocaleString();const e=Math.abs(t);if(e===0)return"0.0";if(e>=1)return t.toFixed(1);if(e>=.01)return t.toFixed(2);const n=Math.max(2,Math.ceil(-Math.log10(e))+1);return t.toFixed(n)}function YG(t){const e=Math.abs(t);if(e===0)return"0.00";if(e>=1)return t.toFixed(1);if(e>=.01)return t.toFixed(2);const n=Math.max(2,Math.ceil(-Math.log10(e))+1);return t.toFixed(n)}function kT(t){if(t<60)return`${YG(t)}s`;const e=Math.floor(t),n=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return n>0?`${n}h ${r}m`:`${r}m ${i}s`}function fI(t){const e=`${YG(t)}s`;return t<60?e:`${kT(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function qd(t){const e=Math.abs(t);if(e>=3600){const n=t/3600;return`${parseFloat(n.toFixed(1))}h`}if(e>=60){const n=t/60;return`${parseFloat(n.toFixed(1))}m`}return e<.1&&e!==0?`${parseFloat((t*1e3).toFixed(1))}ms`:`${parseFloat(t.toFixed(1))}s`}function rh(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60),r=Math.floor(t%60);return e>0&&n>0&&r>0?`${e}h ${n}m ${r}s`:e>0&&n>0?`${e}h ${n}m`:e>0&&r>0?`${e}h ${r}s`:e>0?`${e}h`:n>0&&r>0?`${n}m ${r}s`:n>0?`${n}m`:`${r}s`}function Z1(t){if(!t)return"";let e=t;/[Zz]|[+-]\d{2}(:\d{2})?$/.test(t)||(e=t+"Z");const n=new Date(e),i=new Date().getTime()-n.getTime(),s=Math.floor(i/(1e3*60)),o=Math.floor(i/(1e3*60*60)),a=Math.floor(i/(1e3*60*60*24)),l=Math.floor(a/30),c=Math.floor(a/365);return c>=1?`${c}y`:l>=1?`${l}mo`:a>=1?`${a}d`:o>=1?`${o}h`:`${Math.max(1,s)}m`}const y1=16,ide=6,hI=4,sde=2;function KG(t,e=y1){const n=Math.max(ide,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(sde,n-hI);return{prefix:t.slice(0,r),suffix:t.slice(-hI),isTruncated:!0}}function Fi({...t}){return f.jsx(_te,{"data-slot":"collapsible",...t})}function Ui({...t}){return f.jsx(Ste,{"data-slot":"collapsible-trigger",...t})}function Bi({...t}){return f.jsx(wte,{"data-slot":"collapsible-content",...t})}function ode(t,e=0){try{return JSON.stringify(t,(r,i)=>i&&typeof i=="object"&&!Array.isArray(i)?Object.keys(i).sort().reduce((s,o)=>(s[o]=i[o],s),{}):i,e)??String(t)}catch{return String(t)}}function ade(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)||typeof e=="object"&&e!==null?e:null}function lde(t){return t==null?"—":typeof t=="boolean"?t?"True":"False":typeof t=="number"?Number.isInteger(t)?t.toLocaleString():Math.abs(t)<.001&&t!==0?t.toExponential(2):t.toLocaleString(void 0,{maximumFractionDigits:6}):typeof t=="object"?ode(t,2):String(t)}function cde(t){if(typeof t!="string")return t;const e=t.trim();if(!e)return t;const n=e.startsWith("{")&&e.endsWith("}"),r=e.startsWith("[")&&e.endsWith("]");if(!n&&!r)return t;try{const i=JSON.parse(e);if(Array.isArray(i)||i&&typeof i=="object")return i}catch{}return t}function pI(t){const e=t.split("/"),n=e[e.length-1],r=n.replace(/^_+/,"");return(r.length>0?r:n).replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function ude(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_")||l==="evals",order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers","evals"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){const d=ade(c),p=l==="environments"?cde(d):d;let m=!1;for(const x of e)if(x.match(l)){n.get(x.key).items.push({key:l,displayKey:pI(l),value:p}),m=!0;break}m||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:pI(l),value:p}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((p,m)=>[p,m]));l.items.sort((p,m)=>{const x=d.get(p.key)??1/0,b=d.get(m.key)??1/0;return x!==b?x-b:p.key.localeCompare(m.key)})}}const i=new Set(["setup/gpu","setup/cpu","setup/memory","setup/disk","setup/network","setup/os","setup/package_versions"]),s=["general","model","ray_cluster","workers","orchestrator","trainer","algorithm","weight_sync","sequence_packing","inference","rollout","checkpoint","logging","evals","vllm_tracing","environments","hardware","other"],o=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&o.push(c)}const a=[];for(const l of s)if(l==="hardware")o.length>0&&a.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:o});else{const c=n.get(l);c&&c.items.length>0&&a.push(c)}return a}function dde({displayKey:t,value:e}){const n=lde(e);return typeof e=="object"&&e!==null?f.jsxs("div",{className:"py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[f.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:t}),f.jsx("pre",{className:"mt-1 text-xs font-sans font-medium rounded-md bg-muted/40 border border-border/40 p-2 whitespace-pre-wrap break-all max-h-72 overflow-auto",children:n})]}):f.jsxs("div",{className:"flex items-baseline gap-2 py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[f.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors whitespace-nowrap",children:t}),f.jsx("span",{className:"text-sm font-sans font-medium break-all",children:n})]})}const fde="ml-[22px]",hde="ml-[38px]";function ZG({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,o]=M.useState(e),[a,l]=M.useState(r),[c,d]=M.useState(i);r!==a&&(l(r),o(!1)),i!==c&&(d(i),o(!0));const p=t.subcategories&&t.subcategories.length>0;return f.jsxs(Fi,{open:s,onOpenChange:o,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",n&&"ml-4"),children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!s&&"-rotate-90")}),f.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),f.jsx(Bi,{children:p?f.jsx("div",{className:"mt-1",children:t.subcategories.map(m=>f.jsx(ZG,{category:m,nested:!0,collapseAllSignal:r,expandAllSignal:i},m.key))}):f.jsx("div",{className:Rt("mt-1",n?hde:fde),children:t.items.map(m=>f.jsx(dde,{displayKey:m.displayKey,value:m.value},m.key))})})]})}function QG({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=M.useMemo(()=>ude(t),[t]),i=new Set(["model","environments"]);return r.length===0?f.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"}):f.jsx("div",{className:"space-y-1",children:r.map(s=>f.jsx(ZG,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const JG="#e67439",pde="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",mde=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function b1(t){return Math.max(0,Math.min(1,t))}function Qg(t){return Math.max(0,Math.min(255,Math.round(t)))}function A2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(Qg(t))}${r(Qg(e))}${r(Qg(n))}`}function D7(t){const e=t.trim(),n=/^#([0-9a-f]{3})$/i.exec(e);if(n){const[i,s,o]=n[1].split("");return{r:Number.parseInt(i+i,16),g:Number.parseInt(s+s,16),b:Number.parseInt(o+o,16)}}const r=/^#([0-9a-f]{6})$/i.exec(e);return r?{r:Number.parseInt(r[1].slice(0,2),16),g:Number.parseInt(r[1].slice(2,4),16),b:Number.parseInt(r[1].slice(4,6),16)}:null}function gde({r:t,g:e,b:n}){const r=t/255,i=e/255,s=n/255,o=Math.max(r,i,s),a=Math.min(r,i,s),l=o-a;let c=0;return l!==0&&(o===r?c=60*((i-s)/l%6):o===i?c=60*((s-r)/l+2):c=60*((r-i)/l+4)),c<0&&(c+=360),{h:c,s:o===0?0:l/o,v:o}}function xde({h:t,s:e,v:n}){const r=(t%360+360)%360,i=b1(e),s=b1(n),o=s*i,a=o*(1-Math.abs(r/60%2-1)),l=s-o;let c=0,d=0,p=0;return r<60?(c=o,d=a):r<120?(c=a,d=o):r<180?(d=o,p=a):r<240?(d=a,p=o):r<300?(c=a,p=o):(c=o,p=a),{r:Qg((c+l)*255),g:Qg((d+l)*255),b:Qg((p+l)*255)}}function vde(t,e){const n=D7(t);if(!n)return"#000000";const r=b1(1-e);return A2({r:n.r*r,g:n.g*r,b:n.b*r})}function N_(t,e=JG){const n=D7(t);return n?A2(n):e}function yde({value:t,onChange:e,className:n}){const r=M.useMemo(()=>N_(t,JG),[t]),i=M.useMemo(()=>D7(r),[r]),s=M.useMemo(()=>gde(i),[i]),[o,a]=M.useState(r.slice(1).toUpperCase());M.useEffect(()=>{a(r.slice(1).toUpperCase())},[r]);const l=M.useCallback(x=>{const b=A2(xde(x));e(b)},[e]),c=M.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=b1((x.clientX-b.left)/b.width),S=b1((x.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-S})},[s.h,l]),d=M.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=b1((x.clientX-b.left)/b.width);l({h:_*360,s:s.s,v:s.v})},[s.s,s.v,l]),p=M.useCallback(()=>{const b=`#${o.replace(/[^0-9a-f]/gi,"")}`,_=N_(b,r);a(_.slice(1).toUpperCase()),_!==r&&e(_)},[o,r,e]),m=M.useCallback((x,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const S={...i,[x]:Qg(_)};e(A2(S))},[e,i]);return f.jsxs("div",{className:Rt("w-[196px] space-y-1.5 text-[10px]",n),children:[f.jsxs("div",{className:"relative h-28 w-full cursor-crosshair overflow-hidden rounded-md border border-border touch-none select-none",style:{backgroundColor:`hsl(${s.h.toFixed(0)} 100% 50%)`},onPointerDown:x=>{x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),c(x)},onPointerMove:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&c(x)},onPointerUp:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId)},children:[f.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-transparent"}),f.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black to-transparent"}),f.jsx("div",{className:"pointer-events-none absolute h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`${s.s*100}%`,top:`${(1-s.v)*100}%`}})]}),f.jsx("div",{className:"relative h-2 w-full cursor-ew-resize rounded-md border border-border touch-none select-none",style:{background:pde},onPointerDown:x=>{x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),d(x)},onPointerMove:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&d(x)},onPointerUp:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId)},children:f.jsx("div",{className:"pointer-events-none absolute top-1/2 h-2.5 w-1.5 -translate-y-1/2 rounded border border-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:`calc(${s.h/360*100}% - 3px)`}})}),f.jsxs("div",{className:"grid grid-cols-[1fr_48px] items-end gap-1",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:"Hex"}),f.jsx(cp,{value:o,onChange:x=>{a(x.target.value.replace(/[^0-9a-f]/gi,"").slice(0,6).toUpperCase())},onBlur:p,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),p())},className:"h-6 px-1.5 font-sans !text-[11px] md:!text-[11px] uppercase","aria-label":"Hex color"})]}),f.jsx("div",{className:"h-6 rounded-md border border-border",style:{backgroundColor:r},"aria-label":"Selected color preview"})]}),f.jsx("div",{className:"grid grid-cols-3 gap-1",children:[["R",i.r,"r"],["G",i.g,"g"],["B",i.b,"b"]].map(([x,b,_])=>f.jsxs("div",{className:"space-y-0.5",children:[f.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:x}),f.jsx(cp,{type:"number",min:0,max:255,value:b,onChange:S=>m(_,S.target.value),className:"h-6 px-1.5 !text-[11px] md:!text-[11px]","aria-label":`${x} channel`})]},x))}),f.jsx("div",{className:"grid grid-cols-8 gap-x-0.5 gap-y-1.5 pt-0.5",children:mde.map(x=>f.jsx("button",{type:"button",className:Rt("h-4 w-4 rounded-[3px] border transition",r===x?"ring-1 ring-foreground/70 ring-offset-0":"hover:brightness-[0.97]"),style:{backgroundColor:x,borderColor:vde(x,.2)},onClick:()=>e(x),"aria-label":`Use color ${x}`},x))})]})}const eW=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],bde=eW.map(t=>t.key);function _de(t){return bde.indexOf(t)}function rA(t){return t>=1024**3?`${(t/1024**3).toFixed(2)} GB`:t>=1024**2?`${(t/1024**2).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(0)} KB`:`${t} B`}function Sde({open:t,onOpenChange:e}){const[n,r]=M.useState(null),[i,s]=M.useState(!1),[o,a]=M.useState(null),l=M.useRef(null),c=o!=null&&o.status!=="idle"&&o.status!=="done"&&o.status!=="error",d=M.useCallback(async()=>{s(!0);try{const w=await fetch(`${ar}/database-info`);if(w.ok){const C=await w.json();r(C.size_bytes)}}catch{}finally{s(!1)}},[]);M.useEffect(()=>(t&&(d(),a(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,d]);const p=async()=>{try{const w=await fetch(`${ar}/compact-database`,{method:"POST"});if(!w.ok){const C=await w.json().catch(()=>({}));a({status:"error",error:C.detail||"Failed to start compaction",size_before:null,size_after:null});return}a({status:"pausing_syncs",error:null,size_before:null,size_after:null}),l.current=setInterval(async()=>{try{const C=await fetch(`${ar}/compact-database/status`);if(C.ok){const A=await C.json();a(A),(A.status==="done"||A.status==="error")&&(l.current&&clearInterval(l.current),l.current=null,A.status==="done"&&A.size_after!=null&&r(A.size_after))}}catch{}},500)}catch(w){a({status:"error",error:w instanceof Error?w.message:"Unknown error",size_before:null,size_after:null})}},m=w=>{c&&!w||e(w)},x=o?_de(o.status):-1,b=(o==null?void 0:o.status)==="done",_=(o==null?void 0:o.status)==="error",S=o!=null&&o.status!=="idle";return f.jsx(qu,{open:t,onOpenChange:m,children:f.jsxs(Xu,{className:Rt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:w=>{c&&w.preventDefault()},onEscapeKeyDown:w=>{c&&w.preventDefault()},children:[f.jsxs(Zc,{children:[f.jsxs(Qc,{className:"flex items-center gap-2",children:[f.jsx(Zce,{className:"h-4 w-4"}),"Database"]}),!S&&f.jsx(jg,{children:"Manage your local database storage."})]}),!S&&f.jsxs("div",{className:"space-y-4 py-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Database size"}),f.jsx("span",{className:"text-sm font-medium",children:i?f.jsx(hl,{className:"h-3.5 w-3.5"}):n!=null?rA(n):"—"})]}),f.jsx("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:f.jsx("p",{className:"text-xs text-muted-foreground",children:"Compressing rewrites the database to reclaim unused space and apply optimal compression. This can reduce the file size by 20–30% depending on the data. Syncs will be paused during compression."})})]}),S&&f.jsxs("div",{className:"space-y-3 py-2",children:[eW.map((w,C)=>{const A=w.key===o.status,N=b||x>C||_&&x>C,D=_&&w.key===o.status;return f.jsxs("div",{className:"flex items-center gap-2.5",children:[N?f.jsx($ce,{className:"h-4 w-4 text-green-500 shrink-0"}):D?f.jsx(Xce,{className:"h-4 w-4 text-destructive shrink-0"}):A?f.jsx(hl,{className:"h-4 w-4 text-primary shrink-0"}):f.jsx("div",{className:"h-4 w-4 rounded-full border border-border shrink-0"}),f.jsxs("span",{className:Rt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",D&&"text-destructive font-medium",!N&&!A&&!D&&"text-muted-foreground/60"),children:[w.label,A&&!b&&!_&&"…"]})]},w.key)}),c&&f.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"Do not close the application while compressing."}),b&&o.size_before!=null&&o.size_after!=null&&f.jsx("div",{className:"rounded-md border border-green-500/20 bg-green-500/5 p-3 mt-2",children:f.jsxs("p",{className:"text-sm text-foreground",children:[f.jsx("span",{className:"font-medium",children:rA(o.size_before)})," → ",f.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:rA(o.size_after)}),f.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-o.size_after/o.size_before)*100),"% reduction)"]})]})}),_&&o.error&&f.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 p-3 mt-2",children:[f.jsx("p",{className:"text-sm text-destructive",children:o.error}),f.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),f.jsxs(ET,{children:[!S&&f.jsx(Mn,{onClick:p,disabled:i||n==null,children:"Compress Database"}),(b||_)&&f.jsx(Mn,{onClick:()=>e(!1),children:"Close"})]})]})})}function i4({name:t,className:e,maxChars:n=y1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:o}=KG(t,n);return i?f.jsxs(wx,{delayDuration:300,children:[f.jsx(Mx,{asChild:!0,children:f.jsxs("span",{className:Rt("flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",r),children:[f.jsx("span",{className:"shrink-0",children:s}),f.jsxs("span",{className:"relative shrink-0 inline-flex items-center px-0.5 text-muted-foreground/50",style:{backgroundColor:"var(--run-item-bg)"},children:[f.jsx("span",{className:"pointer-events-none absolute inset-y-0 -left-3 w-3",style:{background:"linear-gradient(to right, transparent, var(--run-item-bg))"},"aria-hidden":"true"}),"..."]}),f.jsx("span",{className:"shrink-0",children:o})]})}),f.jsx(Tx,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):f.jsx("span",{className:Rt("truncate",r),children:s})}function wde(){const{pathname:t}=hh(),e=bx(),[n,r]=dn(xl),[i,s]=dn(yT),[o,a]=dn(MG),[l,c]=dn(TG),[d,p]=dn(No),m=$d(ST),x=$d(NG),[b,_]=M.useState(!1),[S,w]=dn(CG),[C,A]=M.useState(""),[N,D]=M.useState(!1),[P,O]=M.useState(null),[R,L]=M.useState(null),[V,F]=M.useState(!1),[U,W]=M.useState(""),[Y,$]=M.useState(!1),[X,Z]=M.useState(!1),[K,ne]=M.useState(null),[H,B]=M.useState(null),[G,j]=M.useState("removed_at"),[ie,ce]=M.useState("desc"),[te,se]=M.useState(null),[le,re]=M.useState(null),[pe,be]=M.useState(null),[xe,Pe]=M.useState(null),[me,ke]=M.useState(!1),[we,Te]=M.useState(""),[oe,_e]=M.useState(null),[Fe,Ue]=M.useState(!1),[Oe,ue]=M.useState(null),[Q,fe]=M.useState({}),Se=$d(AG),Ae=$d(EG),{data:ve,isLoading:qe}=ym(),{data:Ee,isLoading:Ce}=Fue(b),{data:Ye,refetch:Ze}=Uue(S),it=M.useRef(new Map);M.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Be=it.current,Qe=[];for(const ht of ve.runs){const It=Be.get(ht.run_id);It!=null&&It.is_syncing&&!ht.is_syncing&&Qe.push(ht.run_id),It!=null&&It.is_tracking&&!ht.is_tracking&&Qe.push(ht.run_id),Be.set(ht.run_id,{is_syncing:ht.is_syncing,is_tracking:ht.is_tracking})}if(Qe.length>0){const ht=[...new Set(Qe)];for(const It of ht)e.invalidateQueries({predicate:Tt=>{const ct=Tt.queryKey;return Array.isArray(ct)?ct.some(Ut=>!!(Ut===It||Array.isArray(Ut)&&Ut.includes(It))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[ve==null?void 0:ve.runs,e]),M.useEffect(()=>{if(!(ve!=null&&ve.runs)||!n)return;const Be=ve.runs.find(Qe=>Qe.run_id===n);Be&&(Se(Be.is_syncing),Ae(Be.is_tracking))},[ve==null?void 0:ve.runs,n,Se,Ae]),M.useEffect(()=>{t!=="/"&&x(!1)},[t,x]),M.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Be=new Set(ve.runs.map(Qe=>Qe.run_id));s(Qe=>{const ht=Qe.filter(It=>Be.has(It));return ht.length===Qe.length?Qe:ht}),n&&!Be.has(n)&&(r(null),Se(!1),Ae(!1))},[ve==null?void 0:ve.runs,n,r,s,Se,Ae]);const ut=M.useMemo(()=>{const Be=(Ee==null?void 0:Ee.runs)??[];return Be.length===0?Be:[...Be].sort((Qe,ht)=>{const It=G;let Tt,ct;if(It==="run_id"?(Tt=Qe.run_id.split("/").pop()??Qe.run_id,ct=ht.run_id.split("/").pop()??ht.run_id):(Tt=Qe[It],ct=ht[It]),Tt==null&&ct==null)return 0;if(Tt==null)return 1;if(ct==null)return-1;const Ut=Tt.localeCompare(ct);return ie==="asc"?Ut:-Ut})},[Ee==null?void 0:Ee.runs,G,ie]),De=Be=>{G===Be?ce(Qe=>Qe==="asc"?"desc":"asc"):(j(Be),ce("asc"))},Ve=async Be=>{Be.preventDefault();const Qe=Y?{use_netrc:!0}:{api_key:U.trim(),use_netrc:!1};if(!(!Y&&!U.trim())){Z(!0);try{const ht=await fetch(`${ar}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qe)});if(!ht.ok){const It=await ht.json();throw new Error(It.detail||"Failed to configure W&B")}a(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),W("")}catch(ht){console.error("Failed to configure W&B:",ht)}finally{Z(!1)}}},lt=Be=>{_(!1),r(Be),fetch(`${ar}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})}).then(Qe=>{if(!Qe.ok)return Qe.json().then(ht=>{throw new Error(ht.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(Qe=>{console.error("Failed to add run:",Qe)})},Le=async()=>{const Be=C.trim();if(Be){D(!0),O(null);try{const Qe=await fetch(`${ar}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Be})});if(!Qe.ok){const ht=await Qe.json();O(ht.detail||"Failed to add project");return}A(""),w(!1),Ze(),e.invalidateQueries({queryKey:["runs"]})}catch{O("Failed to add project")}finally{D(!1)}}},Ne=async Be=>{L(Be);try{const Qe=await fetch(`${ar}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Be})});if(!Qe.ok){const ht=await Qe.json();throw new Error(ht.detail||"Failed to remove project")}Ze()}catch(Qe){console.error("Failed to remove project:",Qe)}finally{L(null)}},$e=async Be=>{if(Be){ne(Be);try{const Qe=await fetch(`${ar}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})});if(!Qe.ok){const ht=await Qe.json();throw new Error(ht.detail||"Failed to remove run")}s(ht=>ht.filter(It=>It!==Be)),n===Be&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(Qe){console.error("Failed to remove run:",Qe)}finally{ne(null),B(null)}}},ft=Be=>{s(Qe=>Qe.includes(Be)?Qe.filter(ht=>ht!==Be):[...Qe,Be])},nt=M.useCallback((Be,Qe)=>{e.setQueryData(["runs"],ht=>ht&&{...ht,runs:ht.runs.map(It=>It.run_id===Be?{...It,color:Qe}:It)})},[e]),We=M.useCallback(async(Be,Qe,ht)=>{const It=N_(Qe,ht);if(It.toLowerCase()!==ht.toLowerCase()){nt(Be,It);try{const Tt=await fetch(`${ar}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be,color:It})});if(!Tt.ok){let ct="Failed to update run color";try{ct=(await Tt.json()).detail??ct}catch{}throw new Error(ct)}}catch(Tt){console.error("Failed to update run color:",Tt),nt(Be,ht)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,nt]),Ke=M.useCallback((Be,Qe,ht)=>{if(Qe){ue(Be),fe(Tt=>Tt[Be]===ht?Tt:{...Tt,[Be]:ht});return}ue(Tt=>Tt===Be?null:Tt);const It=Q[Be];It&&We(Be,It,ht),fe(Tt=>{if(!(Be in Tt))return Tt;const ct={...Tt};return delete ct[Be],ct})},[We,Q]),je=M.useCallback(async Be=>{be(Be);try{const Qe=ve==null?void 0:ve.runs.find(It=>It.run_id===Be);Qe!=null&&Qe.is_tracking&&await fetch(`${ar}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})});const ht=await fetch(`${ar}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})});if(!ht.ok){const It=await ht.json();throw new Error(It.detail||"Failed to delete run data")}await fetch(`${ar}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})}),e.invalidateQueries({queryKey:["run-summary",Be]}),e.invalidateQueries({queryKey:["runs"]})}catch(Qe){console.error("Failed to force full resync:",Qe)}finally{be(null),re(null)}},[ve==null?void 0:ve.runs,e]),et=M.useCallback(async Be=>{Pe(Be);try{const Qe=await fetch(`${ar}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Be})});if(!Qe.ok){const ht=await Qe.json();throw new Error(ht.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",Be]}),e.invalidateQueries({queryKey:["runs"]})}catch(Qe){console.error("Failed to sync evals after training:",Qe)}finally{Pe(null)}},[e]),pt=we.trimStart().toLowerCase().startsWith("config:"),Lt=M.useCallback(async()=>{const Qe=we.trimStart().slice(7).trim();if(Qe){Ue(!0);try{const ht=await fetch(`${ar}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:Qe})});if(!ht.ok){_e([]);return}const It=await ht.json();_e(It.run_ids??[])}catch{_e([])}finally{Ue(!1)}}},[we]);M.useEffect(()=>{pt||_e(null)},[pt]);const wt=(ve==null?void 0:ve.runs)||[],yt=ve==null?void 0:ve.discovery,Pt=(ve==null?void 0:ve.has_wandb_key)??o,zt=(ve==null?void 0:ve.has_netrc_wandb_key)??!1,Dt=(ve==null?void 0:ve.wandb_key_source)??"unconfigured";M.useEffect(()=>{l&&$(Dt==="netrc")},[l,Dt]);const Et=[{title:"Overview",href:"/",isActive:t==="/"},{title:"Metrics",href:"/metrics",isActive:t==="/metrics"},{title:"Rollouts",href:"/rollouts",isActive:t==="/rollouts"},{title:"Rollouts Discarded",href:"/rollouts-discarded",isActive:t==="/rollouts-discarded"},{title:"Timeline",href:"/timeline",isActive:t==="/timeline"},{title:"Infra",href:"/infra",isActive:t==="/infra"},{title:"Evals",href:"/evals",isActive:t==="/evals"}];return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-col h-screen w-56 shrink-0 border-r border-sidebar-border bg-sidebar text-sidebar-foreground fixed left-0 top-0",children:[f.jsxs("div",{className:"py-2.5 px-4 border-b border-sidebar-border shrink-0 flex items-center justify-between",children:[f.jsx(QM,{to:"/about",className:"flex items-center h-7 hover:opacity-80 transition-opacity",children:f.jsx("img",{src:d?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-5"})}),f.jsx("button",{onClick:()=>p(Be=>!Be),className:"text-sidebar-foreground/60 hover:text-sidebar-foreground transition-colors","aria-label":"Toggle dark mode",children:d?f.jsx(fue,{className:"h-4 w-4"}):f.jsx(Sue,{className:"h-4 w-4"})})]}),f.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:Et.map(Be=>f.jsx(QM,{to:Be.href,onClick:()=>{Be.href==="/"&&x(!1)},className:Rt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Be.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:Be.title},Be.href))}),f.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[f.jsxs("div",{className:"px-2 py-2 shrink-0 flex items-center gap-1",children:[f.jsxs("div",{className:"relative flex-1 min-w-0",children:[f.jsx(cp,{type:"text",placeholder:"Search runs…",value:we,onChange:Be=>Te(Be.target.value),onKeyDown:Be=>{Be.key==="Enter"&&pt&&(Be.preventDefault(),Lt())},className:Rt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",pt&&"pr-10")}),pt&&f.jsx(Mn,{variant:"default",size:"sm",className:"absolute right-0.5 top-1/2 -translate-y-1/2 h-4 px-1.5 text-[9px] rounded-sm",onClick:Lt,disabled:Fe,children:Fe?f.jsx(hl,{className:"h-2.5 w-2.5"}):"Go"})]}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:f.jsx(JN,{className:"h-3.5 w-3.5"})})}),f.jsxs(ua,{align:"end",className:"w-48",children:[f.jsx(ra,{className:"text-xs",onClick:()=>w(!0),children:"Add Project"}),f.jsx(ra,{className:"text-xs",onClick:()=>_(!0),children:"Add Run"}),f.jsxs(ra,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",Pt?f.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):f.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),f.jsx(aa,{}),f.jsx(ra,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),f.jsxs(ra,{className:"text-xs flex items-center justify-between",onClick:()=>ke(Be=>!Be),children:["Only Show Selected",f.jsx(vm,{className:Rt("h-3.5 w-3.5",me?"opacity-100":"opacity-0")})]}),f.jsx(aa,{}),f.jsx(ra,{className:"text-xs flex items-center gap-1.5",onClick:()=>F(!0),children:"Database"})]})]})]}),(yt==null?void 0:yt.status)==="discovering"?f.jsx("div",{className:"px-4 pb-2 shrink-0",children:f.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted/50 px-2.5 py-2",children:[f.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Fetching runs from W&B…"}),f.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[f.jsx(hl,{className:"h-3 w-3 shrink-0"}),(yt==null?void 0:yt.runs_found)??0," found"]}),f.jsx("span",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Looking for telescope-tagged runs…"})]})}):null,f.jsx(Ex,{className:"flex-1 min-h-0 overflow-hidden",children:f.jsx("div",{className:"px-2 pb-2",children:qe?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(hl,{className:"h-4 w-4"})}):f.jsxs("div",{className:"flex flex-col",children:[wt.filter(Be=>{if(me&&n!==Be.run_id&&!i.includes(Be.run_id))return!1;if(pt){if(oe!==null&&!oe.includes(Be.run_id))return!1}else if(we.trim()){const Qe=we.trim().toLowerCase(),ht=(Be.name||"").toLowerCase(),It=Be.run_id.toLowerCase();if(!ht.includes(Qe)&&!It.includes(Qe))return!1}return!0}).map(Be=>{const Qe=n===Be.run_id,ht=Qe||i.includes(Be.run_id),It=Q[Be.run_id],Tt=N_(It??Be.color,Be.color),ct=Be.last_rollout_step===-1&&!Be.is_syncing&&!Be.is_tracking,Ut=Number(Be.is_tracking)+Number(Be.is_syncing),Gt=Ut>=2?y1-4:Ut===1?y1-2:y1-1,sn=Be.name||Be.run_id.split("/").pop()||Be.run_id;return f.jsxs("div",{className:Rt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!Qe&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",Qe&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r(Be.run_id),onMouseEnter:()=>{ht&&m(Be.run_id)},onMouseLeave:()=>m(null),children:[f.jsx("button",{onClick:nn=>{nn.stopPropagation(),Qe||ft(Be.run_id)},disabled:Qe,className:Rt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",ht?"bg-foreground border-foreground":"border-muted-foreground/50",Qe&&"opacity-50 cursor-not-allowed"),children:ht&&f.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",className:"text-background",children:f.jsx("path",{d:"M1 4L3 6L7 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),f.jsxs(AT,{open:Oe===Be.run_id,onOpenChange:nn=>Ke(Be.run_id,nn,Be.color),children:[f.jsx(NT,{asChild:!0,children:f.jsx("button",{type:"button",className:"w-2.5 h-2.5 rounded-full shrink-0 focus:outline-none focus:ring-1 focus:ring-ring",style:{backgroundColor:Tt},onClick:nn=>nn.stopPropagation(),"aria-label":`Change color for ${sn}`})}),f.jsx(RT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:nn=>nn.stopPropagation(),onOpenAutoFocus:nn=>nn.preventDefault(),children:f.jsx(yde,{value:Tt,onChange:nn=>{fe(En=>({...En,[Be.run_id]:N_(nn,Be.color)}))}})})]}),f.jsx("div",{className:Rt("flex-1 min-w-0 text-left",ct&&"text-muted-foreground/60"),children:f.jsx(i4,{name:sn,maxChars:Gt})}),Be.is_tracking&&f.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),Be.is_syncing&&f.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),f.jsxs("div",{className:"ml-auto relative h-6 w-6 flex items-center justify-center",children:[f.jsx("span",{className:"absolute text-[10px] text-muted-foreground transition-opacity group-hover:opacity-0",children:Z1(Be.created_at)}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx(Mn,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:K===Be.run_id,onClick:nn=>nn.stopPropagation(),children:f.jsx(JN,{className:"h-3.5 w-3.5"})})}),f.jsxs(ua,{align:"end",className:"w-auto",children:[f.jsx(K1,{className:"text-xs font-normal",children:f.jsx("span",{className:"font-sans",children:Be.run_id})}),f.jsx(aa,{}),f.jsx(ra,{disabled:pe===Be.run_id,onClick:nn=>{nn.stopPropagation(),re(Be.run_id)},children:pe===Be.run_id?"Resyncing...":"Force Full Resync"}),f.jsx(ra,{disabled:xe===Be.run_id,onClick:nn=>{nn.stopPropagation(),et(Be.run_id)},children:xe===Be.run_id?"Syncing evals...":"Sync Evals After Training"}),f.jsx(ra,{className:"text-destructive",disabled:K===Be.run_id,onClick:nn=>{nn.stopPropagation(),B(Be.run_id)},children:"Remove"})]})]})]})]},Be.run_id)}),wt.length===0&&f.jsx("div",{className:"text-center py-4 px-2",children:Pt?f.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"}):f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs text-muted-foreground",children:"No wandb key added yet"}),f.jsx(Mn,{size:"sm",className:"h-6 px-2 text-[11px] bg-green-600 hover:bg-green-700",onClick:()=>c(!0),children:"Add wandb key"})]})})]})})})]})]}),f.jsx(qu,{open:l,onOpenChange:c,children:f.jsxs(Xu,{className:"sm:max-w-md",children:[f.jsxs(Zc,{children:[f.jsx(Qc,{children:"Configure W&B"}),f.jsx(jg,{children:Y?f.jsxs(f.Fragment,{children:["Use the API key saved by"," ",f.jsx("span",{className:"font-sans",children:"wandb login"})," to fetch all runs tagged ",f.jsx("span",{className:"font-sans",children:"telescope"}),"."]}):f.jsxs(f.Fragment,{children:["Paste your W&B API key to fetch all runs tagged"," ",f.jsx("span",{className:"font-sans",children:"telescope"}),"."]})})]}),f.jsxs("form",{onSubmit:Ve,children:[f.jsxs("div",{className:"space-y-4 py-4",children:[f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[f.jsx("input",{type:"checkbox",checked:Y,onChange:Be=>$(Be.target.checked),className:"accent-primary h-3.5 w-3.5"}),f.jsxs("span",{className:"text-sm",children:["Use key from"," ",f.jsx("span",{className:"font-sans text-xs",children:"wandb login"})]}),Y&&!zt&&f.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",f.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),Y&&zt&&f.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!Y&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Iue,{htmlFor:"config-api-key",children:"W&B API Key"}),Pt&&Dt==="custom"?f.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Key added"}):f.jsx("span",{className:"text-[11px] text-red-500 font-medium",children:"No key configured"})]}),f.jsx(cp,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:U,onChange:Be=>W(Be.target.value),required:!0})]})]}),f.jsxs(ET,{children:[f.jsx(Mn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),f.jsx(Mn,{type:"submit",disabled:X||(Y?!zt:!U.trim()),children:X?f.jsxs(f.Fragment,{children:[f.jsx(hl,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),f.jsx(qu,{open:b,onOpenChange:_,children:f.jsxs(Xu,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:Be=>{Be.preventDefault();const Qe=Be.currentTarget;Qe==null||Qe.focus()},children:[f.jsxs(Zc,{className:"pb-3",children:[f.jsx(Qc,{children:"Add Run"}),f.jsx(jg,{children:"Select a removed run to add it back. Uses the stored W&B API key."})]}),f.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[f.jsxs("div",{className:"sticky top-0 z-10 bg-background grid grid-cols-[12px_1fr_80px_100px_90px_76px_56px_44px] gap-2 items-center pb-1.5 border-b border-border px-3",children:[f.jsx("div",{}),[{key:"name",label:"Name",cls:""},{key:"entity",label:"Entity",cls:""},{key:"project",label:"Project",cls:""},{key:"run_id",label:"Run ID",cls:""},{key:"created_at",label:"Created",cls:""},{key:"removed_at",label:"Removed",cls:"justify-center"}].map(Be=>f.jsxs("button",{className:Rt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",Be.cls),onClick:()=>De(Be.key),children:[Be.label,G===Be.key&&(ie==="asc"?f.jsx(Oce,{className:"h-2.5 w-2.5"}):f.jsx(Rce,{className:"h-2.5 w-2.5"}))]},Be.key)),f.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),f.jsx("div",{className:"py-1",children:Ce?f.jsx("div",{className:"flex items-center justify-center py-6",children:f.jsx(hl,{className:"h-4 w-4"})}):f.jsxs(f.Fragment,{children:[ut.map(Be=>{const Qe=Be.run_id.split("/").pop()??Be.run_id;return f.jsxs("div",{className:"w-full grid grid-cols-[12px_1fr_80px_100px_90px_76px_56px_44px] gap-2 items-center rounded-md px-3 py-1.5 text-left hover:bg-muted transition-colors group/row [--run-item-bg:var(--background)] hover:[--run-item-bg:var(--muted)]",children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-full cursor-pointer",style:{backgroundColor:Be.color??"#888"},onClick:()=>lt(Be.run_id)}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>lt(Be.run_id),children:f.jsx(i4,{name:Be.name??"Unnamed"})}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>lt(Be.run_id),children:f.jsx(i4,{name:Be.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>lt(Be.run_id),children:f.jsx(i4,{name:Be.project??"—",className:"text-xs font-sans text-muted-foreground"})}),f.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>lt(Be.run_id),children:Qe}),f.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>lt(Be.run_id),children:Be.created_at?new Date(Be.created_at).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"}):"—"}),f.jsx("span",{className:"text-[10px] text-red-400 whitespace-nowrap text-center cursor-pointer",onClick:()=>lt(Be.run_id),children:Be.removed_at?Z1(Be.removed_at):"—"}),f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:ht=>{ht.stopPropagation(),se(Be)},disabled:!Be.config,children:"View"})]},Be.run_id)}),ut.length===0&&f.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),f.jsx(qu,{open:S,onOpenChange:w,children:f.jsxs(Xu,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[f.jsxs(Zc,{className:"pb-3",children:[f.jsx(Qc,{children:"Known Projects"}),f.jsx(jg,{children:"Projects polled for new telescope-tagged runs. Add an entity/project pair to start discovering runs from it."})]}),f.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[f.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[f.jsxs("div",{className:"flex gap-2",children:[f.jsx(cp,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:C,onChange:Be=>{A(Be.target.value),P&&O(null)},onKeyDown:Be=>{Be.key==="Enter"&&Le()}}),f.jsx(Mn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:Le,disabled:N||!C.trim(),children:N?f.jsx(hl,{className:"h-3 w-3"}):"Ok"})]}),P&&f.jsx("span",{className:"text-[11px] text-red-500",children:P})]}),f.jsxs("div",{className:"space-y-1",children:[Ye==null?void 0:Ye.projects.map(Be=>f.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-1.5 hover:bg-muted transition-colors group",children:[f.jsxs("div",{className:"flex flex-col min-w-0",children:[f.jsx("span",{className:"text-xs font-mono truncate",children:Be.project}),f.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Be.source==="user"?"User-added":"From existing runs",Be.added_at&&` · ${new Date(Be.added_at).toLocaleDateString()}`]})]}),Be.source==="user"&&f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>Ne(Be.project),disabled:R===Be.project,children:R===Be.project?f.jsx(hl,{className:"h-3 w-3"}):f.jsx(Mue,{className:"h-3 w-3"})})]},Be.project)),(Ye==null?void 0:Ye.projects.length)===0&&f.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No known projects. Add a W&B API key and sync runs, or add a project manually above."})]})]})]})}),f.jsx(qu,{open:!!te,onOpenChange:Be=>{Be||se(null)},children:f.jsxs(Xu,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[f.jsxs(Zc,{children:[f.jsxs(Qc,{className:"flex items-center gap-2",children:[(te==null?void 0:te.color)&&f.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:te.color}}),"Configuration —"," ",(te==null?void 0:te.name)??(te==null?void 0:te.run_id.split("/").pop())]}),f.jsx(jg,{children:te==null?void 0:te.run_id})]}),f.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:te!=null&&te.config?f.jsx(QG,{config:te.config}):f.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),f.jsx(m2,{open:!!H,onOpenChange:Be=>{Be||B(null)},children:f.jsxs(g2,{children:[f.jsxs(x2,{children:[f.jsx(y2,{children:"Remove run locally?"}),f.jsx(b2,{children:"All the data of this run will be removed from your local database. It will not be removed from W&B, your data is safe in W&B and you can add it again locally if you want."})]}),f.jsxs(v2,{children:[f.jsx(S2,{children:"Cancel"}),f.jsx(_2,{onClick:()=>{H&&$e(H)},children:"Remove"})]})]})}),f.jsx(m2,{open:!!le,onOpenChange:Be=>{Be||re(null)},children:f.jsxs(g2,{children:[f.jsxs(x2,{children:[f.jsx(zue,{className:"bg-destructive/10",children:f.jsx(Cue,{className:"text-destructive"})}),f.jsx(y2,{children:"Force Full Resync"}),f.jsx(b2,{children:"This will stop tracking (if active), delete all data for this run from the database, and then sync all data again from scratch. This action cannot be undone."})]}),f.jsxs(v2,{children:[f.jsx(S2,{children:"Cancel"}),f.jsx(_2,{variant:"destructive",onClick:()=>{le&&je(le)},children:"Yes, Delete & Resync"})]})]})}),f.jsx(Sde,{open:V,onOpenChange:F})]})}function Mde(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return M.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const DT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Cy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function P7(t){return"nodeType"in t}function Rc(t){var e,n;return t?Cy(t)?t:P7(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function I7(t){const{Document:e}=Rc(t);return t instanceof e}function fw(t){return Cy(t)?!1:t instanceof Rc(t).HTMLElement}function tW(t){return t instanceof Rc(t).SVGElement}function Ey(t){return t?Cy(t)?t.document:P7(t)?I7(t)?t:fw(t)||tW(t)?t.ownerDocument:document:document:document}const ah=DT?M.useLayoutEffect:M.useEffect;function O7(t){const e=M.useRef(t);return ah(()=>{e.current=t}),M.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Tde(){const t=M.useRef(null),e=M.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=M.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function aS(t,e){e===void 0&&(e=[t]);const n=M.useRef(t);return ah(()=>{n.current!==t&&(n.current=t)},e),n}function hw(t,e){const n=M.useRef();return M.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function N2(t){const e=O7(t),n=M.useRef(null),r=M.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function eR(t){const e=M.useRef();return M.useEffect(()=>{e.current=t},[t]),e.current}let iA={};function pw(t,e){return M.useMemo(()=>{if(e)return e;const n=iA[t]==null?0:iA[t]+1;return iA[t]=n,t+"-"+n},[t,e])}function nW(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const d=s[l];d!=null&&(s[l]=d+t*c)}return s},{...e})}}const _1=nW(1),lS=nW(-1);function Cde(t){return"clientX"in t&&"clientY"in t}function L7(t){if(!t)return!1;const{KeyboardEvent:e}=Rc(t.target);return e&&t instanceof e}function Ede(t){if(!t)return!1;const{TouchEvent:e}=Rc(t.target);return e&&t instanceof e}function tR(t){if(Ede(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Cde(t)?{x:t.clientX,y:t.clientY}:null}const Q1=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Q1.Translate.toString(t),Q1.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),mI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ade(t){return t.matches(mI)?t:t.querySelector(mI)}const Nde={display:"none"};function Rde(t){let{id:e,value:n}=t;return ei.createElement("div",{id:e,style:Nde},n)}function kde(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ei.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Dde(){const[t,e]=M.useState("");return{announce:M.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const rW=M.createContext(null);function Pde(t){const e=M.useContext(rW);M.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Ide(){const[t]=M.useState(()=>new Set),e=M.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[M.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const Ode={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},Lde={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function jde(t){let{announcements:e=Lde,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ode}=t;const{announce:s,announcement:o}=Dde(),a=pw("DndLiveRegion"),[l,c]=M.useState(!1);if(M.useEffect(()=>{c(!0)},[]),Pde(M.useMemo(()=>({onDragStart(p){let{active:m}=p;s(e.onDragStart({active:m}))},onDragMove(p){let{active:m,over:x}=p;e.onDragMove&&s(e.onDragMove({active:m,over:x}))},onDragOver(p){let{active:m,over:x}=p;s(e.onDragOver({active:m,over:x}))},onDragEnd(p){let{active:m,over:x}=p;s(e.onDragEnd({active:m,over:x}))},onDragCancel(p){let{active:m,over:x}=p;s(e.onDragCancel({active:m,over:x}))}}),[s,e])),!l)return null;const d=ei.createElement(ei.Fragment,null,ei.createElement(Rde,{id:r,value:i.draggable}),ei.createElement(kde,{id:a,announcement:o}));return n?Wd.createPortal(d,n):d}var sa;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(sa||(sa={}));function R2(){}function Zf(t,e){return M.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function cS(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return M.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const ef=Object.freeze({x:0,y:0});function iW(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function sW(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function zde(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function gI(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function oW(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function xI(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const uS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=xI(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=iW(xI(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(sW)},Fde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=gI(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=gI(l),d=i.reduce((m,x,b)=>m+iW(c[b],x),0),p=Number((d/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:p}})}}return s.sort(sW)};function Ude(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=i-r,a=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,d=o*a,p=d/(l+c-d);return Number(p.toFixed(4))}return 0}const Bde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:o}=s,a=n.get(o);if(a){const l=Ude(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(zde)};function Hde(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function aW(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:ef}function Vde(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const Gde=Vde(1);function Wde(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function $de(t,e,n){const r=Wde(e);if(!r)return t;const{scaleX:i,scaleY:s,x:o,y:a}=r,l=t.left-o-(1-i)*parseFloat(n),c=t.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,p=s?t.height/s:t.height;return{width:d,height:p,top:c,right:l+d,bottom:c+p,left:l}}const qde={ignoreTransform:!1};function Ay(t,e){e===void 0&&(e=qde);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Rc(t).getComputedStyle(t);c&&(n=$de(n,c,d))}const{top:r,left:i,width:s,height:o,bottom:a,right:l}=n;return{top:r,left:i,width:s,height:o,bottom:a,right:l}}function vI(t){return Ay(t,{ignoreTransform:!0})}function Xde(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Yde(t,e){return e===void 0&&(e=Rc(t).getComputedStyle(t)),e.position==="fixed"}function Kde(t,e){e===void 0&&(e=Rc(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=e[i];return typeof s=="string"?n.test(s):!1})}function PT(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(I7(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fw(i)||tW(i)||n.includes(i))return n;const s=Rc(t).getComputedStyle(i);return i!==t&&Kde(i,s)&&n.push(i),Yde(i,s)?n:r(i.parentNode)}return t?r(t):n}function lW(t){const[e]=PT(t,1);return e??null}function sA(t){return!DT||!t?null:Cy(t)?t:P7(t)?I7(t)||t===Ey(t).scrollingElement?window:fw(t)?t:null:null}function cW(t){return Cy(t)?t.scrollX:t.scrollLeft}function uW(t){return Cy(t)?t.scrollY:t.scrollTop}function nR(t){return{x:cW(t),y:uW(t)}}var Ta;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ta||(Ta={}));function dW(t){return!DT||!t?!1:t===document.scrollingElement}function fW(t){const e={x:0,y:0},n=dW(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const Zde={x:.2,y:.2};function Qde(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Zde);const{isTop:c,isBottom:d,isLeft:p,isRight:m}=fW(t),x={x:0,y:0},b={x:0,y:0},_={height:e.height*i.y,width:e.width*i.x};return!c&&s<=e.top+_.height?(x.y=Ta.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!d&&l>=e.bottom-_.height&&(x.y=Ta.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!m&&a>=e.right-_.width?(x.x=Ta.Forward,b.x=r*Math.abs((e.right-_.width-a)/_.width)):!p&&o<=e.left+_.width&&(x.x=Ta.Backward,b.x=r*Math.abs((e.left+_.width-o)/_.width)),{direction:x,speed:b}}function Jde(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function hW(t){return t.reduce((e,n)=>_1(e,nR(n)),ef)}function efe(t){return t.reduce((e,n)=>e+cW(n),0)}function tfe(t){return t.reduce((e,n)=>e+uW(n),0)}function nfe(t,e){if(e===void 0&&(e=Ay),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);lW(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const rfe=[["x",["left","right"],efe],["y",["top","bottom"],tfe]];class j7{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=PT(n),i=hW(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of rfe)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=i[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class R_{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function ife(t){const{EventTarget:e}=Rc(t);return t instanceof e?t:Ey(t)}function oA(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Gu;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Gu||(Gu={}));function yI(t){t.preventDefault()}function sfe(t){t.stopPropagation()}var di;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(di||(di={}));const pW={start:[di.Space,di.Enter],cancel:[di.Esc],end:[di.Space,di.Enter,di.Tab]},ofe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case di.Right:return{...n,x:n.x+25};case di.Left:return{...n,x:n.x-25};case di.Down:return{...n,y:n.y+25};case di.Up:return{...n,y:n.y-25}}};class cx{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new R_(Ey(n)),this.windowListeners=new R_(Rc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gu.Resize,this.handleCancel),this.windowListeners.add(Gu.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gu.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&nfe(r),n(ef)}handleKeyDown(e){if(L7(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=pW,coordinateGetter:o=ofe,scrollBehavior:a="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:ef;this.referenceCoordinates||(this.referenceCoordinates=d);const p=o(e,{active:n,context:r.current,currentCoordinates:d});if(p){const m=lS(p,d),x={x:0,y:0},{scrollableAncestors:b}=r.current;for(const _ of b){const S=e.code,{isTop:w,isRight:C,isLeft:A,isBottom:N,maxScroll:D,minScroll:P}=fW(_),O=Jde(_),R={x:Math.min(S===di.Right?O.right-O.width/2:O.right,Math.max(S===di.Right?O.left:O.left+O.width/2,p.x)),y:Math.min(S===di.Down?O.bottom-O.height/2:O.bottom,Math.max(S===di.Down?O.top:O.top+O.height/2,p.y))},L=S===di.Right&&!C||S===di.Left&&!A,V=S===di.Down&&!N||S===di.Up&&!w;if(L&&R.x!==p.x){const F=_.scrollLeft+m.x,U=S===di.Right&&F<=D.x||S===di.Left&&F>=P.x;if(U&&!m.y){_.scrollTo({left:F,behavior:a});return}U?x.x=_.scrollLeft-F:x.x=S===di.Right?_.scrollLeft-D.x:_.scrollLeft-P.x,x.x&&_.scrollBy({left:-x.x,behavior:a});break}else if(V&&R.y!==p.y){const F=_.scrollTop+m.y,U=S===di.Down&&F<=D.y||S===di.Up&&F>=P.y;if(U&&!m.x){_.scrollTo({top:F,behavior:a});return}U?x.y=_.scrollTop-F:x.y=S===di.Down?_.scrollTop-D.y:_.scrollTop-P.y,x.y&&_.scrollBy({top:-x.y,behavior:a});break}}this.handleMove(e,_1(lS(p,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}cx.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=pW,onActivation:i}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=s.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function bI(t){return!!(t&&"distance"in t)}function _I(t){return!!(t&&"delay"in t)}class z7{constructor(e,n,r){var i;r===void 0&&(r=ife(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:o}=s;this.props=e,this.events=n,this.document=Ey(o),this.documentListeners=new R_(this.document),this.listeners=new R_(r),this.windowListeners=new R_(Rc(o)),this.initialCoordinates=(i=tR(s))!=null?i:ef,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Gu.Resize,this.handleCancel),this.windowListeners.add(Gu.DragStart,yI),this.windowListeners.add(Gu.VisibilityChange,this.handleCancel),this.windowListeners.add(Gu.ContextMenu,yI),this.documentListeners.add(Gu.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(_I(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(bI(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Gu.Click,sfe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gu.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!i)return;const l=(n=tR(e))!=null?n:ef,c=lS(i,l);if(!r&&a){if(bI(a)){if(a.tolerance!=null&&oA(c,a.tolerance))return this.handleCancel();if(oA(c,a.distance))return this.handleStart()}if(_I(a)&&oA(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===di.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const afe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ux extends z7{constructor(e){const{event:n}=e,r=Ey(n.target);super(e,afe,r)}}ux.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const lfe={move:{name:"mousemove"},end:{name:"mouseup"}};var rR;(function(t){t[t.RightClick=2]="RightClick"})(rR||(rR={}));class cfe extends z7{constructor(e){super(e,lfe,Ey(e.event.target))}}cfe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===rR.RightClick?!1:(r==null||r({event:n}),!0)}}];const aA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ufe extends z7{constructor(e){super(e,aA)}static setup(){return window.addEventListener(aA.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(aA.move.name,e)};function e(){}}}ufe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var k_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(k_||(k_={}));var k2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(k2||(k2={}));function dfe(t){let{acceleration:e,activator:n=k_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=k2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:p,threshold:m}=t;const x=hfe({delta:p,disabled:!s}),[b,_]=Tde(),S=M.useRef({x:0,y:0}),w=M.useRef({x:0,y:0}),C=M.useMemo(()=>{switch(n){case k_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case k_.DraggableRect:return i}},[n,i,l]),A=M.useRef(null),N=M.useCallback(()=>{const P=A.current;if(!P)return;const O=S.current.x*w.current.x,R=S.current.y*w.current.y;P.scrollBy(O,R)},[]),D=M.useMemo(()=>a===k2.TreeOrder?[...c].reverse():c,[a,c]);M.useEffect(()=>{if(!s||!c.length||!C){_();return}for(const P of D){if((r==null?void 0:r(P))===!1)continue;const O=c.indexOf(P),R=d[O];if(!R)continue;const{direction:L,speed:V}=Qde(P,R,C,e,m);for(const F of["x","y"])x[F][L[F]]||(V[F]=0,L[F]=0);if(V.x>0||V.y>0){_(),A.current=P,b(N,o),S.current=V,w.current=L;return}}S.current={x:0,y:0},w.current={x:0,y:0},_()},[e,N,r,_,s,o,JSON.stringify(C),JSON.stringify(x),b,c,D,d,JSON.stringify(m)])}const ffe={x:{[Ta.Backward]:!1,[Ta.Forward]:!1},y:{[Ta.Backward]:!1,[Ta.Forward]:!1}};function hfe(t){let{delta:e,disabled:n}=t;const r=eR(e);return hw(i=>{if(n||!r||!i)return ffe;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ta.Backward]:i.x[Ta.Backward]||s.x===-1,[Ta.Forward]:i.x[Ta.Forward]||s.x===1},y:{[Ta.Backward]:i.y[Ta.Backward]||s.y===-1,[Ta.Forward]:i.y[Ta.Forward]||s.y===1}}},[n,e,r])}function pfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return hw(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function mfe(t,e){return M.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var dS;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(dS||(dS={}));var iR;(function(t){t.Optimized="optimized"})(iR||(iR={}));const SI=new Map;function gfe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=M.useState(null),{frequency:a,measure:l,strategy:c}=i,d=M.useRef(t),p=S(),m=aS(p),x=M.useCallback(function(w){w===void 0&&(w=[]),!m.current&&o(C=>C===null?w:C.concat(w.filter(A=>!C.includes(A))))},[m]),b=M.useRef(null),_=hw(w=>{if(p&&!n)return SI;if(!w||w===SI||d.current!==t||s!=null){const C=new Map;for(let A of t){if(!A)continue;if(s&&s.length>0&&!s.includes(A.id)&&A.rect.current){C.set(A.id,A.rect.current);continue}const N=A.node.current,D=N?new j7(l(N),N):null;A.rect.current=D,D&&C.set(A.id,D)}return C}return w},[t,s,n,p,l]);return M.useEffect(()=>{d.current=t},[t]),M.useEffect(()=>{p||x()},[n,p]),M.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),M.useEffect(()=>{p||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{x(),b.current=null},a))},[a,p,x,...r]),{droppableRects:_,measureDroppableContainers:x,measuringScheduled:s!=null};function S(){switch(c){case dS.Always:return!1;case dS.BeforeDragging:return n;default:return!n}}}function mW(t,e){return hw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function xfe(t,e){return mW(t,e)}function vfe(t){let{callback:e,disabled:n}=t;const r=O7(e),i=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return M.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function IT(t){let{callback:e,disabled:n}=t;const r=O7(e),i=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return M.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function yfe(t){return new j7(Ay(t),t)}function wI(t,e,n){e===void 0&&(e=yfe);const[r,i]=M.useState(null);function s(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const o=vfe({callback(l){if(t)for(const c of l){const{type:d,target:p}=c;if(d==="childList"&&p instanceof HTMLElement&&p.contains(t)){s();break}}}}),a=IT({callback:s});return ah(()=>{s(),t?(a==null||a.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[t]),r}function bfe(t){const e=mW(t);return aW(t,e)}const MI=[];function _fe(t){const e=M.useRef(t),n=hw(r=>t?r&&r!==MI&&t&&e.current&&t.parentNode===e.current.parentNode?r:PT(t):MI,[t]);return M.useEffect(()=>{e.current=t},[t]),n}function Sfe(t){const[e,n]=M.useState(null),r=M.useRef(t),i=M.useCallback(s=>{const o=sA(s.target);o&&n(a=>a?(a.set(o,nR(o)),new Map(a)):null)},[]);return M.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=sA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,nR(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(s)};function o(a){a.forEach(l=>{const c=sA(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),M.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>_1(s,o),ef):hW(t):ef,[t,e])}function TI(t,e){e===void 0&&(e=[]);const n=M.useRef(null);return M.useEffect(()=>{n.current=null},e),M.useEffect(()=>{const r=t!==ef;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?lS(t,n.current):ef}function wfe(t){M.useEffect(()=>{if(!DT)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function Mfe(t,e){return M.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function gW(t){return M.useMemo(()=>t?Xde(t):null,[t])}const CI=[];function Tfe(t,e){e===void 0&&(e=Ay);const[n]=t,r=gW(n?Rc(n):null),[i,s]=M.useState(CI);function o(){s(()=>t.length?t.map(l=>dW(l)?r:new j7(e(l),l)):CI)}const a=IT({callback:o});return ah(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),i}function Cfe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return fw(e)?e:t}function Efe(t){let{measure:e}=t;const[n,r]=M.useState(null),i=M.useCallback(c=>{for(const{target:d}of c)if(fw(d)){r(p=>{const m=e(d);return p?{...p,width:m.width,height:m.height}:m});break}},[e]),s=IT({callback:i}),o=M.useCallback(c=>{const d=Cfe(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?e(d):null)},[e,s]),[a,l]=N2(o);return M.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Afe=[{sensor:ux,options:{}},{sensor:cx,options:{}}],Nfe={current:{}},UM={draggable:{measure:vI},droppable:{measure:vI,strategy:dS.WhileDragging,frequency:iR.Optimized},dragOverlay:{measure:Ay}};class D_ extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const Rfe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new D_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:R2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:UM,measureDroppableContainers:R2,windowRect:null,measuringScheduled:!1},kfe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:R2,draggableNodes:new Map,over:null,measureDroppableContainers:R2},OT=M.createContext(kfe),xW=M.createContext(Rfe);function Dfe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new D_}}}function Pfe(t,e){switch(e.type){case sa.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case sa.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case sa.DragEnd:case sa.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case sa.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new D_(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case sa.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new D_(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case sa.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new D_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function Ife(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=M.useContext(OT),s=eR(r),o=eR(n==null?void 0:n.id);return M.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!L7(s)||document.activeElement===s.target)return;const a=i.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const p=Ade(d);if(p){p.focus();break}}})}},[r,e,i,o,s]),null}function Ofe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function Lfe(t){return M.useMemo(()=>({draggable:{...UM.draggable,...t==null?void 0:t.draggable},droppable:{...UM.droppable,...t==null?void 0:t.droppable},dragOverlay:{...UM.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function jfe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=M.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ah(()=>{if(!o&&!a||!e){s.current=!1;return}if(s.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=n(c),p=aW(d,r);if(o||(p.x=0),a||(p.y=0),s.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const m=lW(c);m&&m.scrollBy({top:p.y,left:p.x})}},[e,o,a,r,n])}const vW=M.createContext({...ef,scaleX:1,scaleY:1});var R0;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(R0||(R0={}));const fS=M.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=Afe,collisionDetection:p=Bde,measuring:m,modifiers:x,...b}=e;const _=M.useReducer(Pfe,void 0,Dfe),[S,w]=_,[C,A]=Ide(),[N,D]=M.useState(R0.Uninitialized),P=N===R0.Initialized,{draggable:{active:O,nodes:R,translate:L},droppable:{containers:V}}=S,F=O!=null?R.get(O):null,U=M.useRef({initial:null,translated:null}),W=M.useMemo(()=>{var ft;return O!=null?{id:O,data:(ft=F==null?void 0:F.data)!=null?ft:Nfe,rect:U}:null},[O,F]),Y=M.useRef(null),[$,X]=M.useState(null),[Z,K]=M.useState(null),ne=aS(b,Object.values(b)),H=pw("DndDescribedBy",o),B=M.useMemo(()=>V.getEnabled(),[V]),G=Lfe(m),{droppableRects:j,measureDroppableContainers:ie,measuringScheduled:ce}=gfe(B,{dragging:P,dependencies:[L.x,L.y],config:G.droppable}),te=pfe(R,O),se=M.useMemo(()=>Z?tR(Z):null,[Z]),le=$e(),re=xfe(te,G.draggable.measure);jfe({activeNode:O!=null?R.get(O):null,config:le.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const pe=wI(te,G.draggable.measure,re),be=wI(te?te.parentElement:null),xe=M.useRef({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=V.getNodeFor((n=xe.current.over)==null?void 0:n.id),me=Efe({measure:G.dragOverlay.measure}),ke=(r=me.nodeRef.current)!=null?r:te,we=P?(i=me.rect)!=null?i:pe:null,Te=!!(me.nodeRef.current&&me.rect),oe=bfe(Te?null:pe),_e=gW(ke?Rc(ke):null),Fe=_fe(P?Pe??te:null),Ue=Tfe(Fe),Oe=Ofe(x,{transform:{x:L.x-oe.x,y:L.y-oe.y,scaleX:1,scaleY:1},activatorEvent:Z,active:W,activeNodeRect:pe,containerNodeRect:be,draggingNodeRect:we,over:xe.current.over,overlayNodeRect:me.rect,scrollableAncestors:Fe,scrollableAncestorRects:Ue,windowRect:_e}),ue=se?_1(se,L):null,Q=Sfe(Fe),fe=TI(Q),Se=TI(Q,[pe]),Ae=_1(Oe,fe),ve=we?Gde(we,Oe):null,qe=W&&ve?p({active:W,collisionRect:ve,droppableRects:j,droppableContainers:B,pointerCoordinates:ue}):null,Ee=oW(qe,"id"),[Ce,Ye]=M.useState(null),Ze=Te?Oe:_1(Oe,Se),it=Hde(Ze,(s=Ce==null?void 0:Ce.rect)!=null?s:null,pe),ut=M.useRef(null),De=M.useCallback((ft,nt)=>{let{sensor:We,options:Ke}=nt;if(Y.current==null)return;const je=R.get(Y.current);if(!je)return;const et=ft.nativeEvent,pt=new We({active:Y.current,activeNode:je,event:et,options:Ke,context:xe,onAbort(wt){if(!R.get(wt))return;const{onDragAbort:Pt}=ne.current,zt={id:wt};Pt==null||Pt(zt),C({type:"onDragAbort",event:zt})},onPending(wt,yt,Pt,zt){if(!R.get(wt))return;const{onDragPending:Et}=ne.current,Be={id:wt,constraint:yt,initialCoordinates:Pt,offset:zt};Et==null||Et(Be),C({type:"onDragPending",event:Be})},onStart(wt){const yt=Y.current;if(yt==null)return;const Pt=R.get(yt);if(!Pt)return;const{onDragStart:zt}=ne.current,Dt={activatorEvent:et,active:{id:yt,data:Pt.data,rect:U}};Wd.unstable_batchedUpdates(()=>{zt==null||zt(Dt),D(R0.Initializing),w({type:sa.DragStart,initialCoordinates:wt,active:yt}),C({type:"onDragStart",event:Dt}),X(ut.current),K(et)})},onMove(wt){w({type:sa.DragMove,coordinates:wt})},onEnd:Lt(sa.DragEnd),onCancel:Lt(sa.DragCancel)});ut.current=pt;function Lt(wt){return async function(){const{active:Pt,collisions:zt,over:Dt,scrollAdjustedTranslate:Et}=xe.current;let Be=null;if(Pt&&Et){const{cancelDrop:Qe}=ne.current;Be={activatorEvent:et,active:Pt,collisions:zt,delta:Et,over:Dt},wt===sa.DragEnd&&typeof Qe=="function"&&await Promise.resolve(Qe(Be))&&(wt=sa.DragCancel)}Y.current=null,Wd.unstable_batchedUpdates(()=>{w({type:wt}),D(R0.Uninitialized),Ye(null),X(null),K(null),ut.current=null;const Qe=wt===sa.DragEnd?"onDragEnd":"onDragCancel";if(Be){const ht=ne.current[Qe];ht==null||ht(Be),C({type:Qe,event:Be})}})}}},[R]),Ve=M.useCallback((ft,nt)=>(We,Ke)=>{const je=We.nativeEvent,et=R.get(Ke);if(Y.current!==null||!et||je.dndKit||je.defaultPrevented)return;const pt={active:et};ft(We,nt.options,pt)===!0&&(je.dndKit={capturedBy:nt.sensor},Y.current=Ke,De(We,nt))},[R,De]),lt=mfe(d,Ve);wfe(d),ah(()=>{pe&&N===R0.Initializing&&D(R0.Initialized)},[pe,N]),M.useEffect(()=>{const{onDragMove:ft}=ne.current,{active:nt,activatorEvent:We,collisions:Ke,over:je}=xe.current;if(!nt||!We)return;const et={active:nt,activatorEvent:We,collisions:Ke,delta:{x:Ae.x,y:Ae.y},over:je};Wd.unstable_batchedUpdates(()=>{ft==null||ft(et),C({type:"onDragMove",event:et})})},[Ae.x,Ae.y]),M.useEffect(()=>{const{active:ft,activatorEvent:nt,collisions:We,droppableContainers:Ke,scrollAdjustedTranslate:je}=xe.current;if(!ft||Y.current==null||!nt||!je)return;const{onDragOver:et}=ne.current,pt=Ke.get(Ee),Lt=pt&&pt.rect.current?{id:pt.id,rect:pt.rect.current,data:pt.data,disabled:pt.disabled}:null,wt={active:ft,activatorEvent:nt,collisions:We,delta:{x:je.x,y:je.y},over:Lt};Wd.unstable_batchedUpdates(()=>{Ye(Lt),et==null||et(wt),C({type:"onDragOver",event:wt})})},[Ee]),ah(()=>{xe.current={activatorEvent:Z,active:W,activeNode:te,collisionRect:ve,collisions:qe,droppableRects:j,draggableNodes:R,draggingNode:ke,draggingNodeRect:we,droppableContainers:V,over:Ce,scrollableAncestors:Fe,scrollAdjustedTranslate:Ae},U.current={initial:we,translated:ve}},[W,te,qe,ve,R,ke,we,j,V,Ce,Fe,Ae]),dfe({...le,delta:L,draggingRect:ve,pointerCoordinates:ue,scrollableAncestors:Fe,scrollableAncestorRects:Ue});const Le=M.useMemo(()=>({active:W,activeNode:te,activeNodeRect:pe,activatorEvent:Z,collisions:qe,containerNodeRect:be,dragOverlay:me,draggableNodes:R,droppableContainers:V,droppableRects:j,over:Ce,measureDroppableContainers:ie,scrollableAncestors:Fe,scrollableAncestorRects:Ue,measuringConfiguration:G,measuringScheduled:ce,windowRect:_e}),[W,te,pe,Z,qe,be,me,R,V,j,Ce,ie,Fe,Ue,G,ce,_e]),Ne=M.useMemo(()=>({activatorEvent:Z,activators:lt,active:W,activeNodeRect:pe,ariaDescribedById:{draggable:H},dispatch:w,draggableNodes:R,over:Ce,measureDroppableContainers:ie}),[Z,lt,W,pe,w,H,R,Ce,ie]);return ei.createElement(rW.Provider,{value:A},ei.createElement(OT.Provider,{value:Ne},ei.createElement(xW.Provider,{value:Le},ei.createElement(vW.Provider,{value:it},c)),ei.createElement(Ife,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ei.createElement(jde,{...a,hiddenTextDescribedById:H}));function $e(){const ft=($==null?void 0:$.autoScrollEnabled)===!1,nt=typeof l=="object"?l.enabled===!1:l===!1,We=P&&!ft&&!nt;return typeof l=="object"?{...l,enabled:We}:{enabled:We}}}),zfe=M.createContext(null),EI="button",Ffe="Draggable";function Ufe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=pw(Ffe),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:p,over:m}=M.useContext(OT),{role:x=EI,roleDescription:b="draggable",tabIndex:_=0}=i??{},S=(l==null?void 0:l.id)===e,w=M.useContext(S?vW:zfe),[C,A]=N2(),[N,D]=N2(),P=Mfe(o,e),O=aS(n);ah(()=>(p.set(e,{id:e,key:s,node:C,activatorNode:N,data:O}),()=>{const L=p.get(e);L&&L.key===s&&p.delete(e)}),[p,e]);const R=M.useMemo(()=>({role:x,tabIndex:_,"aria-disabled":r,"aria-pressed":S&&x===EI?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[r,x,_,S,b,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:R,isDragging:S,listeners:r?void 0:P,node:C,over:m,setNodeRef:A,setActivatorNodeRef:D,transform:w}}function Bfe(){return M.useContext(xW)}const Hfe="Droppable",Vfe={timeout:25};function Gfe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=pw(Hfe),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=M.useContext(OT),d=M.useRef({disabled:n}),p=M.useRef(!1),m=M.useRef(null),x=M.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:S}={...Vfe,...i},w=aS(_??r),C=M.useCallback(()=>{if(!p.current){p.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),x.current=null},S)},[S]),A=IT({callback:C,disabled:b||!o}),N=M.useCallback((R,L)=>{A&&(L&&(A.unobserve(L),p.current=!1),R&&A.observe(R))},[A]),[D,P]=N2(N),O=aS(e);return M.useEffect(()=>{!A||!D.current||(A.disconnect(),p.current=!1,A.observe(D.current))},[D,A]),M.useEffect(()=>(a({type:sa.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:m,data:O}}),()=>a({type:sa.UnregisterDroppable,key:s,id:r})),[r]),M.useEffect(()=>{n!==d.current.disabled&&(a({type:sa.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,a]),{active:o,rect:m,isOver:(l==null?void 0:l.id)===r,node:D,over:l,setNodeRef:P}}function dx(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Wfe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function s4(t){return t!==null&&t>=0}function $fe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function qfe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const mw=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=dx(e,r,n),o=e[i],a=s[i];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},o4={scaleX:1,scaleY:1},yW=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=t;const a=(e=s[n])!=null?e:r;if(!a)return null;if(i===n){const c=s[o];return c?{x:0,y:n<o?c.top+c.height-(a.top+a.height):c.top-a.top,...o4}:null}const l=Xfe(s,i,n);return i>n&&i<=o?{x:0,y:-a.height-l,...o4}:i<n&&i>=o?{x:0,y:a.height+l,...o4}:{x:0,y:0,...o4}};function Xfe(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return r?n<e?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const bW="Sortable",_W=ei.createContext({activeIndex:-1,containerId:bW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mw,disabled:{draggable:!1,droppable:!1}});function hS(t){let{children:e,id:n,items:r,strategy:i=mw,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Bfe(),p=pw(bW,n),m=a.rect!==null,x=M.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),b=o!=null,_=o?x.indexOf(o.id):-1,S=c?x.indexOf(c.id):-1,w=M.useRef(x),C=!$fe(x,w.current),A=S!==-1&&_===-1||C,N=qfe(s);ah(()=>{C&&b&&d(x)},[C,x,b,d]),M.useEffect(()=>{w.current=x},[x]);const D=M.useMemo(()=>({activeIndex:_,containerId:p,disabled:N,disableTransforms:A,items:x,overIndex:S,useDragOverlay:m,sortedRects:Wfe(x,l),strategy:i}),[_,p,N.draggable,N.droppable,A,x,S,l,m,i]);return ei.createElement(_W.Provider,{value:D},e)}const Yfe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return dx(n,r,i).indexOf(e)},Kfe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==s&&i===o?!1:n?!0:o!==i&&e===l},Zfe={duration:200,easing:"ease"},SW="transform",Qfe=Q1.Transition.toString({property:SW,duration:0,easing:"linear"}),Jfe={roleDescription:"sortable"};function ehe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=M.useState(null),a=M.useRef(n);return ah(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=Ay(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&o(d)}}n!==a.current&&(a.current=n)},[e,n,r,i]),M.useEffect(()=>{s&&o(null)},[s]),s}function F7(t){let{animateLayoutChanges:e=Kfe,attributes:n,disabled:r,data:i,getNewIndex:s=Yfe,id:o,strategy:a,resizeObserverConfig:l,transition:c=Zfe}=t;const{items:d,containerId:p,activeIndex:m,disabled:x,disableTransforms:b,sortedRects:_,overIndex:S,useDragOverlay:w,strategy:C}=M.useContext(_W),A=the(r,x),N=d.indexOf(o),D=M.useMemo(()=>({sortable:{containerId:p,index:N,items:d},...i}),[p,i,N,d]),P=M.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:O,node:R,isOver:L,setNodeRef:V}=Gfe({id:o,data:D,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:F,activatorEvent:U,activeNodeRect:W,attributes:Y,setNodeRef:$,listeners:X,isDragging:Z,over:K,setActivatorNodeRef:ne,transform:H}=Ufe({id:o,data:D,attributes:{...Jfe,...n},disabled:A.draggable}),B=Mde(V,$),G=!!F,j=G&&!b&&s4(m)&&s4(S),ie=!w&&Z,ce=ie&&j?H:null,se=j?ce??(a??C)({rects:_,activeNodeRect:W,activeIndex:m,overIndex:S,index:N}):null,le=s4(m)&&s4(S)?s({id:o,items:d,activeIndex:m,overIndex:S}):N,re=F==null?void 0:F.id,pe=M.useRef({activeId:re,items:d,newIndex:le,containerId:p}),be=d!==pe.current.items,xe=e({active:F,containerId:p,isDragging:Z,isSorting:G,id:o,index:N,items:d,newIndex:pe.current.newIndex,previousItems:pe.current.items,previousContainerId:pe.current.containerId,transition:c,wasDragging:pe.current.activeId!=null}),Pe=ehe({disabled:!xe,index:N,node:R,rect:O});return M.useEffect(()=>{G&&pe.current.newIndex!==le&&(pe.current.newIndex=le),p!==pe.current.containerId&&(pe.current.containerId=p),d!==pe.current.items&&(pe.current.items=d)},[G,le,p,d]),M.useEffect(()=>{if(re===pe.current.activeId)return;if(re!=null&&pe.current.activeId==null){pe.current.activeId=re;return}const ke=setTimeout(()=>{pe.current.activeId=re},50);return()=>clearTimeout(ke)},[re]),{active:F,activeIndex:m,attributes:Y,data:D,rect:O,index:N,newIndex:le,items:d,isOver:L,isSorting:G,isDragging:Z,listeners:X,node:R,overIndex:S,over:K,setNodeRef:B,setActivatorNodeRef:ne,setDroppableNodeRef:V,setDraggableNodeRef:$,transform:Pe??se,transition:me()};function me(){if(Pe||be&&pe.current.newIndex===N)return Qfe;if(!(ie&&!L7(U)||!c)&&(G||xe))return Q1.Transition.toString({...c,property:SW})}}function the(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:e.droppable}}function D2(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const nhe=[di.Down,di.Right,di.Up,di.Left],pS=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(nhe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(p=>{if(!p||p!=null&&p.disabled)return;const m=i.get(p.id);if(m)switch(t.code){case di.Down:r.top<m.top&&l.push(p);break;case di.Up:r.top>m.top&&l.push(p);break;case di.Left:r.left>m.left&&l.push(p);break;case di.Right:r.left<m.left&&l.push(p);break}});const c=Fde({collisionRect:r,droppableRects:i,droppableContainers:l});let d=oW(c,"id");if(d===(o==null?void 0:o.id)&&c.length>1&&(d=c[1].id),d!=null){const p=s.get(n.id),m=s.get(d),x=m?i.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&x&&p&&m){const S=PT(b).some((P,O)=>a[O]!==P),w=wW(p,m),C=rhe(p,m),A=S||!w?{x:0,y:0}:{x:C?r.width-x.width:0,y:C?r.height-x.height:0},N={x:x.left,y:x.top};return A.x&&A.y?N:lS(N,A)}}}};function wW(t,e){return!D2(t)||!D2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function rhe(t,e){return!D2(t)||!D2(e)||!wW(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function Ju({className:t,size:e="default",...n}){return f.jsx("div",{"data-slot":"card","data-size":e,className:Rt("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",t),...n})}function AI({className:t,...e}){return f.jsx("div",{"data-slot":"card-header",className:Rt("gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",t),...e})}function a4({className:t,...e}){return f.jsx("div",{"data-slot":"card-title",className:Rt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function l4({className:t,...e}){return f.jsx("div",{"data-slot":"card-description",className:Rt("text-muted-foreground text-sm",t),...e})}function ih({className:t,...e}){return f.jsx("div",{"data-slot":"card-content",className:Rt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function tp({className:t,...e}){return f.jsx("div",{"data-slot":"skeleton",className:Rt("bg-muted rounded-md animate-pulse",t),...e})}const MW=C7("hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-muted border bg-transparent",selecting:"bg-accent text-muted-foreground data-[state=on]:bg-primary data-[state=on]:text-secondary hover:text-accent-foreground"},size:{default:"h-8 min-w-8 px-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]",lg:"h-9 min-w-9 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function S1({className:t,variant:e="default",size:n="default",...r}){return f.jsx(uae,{"data-slot":"toggle",className:Rt(MW({variant:e,size:n,className:t})),...r})}const TW=M.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function em({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...o}){return f.jsx(mae,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Rt("rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",t),...o,children:f.jsx(TW.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Wa({className:t,children:e,variant:n="default",size:r="default",...i}){const s=M.useContext(TW);return f.jsx(gae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Rt("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",MW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function mS({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:o="number",inputMin:a,inputMax:l,inputWidth:c="w-12",icon:d,variant:p="default",size:m="default",className:x}){const b=w=>{w.key==="Enter"&&(e||n(!0),s(r),w.currentTarget.blur())},_=()=>{s(r)},S=p==="selecting";return f.jsxs("div",{className:Rt("inline-flex items-center rounded-lg transition-colors",p==="default"&&"border border-input bg-transparent",p==="default"&&e&&"bg-muted",p==="outline"&&"border border-input bg-transparent",p==="outline"&&e&&"bg-muted",S&&"bg-accent",S&&e&&"bg-primary",x),children:[f.jsxs(S1,{variant:p,size:m,pressed:e,onPressedChange:n,className:Rt("gap-1.5 border-0 rounded-r-none pr-1",m==="sm"&&"text-xs px-2"),children:[d,f.jsx("span",{children:t})]}),f.jsx("input",{type:o,min:a,max:l,value:r,onChange:w=>i(w.target.value),onKeyDown:b,onBlur:_,className:Rt("bg-transparent text-center font-medium outline-none rounded-r-lg transition-colors",c,m==="default"&&"h-8 text-sm",m==="sm"&&"h-7 text-xs",S?e?"text-secondary":"text-muted-foreground/50":e?"text-foreground":"text-muted-foreground/50")})]})}const ihe=C7("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function J1({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?PU:"span";return f.jsx(i,{"data-slot":"badge","data-variant":e,className:Rt(ihe({variant:e}),t),...r})}const CW="...";function she(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-CW.length;if(n<2)return{prefix:t.slice(0,Math.max(1,e)),suffix:"",isTruncated:!1};const r=4;let i=n<=r+1?Math.max(1,Math.floor(n/2)):r;i=Math.min(i,t.length-1);let s=n-i;return s<1&&(s=1,i=Math.max(1,n-s)),{prefix:t.slice(0,s),suffix:t.slice(-i),isTruncated:!0}}function c1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const o=M.useRef(null),a=M.useRef(null),[l,c]=M.useState({prefix:t,suffix:"",isTruncated:!1}),d=M.useCallback(()=>{const m=o.current,x=a.current;if(!m||!x)return;const b=m.getBoundingClientRect().width,_=x.getBoundingClientRect().width;if(!b||!_)return;if(_<=b){c(A=>A.isTruncated||A.prefix!==t?{prefix:t,suffix:"",isTruncated:!1}:A);return}const S=_/Math.max(1,t.length),w=Math.max(1,Math.floor(b/S)),C=she(t,w);c(A=>A.prefix===C.prefix&&A.suffix===C.suffix&&A.isTruncated===C.isTruncated?A:C)},[t]);M.useLayoutEffect(()=>{d();const m=o.current;if(!m||typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{d()});return x.observe(m),()=>x.disconnect()},[d]);const p=f.jsxs("span",{ref:o,className:Rt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[f.jsx("span",{ref:a,className:"pointer-events-none absolute -z-10 opacity-0","aria-hidden":"true",children:t||"M"}),l.isTruncated?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"shrink-0",children:l.prefix}),f.jsx("span",{className:Rt("relative inline-flex items-center rounded-[2px] px-0.5 text-muted-foreground","before:absolute before:inset-y-0 before:-left-2 before:w-2 before:bg-gradient-to-r before:from-transparent before:content-['']",r??"bg-background",i??"before:to-background"),children:CW}),f.jsx("span",{className:"shrink-0",children:l.suffix})]}):f.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?f.jsxs(wx,{delayDuration:s,children:[f.jsx(Mx,{asChild:!0,children:p}),f.jsx(Tx,{side:"top",className:Rt("max-w-xs break-all text-[11px]",n),children:t})]}):p}function sR(t){try{return JSON.stringify(t,(n,r)=>r&&typeof r=="object"&&!Array.isArray(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)??String(t)}catch{return String(t)}}function EW(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)||typeof e=="object"&&e!==null?e:null}function NI(t){return t==null?"—":typeof t=="boolean"?t?"True":"False":typeof t=="number"?Number.isInteger(t)?t.toLocaleString():Math.abs(t)<.001&&t!==0?t.toExponential(2):t.toLocaleString(void 0,{maximumFractionDigits:6}):typeof t=="object"?sR(t):String(t)}function RI(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function U7(t,e){return t===e?!0:t==null?e==null:e==null?!1:typeof t=="object"||typeof e=="object"?sR(t)===sR(e):String(t)===String(e)}function ohe(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_"),order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"||l==="evals"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){if(l==="_wandb")continue;const d=EW(c);if(d===null)continue;let p=!1;for(const m of e)if(m.match(l)){n.get(m.key).items.push({key:l,displayKey:RI(l),value:d}),p=!0;break}p||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:RI(l),value:d}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((p,m)=>[p,m]));l.items.sort((p,m)=>{const x=d.get(p.key)??1/0,b=d.get(m.key)??1/0;return x!==b?x-b:p.key.localeCompare(m.key)})}}const i=new Set(["setup/gpu","setup/cpu","setup/memory","setup/disk","setup/network","setup/os","setup/package_versions"]),s=["general","model","ray_cluster","workers","orchestrator","trainer","algorithm","weight_sync","sequence_packing","inference","rollout","checkpoint","logging","evals","vllm_tracing","environments","hardware","other"],o=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&o.push(c)}const a=[];for(const l of s)if(l==="hardware")o.length>0&&a.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:o});else{const c=n.get(l);c&&c.items.length>0&&a.push(c)}return a}function kI(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=EW(r);i!==null&&e.set(n,i)}return e}function B7(t,e,n){return t.subcategories?t.subcategories.some(r=>B7(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!U7(i,s)})}function ahe({runs:t,currentRunId:e,onSelect:n}){return f.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(r=>{const i=r.run_id===e,s=r.name||r.run_id.split("/").pop()||r.run_id;return f.jsxs("button",{onClick:()=>!i&&n(r.run_id),disabled:i,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",i?"opacity-40 cursor-not-allowed":"hover:bg-muted cursor-pointer"),children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:r.color}}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"min-w-0",children:f.jsx(c1,{text:s,className:"text-sm font-medium"})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&f.jsx(J1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),r.is_tracking&&f.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),r.is_syncing&&f.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),r.created_at&&f.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:Z1(r.created_at)})]},r.run_id)}),t.length===0&&f.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No other runs available"})]})}function DI({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=f.jsx("span",{className:Rt("text-sm font-sans truncate block max-w-full overflow-hidden text-ellipsis",n?"font-medium":"text-muted-foreground"),children:e});return r?f.jsxs(wx,{children:[f.jsx(Mx,{asChild:!0,children:i}),f.jsx(Tx,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function lhe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=NI(e),s=NI(n),o=!U7(e,n);return r&&!o?null:f.jsxs("div",{className:Rt("grid grid-cols-[1fr_2fr_2fr] gap-3 py-1.5 rounded-md transition-colors min-w-0",o?"hover:bg-muted/50":"opacity-40 hover:opacity-60"),children:[f.jsxs(wx,{children:[f.jsx(Mx,{asChild:!0,children:f.jsx("span",{className:Rt("text-sm truncate min-w-0",o?"text-foreground":"text-muted-foreground"),children:t})}),f.jsx(Tx,{side:"left",className:"text-xs",children:t})]}),f.jsx("div",{className:"min-w-0 overflow-hidden",children:f.jsx(DI,{value:e,formatted:i,isDifferent:o})}),f.jsx("div",{className:"min-w-0 overflow-hidden",children:f.jsx(DI,{value:n,formatted:s,isDifferent:o})})]})}const che="ml-[22px]",uhe="ml-[38px]";function AW({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const o=B7(t,e,n),[a,l]=M.useState(s??o);if(r&&!o)return null;const c=t.subcategories&&t.subcategories.length>0;return f.jsxs(Fi,{open:a,onOpenChange:l,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",i&&"ml-4",!o&&"opacity-40"),children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!a&&"-rotate-90")}),f.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),f.jsx(Bi,{children:c?f.jsx("div",{className:"mt-1",children:t.subcategories.map(d=>f.jsx(AW,{category:d,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},d.key))}):f.jsx("div",{className:Rt("mt-1",i?uhe:che),children:t.items.map(d=>f.jsx(lhe,{displayKey:d.displayKey,value1:e.get(d.key),value2:n.get(d.key),showOnlyDifferences:r},d.key))})})]})}function dhe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:o,run2Color:a}){const[l,c]=M.useState(!0),d=M.useMemo(()=>kI(t),[t]),p=M.useMemo(()=>kI(e),[e]),m=M.useMemo(()=>{const _={...t};for(const[S,w]of Object.entries(e))S in _||(_[S]=w);return _},[t,e]),x=M.useMemo(()=>ohe(m),[m]),b=M.useMemo(()=>{let _=0;for(const[S,w]of d){const C=p.get(S);U7(w,C)||_++}for(const[S]of p)d.has(S)||_++;return _},[d,p]);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center justify-between gap-4 pb-2 border-b",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(J1,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),f.jsxs(em,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[f.jsx(Wa,{value:"everything",className:"text-xs px-3",children:"Everything"}),f.jsx(Wa,{value:"differences",className:"text-xs px-3",children:"Only differences"})]})]}),f.jsxs("div",{className:"grid grid-cols-[1fr_2fr_2fr] gap-3 pb-2 border-b text-sm font-medium",children:[f.jsx("span",{className:"text-muted-foreground",children:"Config"}),f.jsxs("div",{className:"min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o}}),f.jsx(c1,{text:n,className:"text-sm font-medium min-w-0"})]}),f.jsx("div",{className:"ml-4",children:f.jsx(c1,{text:i,className:"text-xs font-normal text-muted-foreground min-w-0"})})]}),f.jsxs("div",{className:"min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),f.jsx(c1,{text:r,className:"text-sm font-medium min-w-0"})]}),f.jsx("div",{className:"ml-4",children:f.jsx(c1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),f.jsx(Ex,{className:"h-[72vh]",children:f.jsx("div",{className:"space-y-1 pr-4",children:x.map(_=>{let S;return _.key==="hardware"&&(S=x.filter(C=>C.key!=="hardware"&&B7(C,d,p)).length===0),f.jsx(AW,{category:_,config1Map:d,config2Map:p,showOnlyDifferences:l,defaultOpen:S},_.key)})})})]})}function fhe({currentRunId:t,currentConfig:e}){const[n,r]=M.useState(!1),[i,s]=M.useState(null),{data:o,isLoading:a}=ym(),l=(o==null?void 0:o.runs)||[],{data:c,isLoading:d}=cd(i||"",!!i,!1),p=l.find(N=>N.run_id===t),m=l.find(N=>N.run_id===i),x=(p==null?void 0:p.color)??"",b=(m==null?void 0:m.color)??"",_=N=>{s(N)},S=()=>{s(null)},w=()=>{r(!1),setTimeout(()=>s(null),200)},C=(p==null?void 0:p.name)||t.split("/").pop()||t,A=(m==null?void 0:m.name)||(i==null?void 0:i.split("/").pop())||"";return f.jsxs(qu,{open:n,onOpenChange:N=>{N?r(!0):w()},children:[f.jsx(CT,{asChild:!0,children:f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),f.jsx(Xu,{className:"sm:max-w-4xl max-h-[95vh]",children:i?f.jsxs(f.Fragment,{children:[f.jsx(Zc,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Mn,{variant:"ghost",size:"sm",onClick:S,className:"h-7 px-2",children:"← Back"}),f.jsx("div",{children:f.jsx(Qc,{children:"Configuration Comparison"})})]})}),d?f.jsxs("div",{className:"flex items-center justify-center py-16",children:[f.jsx(hl,{className:"h-6 w-6"}),f.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?f.jsx(dhe,{config1:c.config,config2:e,run1Name:A,run2Name:C,run1Path:i||"",run2Path:t,run1Color:b,run2Color:x}):f.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No configuration data available for the selected run."})]}):f.jsxs(f.Fragment,{children:[f.jsxs(Zc,{children:[f.jsx(Qc,{children:"Compare Configuration"}),f.jsxs(jg,{children:["Select another run to compare its configuration with"," ",f.jsx("span",{className:"font-sans text-foreground",children:C})]})]}),f.jsx(Ex,{className:"h-[500px] pr-4",children:a?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(hl,{className:"h-5 w-5"})}):f.jsx(ahe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class hhe{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=C=>{if(C=this.postProcess(C,r),i){setTimeout(function(){i(C)},0);return}else return C},a=n.length,l=e.length;let c=1,d=a+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const p=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+p,x=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(x[0],n,e,0,r);if(x[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(x[0].lastComponent,n,e));let _=-1/0,S=1/0;const w=()=>{for(let C=Math.max(_,-c);C<=Math.min(S,c);C+=2){let A;const N=x[C-1],D=x[C+1];N&&(x[C-1]=void 0);let P=!1;if(D){const R=D.oldPos-C;P=D&&0<=R&&R<a}const O=N&&N.oldPos+1<l;if(!P&&!O){x[C]=void 0;continue}if(!O||P&&N.oldPos<D.oldPos?A=this.addToPath(D,!0,!1,0,r):A=this.addToPath(N,!1,!0,1,r),b=this.extractCommon(A,n,e,C,r),A.oldPos+1>=l&&b+1>=a)return o(this.buildValues(A.lastComponent,n,e))||!0;x[C]=A,A.oldPos+1>=l&&(S=Math.min(S,C-1)),b+1>=a&&(_=Math.max(_,C+1))}c++};if(i)(function C(){setTimeout(function(){if(c>d||Date.now()>m)return i(void 0);w()||C()},0)})();else for(;c<=d&&Date.now()<=m;){const C=w();if(C)return C}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,c=l-i,d=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const d=i[a];if(d.removed)d.value=this.join(r.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(l,l+d.count);p=p.map(function(m,x){const b=r[c+x];return b.length>m.length?b:m}),d.value=this.join(p)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}}class phe extends hhe{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const mhe=new phe;function ghe(t,e,n){return mhe.diff(t,e,n)}function xhe({runs:t,currentRunId:e,selectedCompareRunId:n,onSelect:r}){return f.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(i=>{const s=i.run_id===e,o=i.run_id===n,a=i.name||i.run_id.split("/").pop()||i.run_id;return f.jsxs("button",{onClick:()=>!s&&r(i.run_id),disabled:s,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":Rt("cursor-pointer hover:bg-muted",o&&"bg-muted")),children:[f.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:i.color}}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"min-w-0",children:f.jsx(c1,{text:a,className:"text-sm font-medium"})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&f.jsx(J1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&o&&f.jsx(J1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Comparing"}),i.is_tracking&&f.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),i.is_syncing&&f.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),i.created_at&&f.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:Z1(i.created_at)})]},i.run_id)}),t.length===0&&f.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No other runs available."})]})}function PI({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=M.useState(!1),{data:o,isLoading:a}=ym(),l=(o==null?void 0:o.runs)??[],c=l.find(x=>x.run_id===t)??null,d=(c==null?void 0:c.name)||t.split("/").pop()||t,p=l.find(x=>x.run_id===e)??null,m=(p==null?void 0:p.name)||(p==null?void 0:p.run_id.split("/").pop())||null;return f.jsxs(qu,{open:i,onOpenChange:x=>{s(x)},children:[f.jsx(CT,{asChild:!0,children:f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),f.jsxs(Xu,{className:"sm:max-w-4xl max-h-[90vh]",children:[f.jsxs(Zc,{children:[f.jsx(Qc,{children:"Select Run To Compare"}),f.jsxs(jg,{children:["Choose another run to compare against"," ",f.jsx("span",{className:"font-sans text-foreground",children:d}),"."]})]}),e&&f.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-xs",children:[f.jsxs("span",{className:"text-muted-foreground",children:["Currently comparing with"," ",f.jsx("span",{className:"font-medium text-foreground",children:m||e})]}),f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),f.jsx(Ex,{className:"h-[480px] pr-4",children:a?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(hl,{className:"h-5 w-5"})}):f.jsx(xhe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:x=>{n(x),s(!1)}})})]})]})}const vhe={python:["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"],javascript:["break","case","catch","class","const","continue","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","let","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"],typescript:["any","as","async","await","boolean","break","case","catch","class","const","continue","default","declare","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","interface","let","namespace","new","null","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","while"],json:["true","false","null"],bash:["if","then","else","elif","fi","for","while","do","done","case","esac","function","in","local","export","return"],sql:["SELECT","FROM","WHERE","JOIN","LEFT","RIGHT","INNER","OUTER","ON","GROUP","BY","ORDER","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","AND","OR","NOT","NULL","AS","DISTINCT","UNION","ALL"]},yhe=new Set(["python","bash","yaml","toml"]),bhe=new Set(["sql"]);function _he(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function She(t){if(!t)return"plaintext";const e=t.toLowerCase(),n=e.split(".").pop()??"";return n==="py"?"python":n==="ts"||n==="tsx"?"typescript":n==="js"||n==="jsx"||n==="mjs"||n==="cjs"?"javascript":n==="json"?"json":n==="sh"||n==="bash"||n==="zsh"?"bash":n==="sql"?"sql":n==="yml"||n==="yaml"?"yaml":n==="toml"?"toml":n==="md"?"markdown":n==="go"?"go":n==="rs"?"rust":n==="java"?"java":n==="php"?"php":n==="rb"?"ruby":n==="css"?"css":n==="html"?"html":e.endsWith("/dockerfile")?"dockerfile":"plaintext"}function whe(t){return yhe.has(t)?"#.*$":bhe.has(t)?"--.*$":t==="json"?null:"//.*$"}function k0(t,e){if(t.length===0)return[{text:" "}];const n=vhe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=whe(e),o=n.length>0?`\\b(?:${n.map(m=>_he(m)).join("|")})\\b`:null,a="\\b\\d+(?:\\.\\d+)?\\b",l=[i];s&&l.push(s),o&&l.push(o),l.push(a);const c=new RegExp(l.join("|"),"g"),d=[];let p=0;for(const m of t.matchAll(c)){const x=m[0]??"",b=m.index;if(b===void 0||x.length===0)continue;b>p&&d.push({text:t.slice(p,b)});let _;x.startsWith('"')||x.startsWith("'")||x.startsWith("`")?_="text-emerald-600 dark:text-emerald-400":x.startsWith("#")||x.startsWith("//")||x.startsWith("--")?_="text-muted-foreground":r.has(x)?_="text-violet-600 dark:text-violet-400":/^\d/.test(x)&&(_="text-amber-600 dark:text-amber-400"),d.push({text:x,className:_}),p=b+x.length}return p<t.length&&d.push({text:t.slice(p)}),d}function Mhe(t){const e=t.indexOf('"""'),n=t.indexOf("'''");return e===-1&&n===-1?null:e===-1?{index:n,quote:"'''"}:n===-1?{index:e,quote:'"""'}:e<=n?{index:e,quote:'"""'}:{index:n,quote:"'''"}}function lA(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>k0(s,e));let r=null;const i=[];for(const s of n){if(s.length===0){i.push([{text:" "}]);continue}if(r){const m=s.indexOf(r);if(m===-1){i.push([{text:s,className:"text-muted-foreground"}]);continue}const x=s.slice(0,m+3),b=s.slice(m+3),_=[{text:x,className:"text-muted-foreground"}];r=null,b.length>0&&_.push(...k0(b,e)),i.push(_);continue}const o=Mhe(s);if(!o){i.push(k0(s,e));continue}const a=s.indexOf(o.quote,o.index+3),l=s.slice(0,o.index);if(a===-1){const m=[];l.length>0&&m.push(...k0(l,e)),m.push({text:s.slice(o.index),className:"text-muted-foreground"}),i.push(m),r=o.quote;continue}const c=[],d=s.slice(o.index,a+3),p=s.slice(a+3);l.length>0&&c.push(...k0(l,e)),c.push({text:d,className:"text-muted-foreground"}),p.length>0&&c.push(...k0(p,e)),i.push(c)}return i}function II(t){if(!t)return[];const n=t.replace(/\r\n/g,`
`).replace(/\r/g,`
`).split(`
`);return n.length>0&&n[n.length-1]===""&&n.pop(),n}function The(t,e){const n=II(t),r=II(e),i=ghe(n,r),s=[];let o=1,a=1;for(const l of i)for(const c of l.value)l.added?(s.push({kind:"add",text:c,leftLine:null,rightLine:a}),a+=1):l.removed?(s.push({kind:"remove",text:c,leftLine:o,rightLine:null}),o+=1):(s.push({kind:"context",text:c,leftLine:o,rightLine:a}),o+=1,a+=1);return s}function NW(t){return t.map(e=>{var n;return{name:e.name,path:e.path,type:e.type,status:"common",children:e.type==="directory"&&((n=e.children)!=null&&n.length)?NW(e.children):void 0}})}function RW(t,e){const n=new Map(t.map(o=>[o.name,o])),r=new Map(e.map(o=>[o.name,o])),i=Array.from(new Set([...n.keys(),...r.keys()]));i.sort((o,a)=>{const l=n.get(o)??r.get(o),c=n.get(a)??r.get(a);return!l||!c?o.localeCompare(a):l.type!==c.type?l.type==="directory"?-1:1:l.name.localeCompare(c.name)});const s=[];for(const o of i){const a=n.get(o),l=r.get(o);if(!a&&!l)continue;const c=a??l;if(!c)continue;const d=a?l?"common":"removed":"added";if(c.type==="directory"){const p=RW((a==null?void 0:a.children)??[],(l==null?void 0:l.children)??[]),m=d==="common"&&p.some(x=>x.status!=="common")?"modified":d;s.push({name:c.name,path:c.path,type:"directory",status:m,children:p})}else{const p=d==="common"&&(a==null?void 0:a.hash)!=null&&(l==null?void 0:l.hash)!=null&&a.hash!==l.hash?"modified":d;s.push({name:c.name,path:c.path,type:"file",status:p})}}return s}function Che(t){const e=[],n=r=>{var i;for(const s of r)s.type==="file"?s.status!=="common"&&e.push(s.path):(i=s.children)!=null&&i.length&&n(s.children)};return n(t),e}function cA(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function Ehe(t){const e=[];let n=-1;for(let r=0;r<t.length;r++)t[r].kind!=="context"?n===-1&&(n=r):n!==-1&&(e.push({startRowIndex:n,endRowIndex:r-1}),n=-1);return n!==-1&&e.push({startRowIndex:n,endRowIndex:t.length-1}),e}function kW(t){var e;for(const n of t){if(n.type==="file")return n.path;if(n.type==="directory"&&((e=n.children)!=null&&e.length)){const r=kW(n.children);if(r)return r}}return null}function oR(t,e){var n;for(const r of t)if(r.type==="file"&&r.path===e||r.type==="directory"&&((n=r.children)!=null&&n.length)&&oR(r.children,e))return!0;return!1}function DW(t,e){var n;for(const r of t)if(r.type==="file"&&r.path===e||r.type==="directory"&&((n=r.children)!=null&&n.length)&&DW(r.children,e))return!0;return!1}function OI(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function Ahe({runPath:t,onBack:e}){const[n,r]=M.useState(null),[i,s]=M.useState(null),[o,a]=M.useState(null),[l,c]=M.useState(null),[d,p]=M.useState(0),[m,x]=M.useState(null),b=M.useRef({}),_=M.useRef({}),S=M.useRef(!1),w=M.useRef(null),C=M.useRef(null),{data:A}=ym(),N=(A==null?void 0:A.runs.find(ct=>ct.run_id===t))??null,D=(N==null?void 0:N.name)||t.split("/").pop()||t,P=(A==null?void 0:A.runs.find(ct=>ct.run_id===o))??null,O=(P==null?void 0:P.name)||(o==null?void 0:o.split("/").pop())||o,{data:R,isLoading:L,error:V}=uI(t,!!t),{data:F,isLoading:U,error:W}=uI(o||"",!!o),{data:Y,isFetching:$}=Gue(o||"",t,!!o&&!!(R!=null&&R.available)&&!!(F!=null&&F.available)&&!U),X=M.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),Z=M.useMemo(()=>F!=null&&F.available?F.tree:[],[F]),K=o!==null,ne=K&&!U&&(F==null?void 0:F.available)===!0,H=M.useMemo(()=>ne?RW(Z,X):NW(X),[ne,X,Z]),B=OI(H),G=n??B,j=H.length===0?null:i&&DW(H,i)?i:kW(H),ie=She(j),ce=!!j&&oR(X,j),te=!!j&&oR(Z,j),{data:se,isLoading:le,isFetching:re,error:pe}=dI(t,j??"",!!t&&!!j&&!!(R!=null&&R.available)&&ce),{data:be,isLoading:xe,isFetching:Pe,error:me}=dI(o??"",j??"",!!o&&!!j&&!!(F!=null&&F.available)&&te),ke=ce?se:null,we=te?be:null,Te=j&&(ke==null?void 0:ke.file_path)===j?ke:null,oe=j&&(we==null?void 0:we.file_path)===j?we:null,_e=(ke==null?void 0:ke.content)??null,Fe=(Te==null?void 0:Te.content)??null,Ue=(oe==null?void 0:oe.content)??null,Oe=ce?Fe:"",ue=te?Ue:"",Q=j&&(m==null?void 0:m.targetPath)===j?m:null,Se=K&&!(Oe!==null&&ue!==null)&&Q!==null,Ae=Se?Q.rightContent:Oe,ve=Se?Q.leftContent:ue,qe=ct=>{r(Ut=>{const Gt=new Set(Ut??B);return Gt.has(ct)?Gt.delete(ct):Gt.add(ct),Gt})},Ee=(ct,Ut)=>ct.map(Gt=>{var Hn;const sn=Gt.status==="added"?"text-emerald-700 dark:text-emerald-400":Gt.status==="removed"?"text-[#f27c7e] line-through":Gt.status==="modified"?"text-[#ab6100]":"",nn=Gt.status==="added"?"text-emerald-700 dark:text-emerald-400":Gt.status==="removed"?"text-[#f27c7e]":Gt.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(Gt.type==="directory"){const Nn=G.has(Gt.path);return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>qe(Gt.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${Ut*14+6}px`},children:[f.jsx("span",{className:Rt("inline-flex h-4 w-4 items-center justify-center",nn),children:Nn?f.jsx(Ir,{className:"h-3 w-3"}):f.jsx(Zg,{className:"h-3 w-3"})}),Nn?f.jsx(tue,{className:Rt("h-3.5 w-3.5",nn)}):f.jsx(rue,{className:Rt("h-3.5 w-3.5",nn)}),f.jsx("span",{className:Rt("truncate",sn),children:Gt.name})]}),Nn&&((Hn=Gt.children)!=null&&Hn.length)?Ee(Gt.children,Ut+1):null]},Gt.path)}const En=j===Gt.path;return f.jsxs("button",{type:"button",ref:Nn=>{_.current[Gt.path]=Nn},onClick:()=>{Qe(Gt.path),s(Gt.path),K&&(p(0),S.current=!0,w.current=Gt.path)},className:Rt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",En&&"bg-muted font-medium"),style:{paddingLeft:`${Ut*14+26}px`},children:[f.jsx(Jce,{className:Rt("h-3.5 w-3.5",nn)}),f.jsx("span",{className:Rt("truncate",sn),children:Gt.name})]},Gt.path)}),Ce=M.useMemo(()=>lA(_e??"",ie),[_e,ie]),Ye=M.useMemo(()=>lA(ve??"",ie),[ve,ie]),Ze=M.useMemo(()=>lA(Ae??"",ie),[Ae,ie]),it=M.useMemo(()=>!K||!j?[]:The(ve??"",Ae??""),[K,j,ve,Ae]),ut=!!j&&K&&!Se&&(ce&&Oe===null&&!pe||te&&ue===null&&!me),De=!!j&&K&&(ce&&re||te&&Pe),Ve=!ce||Te!==null&&!le&&!re,lt=!te||oe!==null&&!xe&&!Pe,Le=!!(oe!=null&&oe.is_binary),Ne=!!(ke!=null&&ke.is_binary),$e=!!(Te!=null&&Te.is_binary),ft=K?ce?Ae:te?ve:null:_e,We=!!j&&ft!==null&&!(K?ce?$e:te?Le:!1:Ne),Ke=M.useMemo(()=>Ehe(it),[it]),je=M.useMemo(()=>Che(H),[H]),et=j?je.indexOf(j):-1,pt=Ke.length>0?(d%Ke.length+Ke.length)%Ke.length:0,Lt=Ke.length>0?pt+1:0,wt=je.length>0&&et>=0?et+1:0,yt=M.useMemo(()=>it.reduce((ct,Ut)=>ct+(Ut.kind==="add"?1:0),0),[it]),Pt=M.useMemo(()=>it.reduce((ct,Ut)=>ct+(Ut.kind==="remove"?1:0),0),[it]),zt=(Y==null?void 0:Y.added_lines)??0,Dt=(Y==null?void 0:Y.removed_lines)??0,Et=l!==null&&l===j,Be=async()=>{!We||ft===null||(await navigator.clipboard.writeText(ft),c(j),setTimeout(()=>c(null),2e3))},Qe=ct=>{K&&x({targetPath:ct,leftContent:ve??"",rightContent:Ae??""})},ht=ct=>{var sn;if(Ke.length===0)return;const Ut=(pt+ct+Ke.length)%Ke.length;p(Ut);const Gt=Ke[Ut].startRowIndex;(sn=b.current[Gt])==null||sn.scrollIntoView({behavior:"smooth",block:"center"})},It=ct=>{if(je.length===0)return;const Ut=et<0?ct===1?0:je.length-1:(et+ct+je.length)%je.length;if(Ut===et)return;const Gt=je[Ut];Qe(Gt),s(Gt),r(sn=>{const nn=new Set(sn??B);for(const En of cA(Gt))nn.add(En);return nn}),p(0),S.current=!0,w.current=Gt,setTimeout(()=>{var sn;(sn=_.current[Gt])==null||sn.scrollIntoView({behavior:"smooth",block:"center"})},0)},Tt=()=>{if(je.length===0)return;const ct=je[0];Qe(ct),s(ct),r(Ut=>{const Gt=new Set(Ut??B);for(const sn of cA(ct))Gt.add(sn);return Gt}),p(0),S.current=!0,w.current=ct,setTimeout(()=>{var Ut;(Ut=_.current[ct])==null||Ut.scrollIntoView({behavior:"smooth",block:"center"})},0)};return M.useEffect(()=>{C.current=o,o===null&&(S.current=!1,w.current=null)},[o]),M.useEffect(()=>{if(!K||!o||!ne||C.current!==o||(C.current=null,je.length===0))return;const ct=je[0];S.current=!0,w.current=ct;const Ut=window.setTimeout(()=>{var Gt;j!==ct&&(x({targetPath:ct,leftContent:ve??"",rightContent:Ae??""}),s(ct),r(sn=>{const nn=new Set(sn??OI(H));for(const En of cA(ct))nn.add(En);return nn})),p(0),(Gt=_.current[ct])==null||Gt.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(Ut)},[K,o,ne,je,j,ve,Ae,H]),M.useEffect(()=>{if(!K||!j||!S.current||w.current!==null&&w.current!==j||!Ve||!lt)return;const ct=Ke.length>0?Ke[0].startRowIndex:null,Ut=requestAnimationFrame(()=>{var Gt;ct!==null&&((Gt=b.current[ct])==null||Gt.scrollIntoView({behavior:"smooth",block:"center"})),S.current=!1,w.current=null});return()=>cancelAnimationFrame(Ut)},[K,j,Ke,Ve,lt]),f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&O&&f.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3 text-xs",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[f.jsx("span",{className:"truncate font-medium",children:O}),(P==null?void 0:P.created_at)&&f.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:Z1(P.created_at)})]}),f.jsx(Pce,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),f.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[f.jsx("span",{className:"truncate font-medium",children:D}),(N==null?void 0:N.created_at)&&f.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:Z1(N.created_at)})]})]}),f.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[f.jsxs("span",{className:Rt("text-emerald-700 transition-opacity dark:text-emerald-400",$&&"opacity-70"),children:["+",zt]}),f.jsxs("span",{className:Rt("text-red-500 transition-opacity dark:text-red-300",$&&"opacity-70"),children:["-",Dt]})]}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 p-0 text-muted-foreground/70 hover:text-muted-foreground","aria-label":"Stop comparing code runs",onClick:()=>{a(null),x(null),p(0),S.current=!1,w.current=null},children:f.jsx(fu,{className:"h-3.5 w-3.5"})})]}),f.jsx("div",{className:"min-h-0 flex-1",children:L&&!R?f.jsx("div",{className:"h-full min-h-0"}):V?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsx("div",{className:"flex h-10 items-center border-b px-2",children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(eA,{className:"mr-1 h-3.5 w-3.5"}),"Back"]})}),f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load code tree."})]}):R!=null&&R.available?f.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden grid-cols-1 lg:grid-cols-[320px_minmax(0,1fr)]",children:[f.jsxs("div",{className:"flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",children:[f.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(eA,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),f.jsx(PI,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!j})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:Ee(H,0)})]}),f.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[f.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-3",children:[f.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:j??"Select a file"}),j&&f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",onClick:Be,disabled:!We,className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40",title:Et?"Copied!":"Copy code",children:Et?f.jsx(vm,{className:"h-3.5 w-3.5"}):f.jsx(TT,{className:"h-3.5 w-3.5"})}),f.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:ie})]}),K&&j&&f.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-2 text-[11px] tabular-nums",children:[f.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",yt]}),f.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",Pt]})]})]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{className:Rt("h-full overflow-auto",K&&"pb-14"),children:j?K?U&&!F?f.jsx("div",{className:"h-full"}):W?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):o&&!U&&F&&!F.available?f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):ut?f.jsx("div",{className:"h-full"}):ce&&pe&&!Te||te&&me&&!oe?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):$e||Le?f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):f.jsx("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",De&&"opacity-50"),children:it.map((ct,Ut)=>{const Gt=ct.kind==="add"?Ze[(ct.rightLine??1)-1]??k0(ct.text.length>0?ct.text:" ",ie):Ye[(ct.leftLine??1)-1]??k0(ct.text.length>0?ct.text:" ",ie);return f.jsxs("div",{ref:sn=>{ct.kind!=="context"&&(b.current[Ut]=sn)},className:Rt("flex",ct.kind==="add"&&"bg-emerald-500/18",ct.kind==="remove"&&"bg-red-400/10"),children:[f.jsxs("div",{className:Rt("sticky left-0 z-10 flex shrink-0 bg-background",ct.kind==="add"&&"border-l-2 border-emerald-500/60",ct.kind==="remove"&&"border-l-2 border-red-400/35"),children:[f.jsx("span",{className:Rt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",ct.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",ct.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",ct.kind==="context"&&"text-muted-foreground"),children:ct.kind==="add"?"+":ct.kind==="remove"?"-":" "}),f.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",ct.kind==="add"&&"bg-emerald-500/18",ct.kind==="remove"&&"bg-red-400/10"),children:ct.leftLine??""}),f.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",ct.kind==="add"&&"bg-emerald-500/18",ct.kind==="remove"&&"bg-red-400/10"),children:ct.rightLine??""})]}),f.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Gt.map((sn,nn)=>f.jsx("span",{className:Rt(sn.className),children:sn.text},`diff-line-${Ut}-token-${nn}`))})]},`diff-line-${Ut}`)})}):le&&!ke?f.jsx("div",{className:"h-full"}):pe&&!ke?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):Ne?f.jsx("div",{className:Rt("p-4 text-sm text-muted-foreground transition-opacity",re&&"opacity-50"),children:"Binary file preview is not supported."}):f.jsxs("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",re&&"opacity-50"),children:[(ke==null?void 0:ke.truncated)&&f.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),Ce.map((ct,Ut)=>f.jsxs("div",{className:"flex",children:[f.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 bg-background",children:f.jsx("span",{className:"select-none border-r bg-muted/35 w-[3.25rem] px-2 py-0.5 text-right text-[11px] text-muted-foreground",children:Ut+1})}),f.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:ct.map((Gt,sn)=>f.jsx("span",{className:Rt(Gt.className),children:Gt.text},`line-${Ut}-token-${sn}`))})]},`line-${Ut}`))]}):f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),K&&j&&f.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:Ke.length===0?f.jsx("div",{className:"pointer-events-auto rounded-full border border-border/75 bg-background/90 px-2 py-1 backdrop-blur-sm",children:f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:Tt,disabled:je.length===0,children:f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx("span",{children:"See Changes"}),f.jsx(Zg,{className:"h-3.5 w-3.5"})]})})}):f.jsxs("div",{className:"pointer-events-auto flex items-center gap-3 rounded-full border border-border/75 bg-background/90 px-3 py-1 backdrop-blur-sm",children:[f.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>ht(-1),disabled:Ke.length===0,children:f.jsx(M7,{className:"h-3.5 w-3.5"})}),f.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[Lt," / ",Ke.length]}),f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>ht(1),disabled:Ke.length===0,children:f.jsx(Ir,{className:"h-3.5 w-3.5"})})]}),f.jsx("div",{className:"h-4 w-px bg-border"}),f.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>It(-1),disabled:je.length===0,children:f.jsx(w7,{className:"h-3.5 w-3.5"})}),f.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[wt," / ",je.length," files"]}),f.jsx(Mn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>It(1),disabled:je.length===0,children:f.jsx(Zg,{className:"h-3.5 w-3.5"})})]})]})})]})]})]}):f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(eA,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),f.jsx(PI,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!j})]}),f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"This run does not have a local `code/source.zip` extracted yet."})]})})]})}function bm({description:t}){const e=Jn(MG),n=$d(TG),r=$d(CG),{data:i,isLoading:s}=ym(),o=(i==null?void 0:i.runs)??[],a=i==null?void 0:i.discovery,l=(i==null?void 0:i.has_wandb_key)??e,c=o.length>0,d=(i==null?void 0:i.has_known_projects)??!1,p=(a==null?void 0:a.status)==="discovering",m=!s&&!p&&!l&&!c,x=!s&&!p&&!m&&l&&!c&&!d,b=!m&&!x&&!c;return p?f.jsx("div",{className:"flex h-full items-center justify-center p-8",children:f.jsx(Ju,{className:"max-w-md w-full border-dashed",children:f.jsxs(AI,{className:"items-center text-center",children:[f.jsx(a4,{children:"Fetching runs from W&B…"}),f.jsxs(l4,{className:"flex items-center gap-1.5 font-medium",children:[f.jsx(hl,{className:"h-3 w-3 shrink-0"}),(a==null?void 0:a.runs_found)??0," found"]})]})})}):b?f.jsx("div",{className:"flex h-full items-center justify-center p-8",children:f.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"})}):f.jsx("div",{className:"flex h-full items-center justify-center p-8",children:f.jsx(Ju,{className:"max-w-md w-full border-dashed",children:f.jsx(AI,{className:"text-center items-center",children:m?f.jsxs(f.Fragment,{children:[f.jsx(a4,{children:"No wandb key added yet"}),f.jsx(l4,{children:"Add your W&B API key to discover and sync runs."}),f.jsx(Mn,{className:"mt-4 bg-green-600 hover:bg-green-700",onClick:()=>n(!0),children:"Add wandb key"})]}):x?f.jsxs(f.Fragment,{children:[f.jsx(a4,{children:"Add a project"}),f.jsx(l4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),f.jsx(Mn,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):f.jsxs(f.Fragment,{children:[f.jsx(a4,{children:"No Run Selected"}),f.jsx(l4,{children:t})]})})})})}const Nhe=!0,ma="u-",Rhe="uplot",khe=ma+"hz",Dhe=ma+"vt",Phe=ma+"title",Ihe=ma+"wrap",Ohe=ma+"under",Lhe=ma+"over",jhe=ma+"axis",Ig=ma+"off",zhe=ma+"select",Fhe=ma+"cursor-x",Uhe=ma+"cursor-y",Bhe=ma+"cursor-pt",Hhe=ma+"legend",Vhe=ma+"live",Ghe=ma+"inline",Whe=ma+"series",$he=ma+"marker",LI=ma+"label",qhe=ma+"value",__="width",S_="height",Kb="top",jI="bottom",kv="left",uA="right",H7="#000",zI=H7+"0",dA="mousemove",FI="mousedown",fA="mouseup",UI="mouseenter",BI="mouseleave",HI="dblclick",Xhe="resize",Yhe="scroll",VI="change",P2="dppxchange",V7="--",Ny=typeof window<"u",aR=Ny?document:null,w1=Ny?window:null,Khe=Ny?navigator:null;let Ri,c4;function lR(){let t=devicePixelRatio;Ri!=t&&(Ri=t,c4&&uR(VI,c4,lR),c4=matchMedia(`(min-resolution: ${Ri-.001}dppx) and (max-resolution: ${Ri+.001}dppx)`),Jg(VI,c4,lR),w1.dispatchEvent(new CustomEvent(P2)))}function qc(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function cR(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function Es(t,e,n){t.style[e]=n+"px"}function zd(t,e,n,r){let i=aR.createElement(t);return e!=null&&qc(i,e),n!=null&&n.insertBefore(i,r),i}function Uu(t,e){return zd("div",t,e)}const GI=new WeakMap;function kf(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=GI.get(t);s!=o&&(t.style.transform=s,GI.set(t,s),e<0||n<0||e>r||n>i?qc(t,Ig):cR(t,Ig))}const WI=new WeakMap;function $I(t,e,n){let r=e+n,i=WI.get(t);r!=i&&(WI.set(t,r),t.style.background=e,t.style.borderColor=n)}const qI=new WeakMap;function XI(t,e,n,r){let i=e+""+n,s=qI.get(t);i!=s&&(qI.set(t,i),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=r?-e/2+"px":0,t.style.marginTop=r?-n/2+"px":0)}const G7={passive:!0},Zhe={...G7,capture:!0};function Jg(t,e,n,r){e.addEventListener(t,n,r?Zhe:G7)}function uR(t,e,n,r){e.removeEventListener(t,n,G7)}Ny&&lR();function Hd(t,e,n,r){let i;n=n||0,r=r||e.length-1;let s=r<=2147483647;for(;r-n>1;)i=s?n+r>>1:iu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function PW(t){return(n,r,i)=>{let s=-1,o=-1;for(let a=r;a<=i;a++)if(t(n[a])){s=a;break}for(let a=i;a>=r;a--)if(t(n[a])){o=a;break}return[s,o]}}const IW=t=>t!=null,OW=t=>t!=null&&t>0,LT=PW(IW),Qhe=PW(OW);function Jhe(t,e,n,r=0,i=!1){let s=i?Qhe:LT,o=i?OW:IW;[e,n]=s(t,e,n);let a=t[e],l=t[e];if(e>-1)if(r==1)a=t[e],l=t[n];else if(r==-1)a=t[n],l=t[e];else for(let c=e;c<=n;c++){let d=t[c];o(d)&&(d<a?a=d:d>l&&(l=d))}return[a??ts,l??-ts]}function jT(t,e,n,r){let i=ZI(t),s=ZI(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?dp:LW,a=i==1?iu:Wu,l=s==1?Wu:iu,c=a(o(ia(t))),d=l(o(ia(e))),p=ey(n,c),m=ey(n,d);return n==10&&(c<0&&(p=ns(p,-c)),d<0&&(m=ns(m,-d))),r||n==2?(t=p*i,e=m*s):(t=UW(t,p),e=zT(e,m)),[t,e]}function W7(t,e,n,r){let i=jT(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const $7=.1,YI={mode:3,pad:$7},P_={pad:0,soft:null,mode:0},epe={min:P_,max:P_};function I2(t,e,n,r){return FT(n)?KI(t,e,n):(P_.pad=n,P_.soft=r?0:null,P_.mode=r?3:0,KI(t,e,epe))}function Ti(t,e){return t??e}function tpe(t,e,n){for(e=Ti(e,0),n=Ti(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function KI(t,e,n){let r=n.min,i=n.max,s=Ti(r.pad,0),o=Ti(i.pad,0),a=Ti(r.hard,-ts),l=Ti(i.hard,ts),c=Ti(r.soft,ts),d=Ti(i.soft,-ts),p=Ti(r.mode,0),m=Ti(i.mode,0),x=e-t,b=dp(x),_=Vl(ia(t),ia(e)),S=dp(_),w=ia(S-b);(x<1e-24||w>10)&&(x=0,(t==0||e==0)&&(x=1e-24,p==2&&c!=ts&&(s=0),m==2&&d!=-ts&&(o=0)));let C=x||_||1e3,A=dp(C),N=ey(10,iu(A)),D=C*(x==0?t==0?.1:1:s),P=ns(UW(t-D,N/10),24),O=t>=c&&(p==1||p==3&&P<=c||p==2&&P>=c)?c:ts,R=Vl(a,P<O&&t>=O?O:Gd(O,P)),L=C*(x==0?e==0?.1:1:o),V=ns(zT(e+L,N/10),24),F=e<=d&&(m==1||m==3&&V>=d||m==2&&V<=d)?d:-ts,U=Gd(l,V>F&&e<=F?F:Vl(F,V));return R==U&&R==0&&(U=100),[R,U]}const npe=new Intl.NumberFormat(Ny?Khe.language:"en-US"),q7=t=>npe.format(t),hu=Math,BM=hu.PI,ia=hu.abs,iu=hu.floor,na=hu.round,Wu=hu.ceil,Gd=hu.min,Vl=hu.max,ey=hu.pow,ZI=hu.sign,dp=hu.log10,LW=hu.log2,rpe=(t,e=1)=>hu.sinh(t)*e,hA=(t,e=1)=>hu.asinh(t/e),ts=1/0;function QI(t){return(dp((t^t>>31)-(t>>31))|0)+1}function dR(t,e,n){return Gd(Vl(t,e),n)}function jW(t){return typeof t=="function"}function oi(t){return jW(t)?t:()=>t}const ipe=()=>{},zW=t=>t,FW=(t,e)=>e,spe=t=>null,JI=t=>!0,eO=(t,e)=>t==e,ope=/\.\d*?(?=9{6,}|0{6,})/gm,fx=t=>{if(HW(t)||tm.has(t))return t;const e=`${t}`,n=e.match(ope);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${fx(i)}e${s}`}return ns(t,r)};function Ag(t,e){return fx(ns(fx(t/e))*e)}function zT(t,e){return fx(Wu(fx(t/e))*e)}function UW(t,e){return fx(iu(fx(t/e))*e)}function ns(t,e=0){if(HW(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return na(r)/n}const tm=new Map;function BW(t){return((""+t).split(".")[1]||"").length}function gS(t,e,n,r){let i=[],s=r.map(BW);for(let o=e;o<n;o++){let a=ia(o),l=ns(ey(t,o),a);for(let c=0;c<r.length;c++){let d=t==10?+`${r[c]}e${o}`:r[c]*l,p=(o>=0?0:a)+(o>=s[c]?0:s[c]),m=t==10?d:ns(d,p);i.push(m),tm.set(m,p)}}return i}const I_={},X7=[],ty=[null,null],D0=Array.isArray,HW=Number.isInteger,ape=t=>t===void 0;function tO(t){return typeof t=="string"}function FT(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function lpe(t){return t!=null&&typeof t=="object"}const cpe=Object.getPrototypeOf(Uint8Array),VW="__proto__";function ny(t,e=FT){let n;if(D0(t)){let r=t.find(i=>i!=null);if(D0(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=ny(t[i],e)}else n=t.slice()}else if(t instanceof cpe)n=t.slice();else if(e(t)){n={};for(let r in t)r!=VW&&(n[r]=ny(t[r],e))}else n=t;return n}function Ho(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=VW&&(FT(t[i])?Ho(t[i],ny(r[i])):t[i]=ny(r[i]))}return t}const upe=0,dpe=1,fpe=2;function hpe(t,e,n){for(let r=0,i,s=-1;r<e.length;r++){let o=e[r];if(o>s){for(i=o-1;i>=0&&t[i]==null;)t[i--]=null;for(i=o+1;i<n&&t[i]==null;)t[s=i++]=null}}}function ppe(t,e){if(xpe(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return vpe(o[0])||(o=gpe(o)),o}let n=new Set;for(let o=0;o<t.length;o++){let l=t[o][0],c=l.length;for(let d=0;d<c;d++)n.add(l[d])}let r=[Array.from(n).sort((o,a)=>o-a)],i=r[0].length,s=new Map;for(let o=0;o<i;o++)s.set(r[0][o],o);for(let o=0;o<t.length;o++){let a=t[o],l=a[0];for(let c=1;c<a.length;c++){let d=a[c],p=Array(i).fill(void 0),m=e?e[o][c]:dpe,x=[];for(let b=0;b<d.length;b++){let _=d[b],S=s.get(l[b]);_===null?m!=upe&&(p[S]=_,m==fpe&&x.push(S)):p[S]=_}hpe(p,x,i),r.push(p)}}return r}const mpe=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function gpe(t){let e=t[0],n=e.length,r=Array(n);for(let s=0;s<r.length;s++)r[s]=s;r.sort((s,o)=>e[s]-e[o]);let i=[];for(let s=0;s<t.length;s++){let o=t[s],a=Array(n);for(let l=0;l<n;l++)a[l]=o[r[l]];i.push(a)}return i}function xpe(t){let e=t[0][0],n=e.length;for(let r=1;r<t.length;r++){let i=t[r][0];if(i.length!=n)return!1;if(i!=e){for(let s=0;s<n;s++)if(i[s]!=e[s])return!1}}return!0}function vpe(t,e=100){const n=t.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&t[r]==null;)r++;for(;i>=r&&t[i]==null;)i--;if(i<=r)return!0;const s=Vl(1,iu((i-r+1)/e));for(let o=t[r],a=r+s;a<=i;a+=s){const l=t[a];if(l!=null){if(l<=o)return!1;o=l}}return!0}const GW=["January","February","March","April","May","June","July","August","September","October","November","December"],WW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function $W(t){return t.slice(0,3)}const ype=WW.map($W),bpe=GW.map($W),_pe={MMMM:GW,MMM:bpe,WWWW:WW,WWW:ype};function Zb(t){return(t<10?"0":"")+t}function Spe(t){return(t<10?"00":t<100?"0":"")+t}const wpe={YYYY:t=>t.getFullYear(),YY:t=>(t.getFullYear()+"").slice(2),MMMM:(t,e)=>e.MMMM[t.getMonth()],MMM:(t,e)=>e.MMM[t.getMonth()],MM:t=>Zb(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Zb(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Zb(t.getHours()),H:t=>t.getHours(),h:t=>{let e=t.getHours();return e==0?12:e>12?e-12:e},AA:t=>t.getHours()>=12?"PM":"AM",aa:t=>t.getHours()>=12?"pm":"am",a:t=>t.getHours()>=12?"p":"a",mm:t=>Zb(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Zb(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>Spe(t.getMilliseconds())};function Y7(t,e){e=e||_pe;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?wpe[i[1]]:i[0]);return s=>{let o="";for(let a=0;a<n.length;a++)o+=typeof n[a]=="string"?n[a]:n[a](s,e);return o}}const Mpe=new Intl.DateTimeFormat().resolvedOptions().timeZone;function Tpe(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==Mpe?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const qW=t=>t%1==0,O2=[1,2,2.5,5],Cpe=gS(10,-32,0,O2),XW=gS(10,0,32,O2),Epe=XW.filter(qW),Ng=Cpe.concat(XW),K7=`
`,YW="{YYYY}",nO=K7+YW,KW="{M}/{D}",w_=K7+KW,u4=w_+"/{YY}",ZW="{aa}",Ape="{h}:{mm}",o1=Ape+ZW,rO=K7+o1,iO=":{ss}",ji=null;function QW(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?gS(10,0,3,O2).filter(qW):gS(10,-3,0,O2)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,s,s*2,s*3,s*4,s*6,o,o*2,o*5,o*10,o*25,o*50,o*100]);const c=[[o,YW,ji,ji,ji,ji,ji,ji,1],[i*28,"{MMM}",nO,ji,ji,ji,ji,ji,1],[i,KW,nO,ji,ji,ji,ji,ji,1],[r,"{h}"+ZW,u4,ji,w_,ji,ji,ji,1],[n,o1,u4,ji,w_,ji,ji,ji,1],[e,iO,u4+" "+o1,ji,w_+" "+o1,ji,rO,ji,1],[t,iO+".{fff}",u4+" "+o1,ji,w_+" "+o1,ji,rO,ji,1]];function d(p){return(m,x,b,_,S,w)=>{let C=[],A=S>=o,N=S>=s&&S<o,D=p(b),P=ns(D*t,3),O=pA(D.getFullYear(),A?0:D.getMonth(),N||A?1:D.getDate()),R=ns(O*t,3);if(N||A){let L=N?S/s:0,V=A?S/o:0,F=P==R?P:ns(pA(O.getFullYear()+V,O.getMonth()+L,1)*t,3),U=new Date(na(F/t)),W=U.getFullYear(),Y=U.getMonth();for(let $=0;F<=_;$++){let X=pA(W+V*$,Y+L*$,1),Z=X-p(ns(X*t,3));F=ns((+X+Z)*t,3),F<=_&&C.push(F)}}else{let L=S>=i?i:S,V=iu(b)-iu(P),F=R+V+zT(P-R,L);C.push(F);let U=p(F),W=U.getHours()+U.getMinutes()/n+U.getSeconds()/r,Y=S/r,$=m.axes[x]._space,X=w/$;for(;F=ns(F+S,t==1?0:3),!(F>_);)if(Y>1){let Z=iu(ns(W+Y,6))%24,H=p(F).getHours()-Z;H>1&&(H=-1),F-=H*r,W=(W+Y)%24;let B=C[C.length-1];ns((F-B)/S,3)*X>=.7&&C.push(F)}else C.push(F)}return C}}return[l,c,d]}const[Npe,Rpe,kpe]=QW(1),[Dpe,Ppe,Ipe]=QW(.001);gS(2,-53,53,[1]);function sO(t,e){return t.map(n=>n.map((r,i)=>i==0||i==8||r==null?r:e(i==1||n[8]==0?r:n[1]+r)))}function oO(t,e){return(n,r,i,s,o)=>{let a=e.find(b=>o>=b[0])||e[e.length-1],l,c,d,p,m,x;return r.map(b=>{let _=t(b),S=_.getFullYear(),w=_.getMonth(),C=_.getDate(),A=_.getHours(),N=_.getMinutes(),D=_.getSeconds(),P=S!=l&&a[2]||w!=c&&a[3]||C!=d&&a[4]||A!=p&&a[5]||N!=m&&a[6]||D!=x&&a[7]||a[1];return l=S,c=w,d=C,p=A,m=N,x=D,P(_)})}}function Ope(t,e){let n=Y7(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function pA(t,e,n){return new Date(t,e,n)}function aO(t,e){return e(t)}const Lpe="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function lO(t,e){return(n,r,i,s)=>s==null?V7:e(t(r))}function jpe(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function zpe(t,e){return t.series[e].fill(t,e)}const Fpe={show:!0,live:!0,isolate:!1,mount:ipe,markers:{show:!0,width:2,stroke:jpe,fill:zpe,dash:"solid"},idx:null,idxs:null,values:[]};function Upe(t,e){let n=t.cursor.points,r=Uu(),i=n.size(t,e);Es(r,__,i),Es(r,S_,i);let s=i/-2;Es(r,"marginLeft",s),Es(r,"marginTop",s);let o=n.width(t,e,i);return o&&Es(r,"borderWidth",o),r}function Bpe(t,e){let n=t.series[e].points;return n._fill||n._stroke}function Hpe(t,e){let n=t.series[e].points;return n._stroke||n._fill}function Vpe(t,e){return t.series[e].points.size}const mA=[0,0];function Gpe(t,e,n){return mA[0]=e,mA[1]=n,mA}function d4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function gA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const Wpe={show:!0,x:!0,y:!0,lock:!1,move:Gpe,points:{one:!1,show:Upe,size:Vpe,width:0,stroke:Hpe,fill:Bpe},bind:{mousedown:d4,mouseup:d4,click:d4,dblclick:d4,mousemove:gA,mouseleave:gA,mouseenter:gA},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},JW={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Z7=Ho({},JW,{filter:FW}),e$=Ho({},Z7,{size:10}),t$=Ho({},JW,{show:!1}),Q7='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',n$="bold "+Q7,r$=1.5,cO={show:!0,scale:"x",stroke:H7,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:n$,side:2,grid:Z7,ticks:e$,border:t$,font:Q7,lineGap:r$,rotate:0},$pe="Value",qpe="Time",uO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function Xpe(t,e,n,r,i){return e.map(s=>s==null?"":q7(s))}function Ype(t,e,n,r,i,s,o){let a=[],l=tm.get(i)||0;n=o?n:ns(zT(n,i),l);for(let c=n;c<=r;c=ns(c+i,l))a.push(Object.is(c,-0)?0:c);return a}function fR(t,e,n,r,i,s,o){const a=[],l=t.scales[t.axes[e].scale].log,c=l==10?dp:LW,d=iu(c(n));i=ey(l,d),l==10&&(i=Ng[Hd(i,Ng)]);let p=n,m=i*l;l==10&&(m=Ng[Hd(m,Ng)]);do a.push(p),p=p+i,l==10&&!tm.has(p)&&(p=ns(p,tm.get(i))),p>=m&&(i=p,m=i*l,l==10&&(m=Ng[Hd(m,Ng)]));while(p<=r);return a}function Kpe(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?fR(t,e,Vl(l,n),r,i):[l],d=r>=0&&n<=0?[0]:[];return(n<-l?fR(t,e,Vl(l,-r),-n,i):[l]).reverse().map(m=>-m).concat(d,c)}const i$=/./,Zpe=/[12357]/,Qpe=/[125]/,dO=/1/,hR=(t,e,n,r)=>t.map((i,s)=>e==4&&i==0||s%r==0&&n.test(i.toExponential()[i<0?1:0])?i:null);function Jpe(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=t.scales[o],l=t.valToPos,c=s._space,d=l(10,o),p=l(9,o)-d>=c?i$:l(7,o)-d>=c?Zpe:l(5,o)-d>=c?Qpe:dO;if(p==dO){let m=ia(l(1,o)-d);if(m<c)return hR(e.slice().reverse(),a.distr,p,Wu(c/m)).reverse()}return hR(e,a.distr,p,1)}function e0e(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=s._space,l=t.valToPos,c=ia(l(1,o)-l(2,o));return c<a?hR(e.slice().reverse(),3,i$,Wu(a/c)).reverse():e}function t0e(t,e,n,r){return r==null?V7:e==null?"":q7(e)}const fO={show:!0,scale:"y",stroke:H7,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:n$,side:3,grid:Z7,ticks:e$,border:t$,font:Q7,lineGap:r$,rotate:0};function n0e(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function r0e(t,e){let{scale:n,idxs:r}=t.series[0],i=t._data[0],s=t.valToPos(i[r[0]],n,!0),o=t.valToPos(i[r[1]],n,!0),a=ia(o-s),l=t.series[e],c=a/(l.points.space*Ri);return r[1]-r[0]<=c}const hO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},s$=(t,e,n,r,i)=>i,pO={show:!0,auto:!0,sorted:0,gaps:s$,alpha:1,facets:[Ho({},hO,{scale:"x"}),Ho({},hO,{scale:"y"})]},mO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:s$,alpha:1,points:{show:r0e,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function i0e(t,e,n,r,i){return n/10}const o$={time:Nhe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},s0e=Ho({},o$,{time:!1,ori:1}),gO={};function a$(t,e){let n=gO[t];return n||(n={key:t,plots:[],sub(r){n.plots.push(r)},unsub(r){n.plots=n.plots.filter(i=>i!=r)},pub(r,i,s,o,a,l,c){for(let d=0;d<n.plots.length;d++)n.plots[d]!=i&&n.plots[d].pub(r,i,s,o,a,l,c)}},t!=null&&(gO[t]=n)),n}const ry=1,pR=2;function Ax(t,e,n){const r=t.mode,i=t.series[e],s=r==2?t._data[e]:t._data,o=t.scales,a=t.bbox;let l=s[0],c=r==2?s[1]:s[e],d=r==2?o[i.facets[0].scale]:o[t.series[0].scale],p=r==2?o[i.facets[1].scale]:o[i.scale],m=a.left,x=a.top,b=a.width,_=a.height,S=t.valToPosH,w=t.valToPosV;return d.ori==0?n(i,l,c,d,p,S,w,m,x,b,_,BT,Ry,VT,c$,d$):n(i,l,c,d,p,w,S,x,m,_,b,HT,ky,t8,u$,f$)}function J7(t,e){let n=0,r=0,i=Ti(t.bands,X7);for(let s=0;s<i.length;s++){let o=i[s];o.series[0]==e?n=o.dir:o.series[1]==e&&(o.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function o0e(t,e,n,r,i){let s=t.mode,o=t.series[e],a=s==2?o.facets[1].scale:o.scale,l=t.scales[a];return i==-1?l.min:i==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function fp(t,e,n,r,i,s){return Ax(t,e,(o,a,l,c,d,p,m,x,b,_,S)=>{let w=o.pxRound;const C=c.dir*(c.ori==0?1:-1),A=c.ori==0?Ry:ky;let N,D;C==1?(N=n,D=r):(N=r,D=n);let P=w(p(a[N],c,_,x)),O=w(m(l[N],d,S,b)),R=w(p(a[D],c,_,x)),L=w(m(s==1?d.max:d.min,d,S,b)),V=new Path2D(i);return A(V,R,L),A(V,P,L),A(V,P,O),V})}function UT(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?VT:t8;let l=n;for(let p=0;p<t.length;p++){let m=t[p];if(m[1]>m[0]){let x=m[0]-l;x>0&&a(o,l,r,x,r+s),l=m[1]}}let c=n+i-l,d=10;c>0&&a(o,l,r-d/2,c,r+s+d)}return o}function a0e(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function e8(t,e,n,r,i,s,o){let a=[],l=t.length;for(let c=i==1?n:r;c>=n&&c<=r;c+=i)if(e[c]===null){let p=c,m=c;if(i==1)for(;++c<=r&&e[c]===null;)m=c;else for(;--c>=n&&e[c]===null;)m=c;let x=s(t[p]),b=m==p?x:s(t[m]),_=p-i;x=o<=0&&_>=0&&_<l?s(t[_]):x;let w=m+i;b=o>=0&&w>=0&&w<l?s(t[w]):b,b>=x&&a.push([x,b])}return a}function xO(t){return t==0?zW:t==1?na:e=>Ag(e,t)}function l$(t){let e=t==0?BT:HT,n=t==0?(i,s,o,a,l,c)=>{i.arcTo(s,o,a,l,c)}:(i,s,o,a,l,c)=>{i.arcTo(o,s,l,a,c)},r=t==0?(i,s,o,a,l)=>{i.rect(s,o,a,l)}:(i,s,o,a,l)=>{i.rect(o,s,l,a)};return(i,s,o,a,l,c=0,d=0)=>{c==0&&d==0?r(i,s,o,a,l):(c=Gd(c,a/2,l/2),d=Gd(d,a/2,l/2),e(i,s+c,o),n(i,s+a,o,s+a,o+l,c),n(i,s+a,o+l,s,o+l,d),n(i,s,o+l,s,o,d),n(i,s,o,s+a,o,c),i.closePath())}}const BT=(t,e,n)=>{t.moveTo(e,n)},HT=(t,e,n)=>{t.moveTo(n,e)},Ry=(t,e,n)=>{t.lineTo(e,n)},ky=(t,e,n)=>{t.lineTo(n,e)},VT=l$(0),t8=l$(1),c$=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},u$=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},d$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},f$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function h$(t){return(e,n,r,i,s)=>Ax(e,n,(o,a,l,c,d,p,m,x,b,_,S)=>{let{pxRound:w,points:C}=o,A,N;c.ori==0?(A=BT,N=c$):(A=HT,N=u$);const D=ns(C.width*Ri,3);let P=(C.size-C.width)/2*Ri,O=ns(P*2,3),R=new Path2D,L=new Path2D,{left:V,top:F,width:U,height:W}=e.bbox;VT(L,V-O,F-O,U+O*2,W+O*2);const Y=$=>{if(l[$]!=null){let X=w(p(a[$],c,_,x)),Z=w(m(l[$],d,S,b));A(R,X+P,Z),N(R,X,Z,P,0,BM*2)}};if(s)s.forEach(Y);else for(let $=r;$<=i;$++)Y($);return{stroke:D>0?R:null,fill:R,clip:L,flags:ry|pR}})}function p$(t){return(e,n,r,i,s,o)=>{r!=i&&(s!=r&&o!=r&&t(e,n,r),s!=i&&o!=i&&t(e,n,i),t(e,n,o))}}const l0e=p$(Ry),c0e=p$(ky);function m$(t){const e=Ti(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>Ax(n,r,(o,a,l,c,d,p,m,x,b,_,S)=>{[i,s]=LT(l,i,s);let w=o.pxRound,C=W=>w(p(W,c,_,x)),A=W=>w(m(W,d,S,b)),N,D;c.ori==0?(N=Ry,D=l0e):(N=ky,D=c0e);const P=c.dir*(c.ori==0?1:-1),O={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:ry},R=O.stroke;let L=!1;if(s-i>=_*4){let W=j=>n.posToVal(j,c.key,!0),Y=null,$=null,X,Z,K,ne=C(a[P==1?i:s]),H=C(a[i]),B=C(a[s]),G=W(P==1?H+1:B-1);for(let j=P==1?i:s;j>=i&&j<=s;j+=P){let ie=a[j],te=(P==1?ie<G:ie>G)?ne:C(ie),se=l[j];te==ne?se!=null?(Z=se,Y==null?(N(R,te,A(Z)),X=Y=$=Z):Z<Y?Y=Z:Z>$&&($=Z)):se===null&&(L=!0):(Y!=null&&D(R,ne,A(Y),A($),A(X),A(Z)),se!=null?(Z=se,N(R,te,A(Z)),Y=$=X=Z):(Y=$=null,se===null&&(L=!0)),ne=te,G=W(ne+P))}Y!=null&&Y!=$&&K!=ne&&D(R,ne,A(Y),A($),A(X),A(Z))}else for(let W=P==1?i:s;W>=i&&W<=s;W+=P){let Y=l[W];Y===null?L=!0:Y!=null&&N(R,C(a[W]),A(Y))}let[F,U]=J7(n,r);if(o.fill!=null||F!=0){let W=O.fill=new Path2D(R),Y=o.fillTo(n,r,o.min,o.max,F),$=A(Y),X=C(a[i]),Z=C(a[s]);P==-1&&([Z,X]=[X,Z]),N(W,Z,$),N(W,X,$)}if(!o.spanGaps){let W=[];L&&W.push(...e8(a,l,i,s,P,C,e)),O.gaps=W=o.gaps(n,r,i,s,W),O.clip=UT(W,c.ori,x,b,_,S)}return U!=0&&(O.band=U==2?[fp(n,r,i,s,R,-1),fp(n,r,i,s,R,1)]:fp(n,r,i,s,R,U)),O})}function u0e(t){const e=Ti(t.align,1),n=Ti(t.ascDesc,!1),r=Ti(t.alignGaps,0),i=Ti(t.extend,!1);return(s,o,a,l)=>Ax(s,o,(c,d,p,m,x,b,_,S,w,C,A)=>{[a,l]=LT(p,a,l);let N=c.pxRound,{left:D,width:P}=s.bbox,O=H=>N(b(H,m,C,S)),R=H=>N(_(H,x,A,w)),L=m.ori==0?Ry:ky;const V={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:ry},F=V.stroke,U=m.dir*(m.ori==0?1:-1);let W=R(p[U==1?a:l]),Y=O(d[U==1?a:l]),$=Y,X=Y;i&&e==-1&&(X=D,L(F,X,W)),L(F,Y,W);for(let H=U==1?a:l;H>=a&&H<=l;H+=U){let B=p[H];if(B==null)continue;let G=O(d[H]),j=R(B);e==1?L(F,G,W):L(F,$,j),L(F,G,j),W=j,$=G}let Z=$;i&&e==1&&(Z=D+P,L(F,Z,W));let[K,ne]=J7(s,o);if(c.fill!=null||K!=0){let H=V.fill=new Path2D(F),B=c.fillTo(s,o,c.min,c.max,K),G=R(B);L(H,Z,G),L(H,X,G)}if(!c.spanGaps){let H=[];H.push(...e8(d,p,a,l,U,O,r));let B=c.width*Ri/2,G=n||e==1?B:-B,j=n||e==-1?-B:B;H.forEach(ie=>{ie[0]+=G,ie[1]+=j}),V.gaps=H=c.gaps(s,o,a,l,H),V.clip=UT(H,m.ori,S,w,C,A)}return ne!=0&&(V.band=ne==2?[fp(s,o,a,l,F,-1),fp(s,o,a,l,F,1)]:fp(s,o,a,l,F,ne)),V})}function vO(t,e,n,r,i,s,o=ts){if(t.length>1){let a=null;for(let l=0,c=1/0;l<t.length;l++)if(e[l]!==void 0){if(a!=null){let d=ia(t[l]-t[a]);d<c&&(c=d,o=ia(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function d0e(t){t=t||I_;const e=Ti(t.size,[.6,ts,1]),n=t.align||0,r=t.gap||0;let i=t.radius;i=i==null?[0,0]:typeof i=="number"?[i,0]:i;const s=oi(i),o=1-e[0],a=Ti(e[1],ts),l=Ti(e[2],1),c=Ti(t.disp,I_),d=Ti(t.each,x=>{}),{fill:p,stroke:m}=c;return(x,b,_,S)=>Ax(x,b,(w,C,A,N,D,P,O,R,L,V,F)=>{let U=w.pxRound,W=n,Y=r*Ri,$=a*Ri,X=l*Ri,Z,K;N.ori==0?[Z,K]=s(x,b):[K,Z]=s(x,b);const ne=N.dir*(N.ori==0?1:-1);let H=N.ori==0?VT:t8,B=N.ori==0?d:(fe,Se,Ae,ve,qe,Ee,Ce)=>{d(fe,Se,Ae,qe,ve,Ce,Ee)},G=Ti(x.bands,X7).find(fe=>fe.series[0]==b),j=G!=null?G.dir:0,ie=w.fillTo(x,b,w.min,w.max,j),ce=U(O(ie,D,F,L)),te,se,le,re=V,pe=U(w.width*Ri),be=!1,xe=null,Pe=null,me=null,ke=null;p!=null&&(pe==0||m!=null)&&(be=!0,xe=p.values(x,b,_,S),Pe=new Map,new Set(xe).forEach(fe=>{fe!=null&&Pe.set(fe,new Path2D)}),pe>0&&(me=m.values(x,b,_,S),ke=new Map,new Set(me).forEach(fe=>{fe!=null&&ke.set(fe,new Path2D)})));let{x0:we,size:Te}=c;if(we!=null&&Te!=null){W=1,C=we.values(x,b,_,S),we.unit==2&&(C=C.map(Ae=>x.posToVal(R+Ae*V,N.key,!0)));let fe=Te.values(x,b,_,S);Te.unit==2?se=fe[0]*V:se=P(fe[0],N,V,R)-P(0,N,V,R),re=vO(C,A,P,N,V,R,re),le=re-se+Y}else re=vO(C,A,P,N,V,R,re),le=re*o+Y,se=re-le;le<1&&(le=0),pe>=se/2&&(pe=0),le<5&&(U=zW);let oe=le>0,_e=re-le-(oe?pe:0);se=U(dR(_e,X,$)),te=(W==0?se/2:W==ne?0:se)-W*ne*((W==0?Y/2:0)+(oe?pe/2:0));const Fe={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ue=be?null:new Path2D;let Oe=null;if(G!=null)Oe=x.data[G.series[1]];else{let{y0:fe,y1:Se}=c;fe!=null&&Se!=null&&(A=Se.values(x,b,_,S),Oe=fe.values(x,b,_,S))}let ue=Z*se,Q=K*se;for(let fe=ne==1?_:S;fe>=_&&fe<=S;fe+=ne){let Se=A[fe];if(Se==null)continue;if(Oe!=null){let it=Oe[fe]??0;if(Se-it==0)continue;ce=O(it,D,F,L)}let Ae=N.distr!=2||c!=null?C[fe]:fe,ve=P(Ae,N,V,R),qe=O(Ti(Se,ie),D,F,L),Ee=U(ve-te),Ce=U(Vl(qe,ce)),Ye=U(Gd(qe,ce)),Ze=Ce-Ye;if(Se!=null){let it=Se<0?Q:ue,ut=Se<0?ue:Q;be?(pe>0&&me[fe]!=null&&H(ke.get(me[fe]),Ee,Ye+iu(pe/2),se,Vl(0,Ze-pe),it,ut),xe[fe]!=null&&H(Pe.get(xe[fe]),Ee,Ye+iu(pe/2),se,Vl(0,Ze-pe),it,ut)):H(Ue,Ee,Ye+iu(pe/2),se,Vl(0,Ze-pe),it,ut),B(x,b,fe,Ee-pe/2,Ye,se+pe,Ze)}}return pe>0?Fe.stroke=be?ke:Ue:be||(Fe._fill=w.width==0?w._fill:w._stroke??w._fill,Fe.width=0),Fe.fill=be?Pe:Ue,Fe})}function f0e(t,e){const n=Ti(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>Ax(r,i,(a,l,c,d,p,m,x,b,_,S,w)=>{[s,o]=LT(c,s,o);let C=a.pxRound,A=Z=>C(m(Z,d,S,b)),N=Z=>C(x(Z,p,w,_)),D,P,O;d.ori==0?(D=BT,O=Ry,P=d$):(D=HT,O=ky,P=f$);const R=d.dir*(d.ori==0?1:-1);let L=A(l[R==1?s:o]),V=L,F=[],U=[];for(let Z=R==1?s:o;Z>=s&&Z<=o;Z+=R)if(c[Z]!=null){let ne=l[Z],H=A(ne);F.push(V=H),U.push(N(c[Z]))}const W={stroke:t(F,U,D,O,P,C),fill:null,clip:null,band:null,gaps:null,flags:ry},Y=W.stroke;let[$,X]=J7(r,i);if(a.fill!=null||$!=0){let Z=W.fill=new Path2D(Y),K=a.fillTo(r,i,a.min,a.max,$),ne=N(K);O(Z,V,ne),O(Z,L,ne)}if(!a.spanGaps){let Z=[];Z.push(...e8(l,c,s,o,R,A,n)),W.gaps=Z=a.gaps(r,i,s,o,Z),W.clip=UT(Z,d.ori,b,_,S,w)}return X!=0&&(W.band=X==2?[fp(r,i,s,o,Y,-1),fp(r,i,s,o,Y,1)]:fp(r,i,s,o,Y,X)),W})}function h0e(t){return f0e(p0e,t)}function p0e(t,e,n,r,i,s){const o=t.length;if(o<2)return null;const a=new Path2D;if(n(a,t[0],e[0]),o==2)r(a,t[1],e[1]);else{let l=Array(o),c=Array(o-1),d=Array(o-1),p=Array(o-1);for(let m=0;m<o-1;m++)d[m]=e[m+1]-e[m],p[m]=t[m+1]-t[m],c[m]=d[m]/p[m];l[0]=c[0];for(let m=1;m<o-1;m++)c[m]===0||c[m-1]===0||c[m-1]>0!=c[m]>0?l[m]=0:(l[m]=3*(p[m-1]+p[m])/((2*p[m]+p[m-1])/c[m-1]+(p[m]+2*p[m-1])/c[m]),isFinite(l[m])||(l[m]=0));l[o-1]=c[o-2];for(let m=0;m<o-1;m++)i(a,t[m]+p[m]/3,e[m]+l[m]*p[m]/3,t[m+1]-p[m]/3,e[m+1]-l[m+1]*p[m]/3,t[m+1],e[m+1])}return a}const mR=new Set;function yO(){for(let t of mR)t.syncRect(!0)}Ny&&(Jg(Xhe,w1,yO),Jg(Yhe,w1,yO,!0),Jg(P2,w1,()=>{no.pxRatio=Ri}));const m0e=m$(),g0e=h$();function bO(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,o)=>gR(s,o,e,n))}function x0e(t,e){return t.map((n,r)=>r==0?{}:Ho({},e,n))}function gR(t,e,n,r){return Ho({},e==0?n:r,t)}function g$(t,e,n){return e==null?ty:[e,n]}const v0e=g$;function y0e(t,e,n){return e==null?ty:I2(e,n,$7,!0)}function x$(t,e,n,r){return e==null?ty:jT(e,n,t.scales[r].log,!1)}const b0e=x$;function v$(t,e,n,r){return e==null?ty:W7(e,n,t.scales[r].log,!1)}const _0e=v$;function S0e(t,e,n,r,i){let s=Vl(QI(t),QI(e)),o=e-t,a=Hd(i/r*o,n);do{let l=n[a],c=r*l/o;if(c>=i&&s+(l<5?tm.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function _O(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=na((n=+i)*Ri))+"px"),[t,e,n]}function w0e(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ns(e[2]*Ri,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function no(t,e,n){const r={mode:Ti(t.mode,1)},i=r.mode;function s(he,Me,Ge,Xe){let dt=Me.valToPct(he);return Xe+Ge*(Me.dir==-1?1-dt:dt)}function o(he,Me,Ge,Xe){let dt=Me.valToPct(he);return Xe+Ge*(Me.dir==-1?dt:1-dt)}function a(he,Me,Ge,Xe){return Me.ori==0?s(he,Me,Ge,Xe):o(he,Me,Ge,Xe)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=Uu(Rhe);if(t.id!=null&&(c.id=t.id),qc(c,t.class),t.title){let he=Uu(Phe,c);he.textContent=t.title}const d=zd("canvas"),p=r.ctx=d.getContext("2d"),m=Uu(Ihe,c);Jg("click",m,he=>{he.target===b&&(ri!=xs||Hr!=Ka)&&vr.click(r,he)},!0);const x=r.under=Uu(Ohe,m);m.appendChild(d);const b=r.over=Uu(Lhe,m);t=ny(t);const _=+Ti(t.pxAlign,1),S=xO(_);(t.plugins||[]).forEach(he=>{he.opts&&(t=he.opts(r,t)||t)});const w=t.ms||.001,C=r.series=i==1?bO(t.series||[],uO,mO,!1):x0e(t.series||[null],pO),A=r.axes=bO(t.axes||[],cO,fO,!0),N=r.scales={},D=r.bands=t.bands||[];D.forEach(he=>{he.fill=oi(he.fill||null),he.dir=Ti(he.dir,-1)});const P=i==2?C[1].facets[0].scale:C[0].scale,O={axes:Aa,series:ss},R=(t.drawOrder||["axes","series"]).map(he=>O[he]);function L(he){const Me=he.distr==3?Ge=>dp(Ge>0?Ge:he.clamp(r,Ge,he.min,he.max,he.key)):he.distr==4?Ge=>hA(Ge,he.asinh):he.distr==100?Ge=>he.fwd(Ge):Ge=>Ge;return Ge=>{let Xe=Me(Ge),{_min:dt,_max:Mt}=he,Vt=Mt-dt;return(Xe-dt)/Vt}}function V(he){let Me=N[he];if(Me==null){let Ge=(t.scales||I_)[he]||I_;if(Ge.from!=null){V(Ge.from);let Xe=Ho({},N[Ge.from],Ge,{key:he});Xe.valToPct=L(Xe),N[he]=Xe}else{Me=N[he]=Ho({},he==P?o$:s0e,Ge),Me.key=he;let Xe=Me.time,dt=Me.range,Mt=D0(dt);if((he!=P||i==2&&!Xe)&&(Mt&&(dt[0]==null||dt[1]==null)&&(dt={min:dt[0]==null?YI:{mode:1,hard:dt[0],soft:dt[0]},max:dt[1]==null?YI:{mode:1,hard:dt[1],soft:dt[1]}},Mt=!1),!Mt&&FT(dt))){let Vt=dt;dt=(qt,rn,yn)=>rn==null?ty:I2(rn,yn,Vt)}Me.range=oi(dt||(Xe?v0e:he==P?Me.distr==3?b0e:Me.distr==4?_0e:g$:Me.distr==3?x$:Me.distr==4?v$:y0e)),Me.auto=oi(Mt?!1:Me.auto),Me.clamp=oi(Me.clamp||i0e),Me._min=Me._max=null,Me.valToPct=L(Me)}}}V("x"),V("y"),i==1&&C.forEach(he=>{V(he.scale)}),A.forEach(he=>{V(he.scale)});for(let he in t.scales)V(he);const F=N[P],U=F.distr;let W,Y;F.ori==0?(qc(c,khe),W=s,Y=o):(qc(c,Dhe),W=o,Y=s);const $={};for(let he in N){let Me=N[he];(Me.min!=null||Me.max!=null)&&($[he]={min:Me.min,max:Me.max},Me.min=Me.max=null)}const X=t.tzDate||(he=>new Date(na(he/w))),Z=t.fmtDate||Y7,K=w==1?kpe(X):Ipe(X),ne=oO(X,sO(w==1?Rpe:Ppe,Z)),H=lO(X,aO(Lpe,Z)),B=[],G=r.legend=Ho({},Fpe,t.legend),j=r.cursor=Ho({},Wpe,{drag:{y:i==2}},t.cursor),ie=G.show,ce=j.show,te=G.markers;G.idxs=B,te.width=oi(te.width),te.dash=oi(te.dash),te.stroke=oi(te.stroke),te.fill=oi(te.fill);let se,le,re,pe=[],be=[],xe,Pe=!1,me={};if(G.live){const he=C[1]?C[1].values:null;Pe=he!=null,xe=Pe?he(r,1,0):{_:0};for(let Me in xe)me[Me]=V7}if(ie)if(se=zd("table",Hhe,c),re=zd("tbody",null,se),G.mount(r,se),Pe){le=zd("thead",null,se,re);let he=zd("tr",null,le);zd("th",null,he);for(var ke in xe)zd("th",LI,he).textContent=ke}else qc(se,Ghe),G.live&&qc(se,Vhe);const we={show:!0},Te={show:!1};function oe(he,Me){if(Me==0&&(Pe||!G.live||i==2))return ty;let Ge=[],Xe=zd("tr",Whe,re,re.childNodes[Me]);qc(Xe,he.class),he.show||qc(Xe,Ig);let dt=zd("th",null,Xe);if(te.show){let qt=Uu($he,dt);if(Me>0){let rn=te.width(r,Me);rn&&(qt.style.border=rn+"px "+te.dash(r,Me)+" "+te.stroke(r,Me)),qt.style.background=te.fill(r,Me)}}let Mt=Uu(LI,dt);he.label instanceof HTMLElement?Mt.appendChild(he.label):Mt.textContent=he.label,Me>0&&(te.show||(Mt.style.color=he.width>0?te.stroke(r,Me):te.fill(r,Me)),Fe("click",dt,qt=>{if(j._lock)return;Lt(qt);let rn=C.indexOf(he);if((qt.ctrlKey||qt.metaKey)!=G.isolate){let yn=C.some((_n,Cn)=>Cn>0&&Cn!=rn&&_n.show);C.forEach((_n,Cn)=>{Cn>0&&gi(Cn,yn?Cn==rn?we:Te:we,!0,ys.setSeries)})}else gi(rn,{show:!he.show},!0,ys.setSeries)},!1),Pt&&Fe(UI,dt,qt=>{j._lock||(Lt(qt),gi(C.indexOf(he),vs,!0,ys.setSeries))},!1));for(var Vt in xe){let qt=zd("td",qhe,Xe);qt.textContent="--",Ge.push(qt)}return[Xe,Ge]}const _e=new Map;function Fe(he,Me,Ge,Xe=!0){const dt=_e.get(Me)||{},Mt=j.bind[he](r,Me,Ge,Xe);Mt&&(Jg(he,Me,dt[he]=Mt),_e.set(Me,dt))}function Ue(he,Me,Ge){const Xe=_e.get(Me)||{};for(let dt in Xe)(he==null||dt==he)&&(uR(dt,Me,Xe[dt]),delete Xe[dt]);he==null&&_e.delete(Me)}let Oe=0,ue=0,Q=0,fe=0,Se=0,Ae=0,ve=Se,qe=Ae,Ee=Q,Ce=fe,Ye=0,Ze=0,it=0,ut=0;r.bbox={};let De=!1,Ve=!1,lt=!1,Le=!1,Ne=!1,$e=!1;function ft(he,Me,Ge){(Ge||he!=r.width||Me!=r.height)&&nt(he,Me),Yl(!1),lt=!0,Ve=!0,Ya()}function nt(he,Me){r.width=Oe=Q=he,r.height=ue=fe=Me,Se=Ae=0,et(),pt();let Ge=r.bbox;Ye=Ge.left=Ag(Se*Ri,.5),Ze=Ge.top=Ag(Ae*Ri,.5),it=Ge.width=Ag(Q*Ri,.5),ut=Ge.height=Ag(fe*Ri,.5)}const We=3;function Ke(){let he=!1,Me=0;for(;!he;){Me++;let Ge=qo(Me),Xe=ga(Me);he=Me==We||Ge&&Xe,he||(nt(r.width,r.height),Ve=!0)}}function je({width:he,height:Me}){ft(he,Me)}r.setSize=je;function et(){let he=!1,Me=!1,Ge=!1,Xe=!1;A.forEach((dt,Mt)=>{if(dt.show&&dt._show){let{side:Vt,_size:qt}=dt,rn=Vt%2,yn=dt.label!=null?dt.labelSize:0,_n=qt+yn;_n>0&&(rn?(Q-=_n,Vt==3?(Se+=_n,Xe=!0):Ge=!0):(fe-=_n,Vt==0?(Ae+=_n,he=!0):Me=!0))}}),ct[0]=he,ct[1]=Ge,ct[2]=Me,ct[3]=Xe,Q-=nn[1]+nn[3],Se+=nn[3],fe-=nn[2]+nn[0],Ae+=nn[0]}function pt(){let he=Se+Q,Me=Ae+fe,Ge=Se,Xe=Ae;function dt(Mt,Vt){switch(Mt){case 1:return he+=Vt,he-Vt;case 2:return Me+=Vt,Me-Vt;case 3:return Ge-=Vt,Ge+Vt;case 0:return Xe-=Vt,Xe+Vt}}A.forEach((Mt,Vt)=>{if(Mt.show&&Mt._show){let qt=Mt.side;Mt._pos=dt(qt,Mt._size),Mt.label!=null&&(Mt._lpos=dt(qt,Mt.labelSize))}})}if(j.dataIdx==null){let he=j.hover,Me=he.skip=new Set(he.skip??[]);Me.add(void 0);let Ge=he.prox=oi(he.prox),Xe=he.bias??(he.bias=0);j.dataIdx=(dt,Mt,Vt,qt)=>{if(Mt==0)return Vt;let rn=Vt,yn=Ge(dt,Mt,Vt,qt)??ts,_n=yn>=0&&yn<ts,Cn=F.ori==0?Q:fe,tr=j.left,Zr=e[0],nr=e[Mt];if(Me.has(nr[Vt])){rn=null;let hr=null,Bn=null,kn;if(Xe==0||Xe==-1)for(kn=Vt;hr==null&&kn-- >0;)Me.has(nr[kn])||(hr=kn);if(Xe==0||Xe==1)for(kn=Vt;Bn==null&&kn++<nr.length;)Me.has(nr[kn])||(Bn=kn);if(hr!=null||Bn!=null)if(_n){let $n=hr==null?-1/0:W(Zr[hr],F,Cn,0),Ji=Bn==null?1/0:W(Zr[Bn],F,Cn,0),Ps=tr-$n,xi=Ji-tr;Ps<=xi?Ps<=yn&&(rn=hr):xi<=yn&&(rn=Bn)}else rn=Bn==null?hr:hr==null?Bn:Vt-hr<=Bn-Vt?hr:Bn}else _n&&ia(tr-W(Zr[Vt],F,Cn,0))>yn&&(rn=null);return rn}}const Lt=he=>{j.event=he};j.idxs=B,j._lock=!1;let wt=j.points;wt.show=oi(wt.show),wt.size=oi(wt.size),wt.stroke=oi(wt.stroke),wt.width=oi(wt.width),wt.fill=oi(wt.fill);const yt=r.focus=Ho({},t.focus||{alpha:.3},j.focus),Pt=yt.prox>=0,zt=Pt&&wt.one;let Dt=[],Et=[],Be=[];function Qe(he,Me){let Ge=wt.show(r,Me);if(Ge instanceof HTMLElement)return qc(Ge,Bhe),qc(Ge,he.class),kf(Ge,-10,-10,Q,fe),b.insertBefore(Ge,Dt[Me]),Ge}function ht(he,Me){if(i==1||Me>0){let Ge=i==1&&N[he.scale].time,Xe=he.value;he.value=Ge?tO(Xe)?lO(X,aO(Xe,Z)):Xe||H:Xe||t0e,he.label=he.label||(Ge?qpe:$pe)}if(zt||Me>0){he.width=he.width==null?1:he.width,he.paths=he.paths||m0e||spe,he.fillTo=oi(he.fillTo||o0e),he.pxAlign=+Ti(he.pxAlign,_),he.pxRound=xO(he.pxAlign),he.stroke=oi(he.stroke||null),he.fill=oi(he.fill||null),he._stroke=he._fill=he._paths=he._focus=null;let Ge=n0e(Vl(1,he.width),1),Xe=he.points=Ho({},{size:Ge,width:Vl(1,Ge*.2),stroke:he.stroke,space:Ge*2,paths:g0e,_stroke:null,_fill:null},he.points);Xe.show=oi(Xe.show),Xe.filter=oi(Xe.filter),Xe.fill=oi(Xe.fill),Xe.stroke=oi(Xe.stroke),Xe.paths=oi(Xe.paths),Xe.pxAlign=he.pxAlign}if(ie){let Ge=oe(he,Me);pe.splice(Me,0,Ge[0]),be.splice(Me,0,Ge[1]),G.values.push(null)}if(ce){B.splice(Me,0,null);let Ge=null;zt?Me==0&&(Ge=Qe(he,Me)):Me>0&&(Ge=Qe(he,Me)),Dt.splice(Me,0,Ge),Et.splice(Me,0,0),Be.splice(Me,0,0)}Ds("addSeries",Me)}function It(he,Me){Me=Me??C.length,he=i==1?gR(he,Me,uO,mO):gR(he,Me,{},pO),C.splice(Me,0,he),ht(C[Me],Me)}r.addSeries=It;function Tt(he){if(C.splice(he,1),ie){G.values.splice(he,1),be.splice(he,1);let Me=pe.splice(he,1)[0];Ue(null,Me.firstChild),Me.remove()}ce&&(B.splice(he,1),Dt.splice(he,1)[0].remove(),Et.splice(he,1),Be.splice(he,1)),Ds("delSeries",he)}r.delSeries=Tt;const ct=[!1,!1,!1,!1];function Ut(he,Me){if(he._show=he.show,he.show){let Ge=he.side%2,Xe=N[he.scale];Xe==null&&(he.scale=Ge?C[1].scale:P,Xe=N[he.scale]);let dt=Xe.time;he.size=oi(he.size),he.space=oi(he.space),he.rotate=oi(he.rotate),D0(he.incrs)&&he.incrs.forEach(Vt=>{!tm.has(Vt)&&tm.set(Vt,BW(Vt))}),he.incrs=oi(he.incrs||(Xe.distr==2?Epe:dt?w==1?Npe:Dpe:Ng)),he.splits=oi(he.splits||(dt&&Xe.distr==1?K:Xe.distr==3?fR:Xe.distr==4?Kpe:Ype)),he.stroke=oi(he.stroke),he.grid.stroke=oi(he.grid.stroke),he.ticks.stroke=oi(he.ticks.stroke),he.border.stroke=oi(he.border.stroke);let Mt=he.values;he.values=D0(Mt)&&!D0(Mt[0])?oi(Mt):dt?D0(Mt)?oO(X,sO(Mt,Z)):tO(Mt)?Ope(X,Mt):Mt||ne:Mt||Xpe,he.filter=oi(he.filter||(Xe.distr>=3&&Xe.log==10?Jpe:Xe.distr==3&&Xe.log==2?e0e:FW)),he.font=_O(he.font),he.labelFont=_O(he.labelFont),he._size=he.size(r,null,Me,0),he._space=he._rotate=he._incrs=he._found=he._splits=he._values=null,he._size>0&&(ct[Me]=!0,he._el=Uu(jhe,m))}}function Gt(he,Me,Ge,Xe){let[dt,Mt,Vt,qt]=Ge,rn=Me%2,yn=0;return rn==0&&(qt||Mt)&&(yn=Me==0&&!dt||Me==2&&!Vt?na(cO.size/3):0),rn==1&&(dt||Vt)&&(yn=Me==1&&!Mt||Me==3&&!qt?na(fO.size/2):0),yn}const sn=r.padding=(t.padding||[Gt,Gt,Gt,Gt]).map(he=>oi(Ti(he,Gt))),nn=r._padding=sn.map((he,Me)=>he(r,Me,ct,0));let En,Hn=null,Nn=null;const Br=i==1?C[0].idxs:null;let er=null,ge=!1;function rt(he,Me){if(e=he??[],r.data=r._data=e,i==2){En=0;for(let Ge=1;Ge<C.length;Ge++)En+=e[Ge][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),er=e[0],En=er.length;let Ge=e;if(U==2){Ge=e.slice();let Xe=Ge[0]=Array(En);for(let dt=0;dt<En;dt++)Xe[dt]=dt}r._data=e=Ge}if(Yl(!0),Ds("setData"),U==2&&(lt=!0),Me!==!1){let Ge=F;Ge.auto(r,ge)?bt():go(P,Ge.min,Ge.max),Le=Le||j.left>=0,$e=!0,Ya()}}r.setData=rt;function bt(){ge=!0;let he,Me;i==1&&(En>0?(Hn=Br[0]=0,Nn=Br[1]=En-1,he=e[0][Hn],Me=e[0][Nn],U==2?(he=Hn,Me=Nn):he==Me&&(U==3?[he,Me]=jT(he,he,F.log,!1):U==4?[he,Me]=W7(he,he,F.log,!1):F.time?Me=he+na(86400/w):[he,Me]=I2(he,Me,$7,!0))):(Hn=Br[0]=he=null,Nn=Br[1]=Me=null)),go(P,he,Me)}let vt,gt,Xt,Jt,Kt,Zt,xn,On,Wn,fn;function or(he,Me,Ge,Xe,dt,Mt){he??(he=zI),Ge??(Ge=X7),Xe??(Xe="butt"),dt??(dt=zI),Mt??(Mt="round"),he!=vt&&(p.strokeStyle=vt=he),dt!=gt&&(p.fillStyle=gt=dt),Me!=Xt&&(p.lineWidth=Xt=Me),Mt!=Kt&&(p.lineJoin=Kt=Mt),Xe!=Zt&&(p.lineCap=Zt=Xe),Ge!=Jt&&p.setLineDash(Jt=Ge)}function Kr(he,Me,Ge,Xe){Me!=gt&&(p.fillStyle=gt=Me),he!=xn&&(p.font=xn=he),Ge!=On&&(p.textAlign=On=Ge),Xe!=Wn&&(p.textBaseline=Wn=Xe)}function ni(he,Me,Ge,Xe,dt=0){if(Xe.length>0&&he.auto(r,ge)&&(Me==null||Me.min==null)){let Mt=Ti(Hn,0),Vt=Ti(Nn,Xe.length-1),qt=Ge.min==null?Jhe(Xe,Mt,Vt,dt,he.distr==3):[Ge.min,Ge.max];he.min=Gd(he.min,Ge.min=qt[0]),he.max=Vl(he.max,Ge.max=qt[1])}}const fr={min:null,max:null};function kr(){for(let Xe in N){let dt=N[Xe];$[Xe]==null&&(dt.min==null||$[P]!=null&&dt.auto(r,ge))&&($[Xe]=fr)}for(let Xe in N){let dt=N[Xe];$[Xe]==null&&dt.from!=null&&$[dt.from]!=null&&($[Xe]=fr)}$[P]!=null&&Yl(!0);let he={};for(let Xe in $){let dt=$[Xe];if(dt!=null){let Mt=he[Xe]=ny(N[Xe],lpe);if(dt.min!=null)Ho(Mt,dt);else if(Xe!=P||i==2)if(En==0&&Mt.from==null){let Vt=Mt.range(r,null,null,Xe);Mt.min=Vt[0],Mt.max=Vt[1]}else Mt.min=ts,Mt.max=-ts}}if(En>0){C.forEach((Xe,dt)=>{if(i==1){let Mt=Xe.scale,Vt=$[Mt];if(Vt==null)return;let qt=he[Mt];if(dt==0){let rn=qt.range(r,qt.min,qt.max,Mt);qt.min=rn[0],qt.max=rn[1],Hn=Hd(qt.min,e[0]),Nn=Hd(qt.max,e[0]),Nn-Hn>1&&(e[0][Hn]<qt.min&&Hn++,e[0][Nn]>qt.max&&Nn--),Xe.min=er[Hn],Xe.max=er[Nn]}else Xe.show&&Xe.auto&&ni(qt,Vt,Xe,e[dt],Xe.sorted);Xe.idxs[0]=Hn,Xe.idxs[1]=Nn}else if(dt>0&&Xe.show&&Xe.auto){let[Mt,Vt]=Xe.facets,qt=Mt.scale,rn=Vt.scale,[yn,_n]=e[dt],Cn=he[qt],tr=he[rn];Cn!=null&&ni(Cn,$[qt],Mt,yn,Mt.sorted),tr!=null&&ni(tr,$[rn],Vt,_n,Vt.sorted),Xe.min=Vt.min,Xe.max=Vt.max}});for(let Xe in he){let dt=he[Xe],Mt=$[Xe];if(dt.from==null&&(Mt==null||Mt.min==null)){let Vt=dt.range(r,dt.min==ts?null:dt.min,dt.max==-ts?null:dt.max,Xe);dt.min=Vt[0],dt.max=Vt[1]}}}for(let Xe in he){let dt=he[Xe];if(dt.from!=null){let Mt=he[dt.from];if(Mt.min==null)dt.min=dt.max=null;else{let Vt=dt.range(r,Mt.min,Mt.max,Xe);dt.min=Vt[0],dt.max=Vt[1]}}}let Me={},Ge=!1;for(let Xe in he){let dt=he[Xe],Mt=N[Xe];if(Mt.min!=dt.min||Mt.max!=dt.max){Mt.min=dt.min,Mt.max=dt.max;let Vt=Mt.distr;Mt._min=Vt==3?dp(Mt.min):Vt==4?hA(Mt.min,Mt.asinh):Vt==100?Mt.fwd(Mt.min):Mt.min,Mt._max=Vt==3?dp(Mt.max):Vt==4?hA(Mt.max,Mt.asinh):Vt==100?Mt.fwd(Mt.max):Mt.max,Me[Xe]=Ge=!0}}if(Ge){C.forEach((Xe,dt)=>{i==2?dt>0&&Me.y&&(Xe._paths=null):Me[Xe.scale]&&(Xe._paths=null)});for(let Xe in Me)lt=!0,Ds("setScale",Xe);ce&&j.left>=0&&(Le=$e=!0)}for(let Xe in $)$[Xe]=null}function ln(he){let Me=dR(Hn-1,0,En-1),Ge=dR(Nn+1,0,En-1);for(;he[Me]==null&&Me>0;)Me--;for(;he[Ge]==null&&Ge<En-1;)Ge++;return[Me,Ge]}function ss(){if(En>0){let he=C.some(Me=>Me._focus)&&fn!=yt.alpha;he&&(p.globalAlpha=fn=yt.alpha),C.forEach((Me,Ge)=>{if(Ge>0&&Me.show&&(Dn(Ge,!1),Dn(Ge,!0),Me._paths==null)){let Xe=fn;fn!=Me.alpha&&(p.globalAlpha=fn=Me.alpha);let dt=i==2?[0,e[Ge][0].length-1]:ln(e[Ge]);Me._paths=Me.paths(r,Ge,dt[0],dt[1]),fn!=Xe&&(p.globalAlpha=fn=Xe)}}),C.forEach((Me,Ge)=>{if(Ge>0&&Me.show){let Xe=fn;fn!=Me.alpha&&(p.globalAlpha=fn=Me.alpha),Me._paths!=null&&ms(Ge,!1);{let dt=Me._paths!=null?Me._paths.gaps:null,Mt=Me.points.show(r,Ge,Hn,Nn,dt),Vt=Me.points.filter(r,Ge,Mt,dt);(Mt||Vt)&&(Me.points._paths=Me.points.paths(r,Ge,Hn,Nn,Vt),ms(Ge,!0))}fn!=Xe&&(p.globalAlpha=fn=Xe),Ds("drawSeries",Ge)}}),he&&(p.globalAlpha=fn=1)}}function Dn(he,Me){let Ge=Me?C[he].points:C[he];Ge._stroke=Ge.stroke(r,he),Ge._fill=Ge.fill(r,he)}function ms(he,Me){let Ge=Me?C[he].points:C[he],{stroke:Xe,fill:dt,clip:Mt,flags:Vt,_stroke:qt=Ge._stroke,_fill:rn=Ge._fill,_width:yn=Ge.width}=Ge._paths;yn=ns(yn*Ri,3);let _n=null,Cn=yn%2/2;Me&&rn==null&&(rn=yn>0?"#fff":qt);let tr=Ge.pxAlign==1&&Cn>0;if(tr&&p.translate(Cn,Cn),!Me){let Zr=Ye-yn/2,nr=Ze-yn/2,hr=it+yn,Bn=ut+yn;_n=new Path2D,_n.rect(Zr,nr,hr,Bn)}Me?gs(qt,yn,Ge.dash,Ge.cap,rn,Xe,dt,Vt,Mt):Ns(he,qt,yn,Ge.dash,Ge.cap,rn,Xe,dt,Vt,_n,Mt),tr&&p.translate(-Cn,-Cn)}function Ns(he,Me,Ge,Xe,dt,Mt,Vt,qt,rn,yn,_n){let Cn=!1;rn!=0&&D.forEach((tr,Zr)=>{if(tr.series[0]==he){let nr=C[tr.series[1]],hr=e[tr.series[1]],Bn=(nr._paths||I_).band;D0(Bn)&&(Bn=tr.dir==1?Bn[0]:Bn[1]);let kn,$n=null;nr.show&&Bn&&tpe(hr,Hn,Nn)?($n=tr.fill(r,Zr)||Mt,kn=nr._paths.clip):Bn=null,gs(Me,Ge,Xe,dt,$n,Vt,qt,rn,yn,_n,kn,Bn),Cn=!0}}),Cn||gs(Me,Ge,Xe,dt,Mt,Vt,qt,rn,yn,_n)}const Di=ry|pR;function gs(he,Me,Ge,Xe,dt,Mt,Vt,qt,rn,yn,_n,Cn){or(he,Me,Ge,Xe,dt),(rn||yn||Cn)&&(p.save(),rn&&p.clip(rn),yn&&p.clip(yn)),Cn?(qt&Di)==Di?(p.clip(Cn),_n&&p.clip(_n),hi(dt,Vt),xr(he,Mt,Me)):qt&pR?(hi(dt,Vt),p.clip(Cn),xr(he,Mt,Me)):qt&ry&&(p.save(),p.clip(Cn),_n&&p.clip(_n),hi(dt,Vt),p.restore(),xr(he,Mt,Me)):(hi(dt,Vt),xr(he,Mt,Me)),(rn||yn||Cn)&&p.restore()}function xr(he,Me,Ge){Ge>0&&(Me instanceof Map?Me.forEach((Xe,dt)=>{p.strokeStyle=vt=dt,p.stroke(Xe)}):Me!=null&&he&&p.stroke(Me))}function hi(he,Me){Me instanceof Map?Me.forEach((Ge,Xe)=>{p.fillStyle=gt=Xe,p.fill(Ge)}):Me!=null&&he&&p.fill(Me)}function Rs(he,Me,Ge,Xe){let dt=A[he],Mt;if(Xe<=0)Mt=[0,0];else{let Vt=dt._space=dt.space(r,he,Me,Ge,Xe),qt=dt._incrs=dt.incrs(r,he,Me,Ge,Xe,Vt);Mt=S0e(Me,Ge,qt,Xe,Vt)}return dt._found=Mt}function Pi(he,Me,Ge,Xe,dt,Mt,Vt,qt,rn,yn){let _n=Vt%2/2;_==1&&p.translate(_n,_n),or(qt,Vt,rn,yn,qt),p.beginPath();let Cn,tr,Zr,nr,hr=dt+(Xe==0||Xe==3?-Mt:Mt);Ge==0?(tr=dt,nr=hr):(Cn=dt,Zr=hr);for(let Bn=0;Bn<he.length;Bn++)Me[Bn]!=null&&(Ge==0?Cn=Zr=he[Bn]:tr=nr=he[Bn],p.moveTo(Cn,tr),p.lineTo(Zr,nr));p.stroke(),_==1&&p.translate(-_n,-_n)}function qo(he){let Me=!0;return A.forEach((Ge,Xe)=>{if(!Ge.show)return;let dt=N[Ge.scale];if(dt.min==null){Ge._show&&(Me=!1,Ge._show=!1,Yl(!1));return}else Ge._show||(Me=!1,Ge._show=!0,Yl(!1));let Mt=Ge.side,Vt=Mt%2,{min:qt,max:rn}=dt,[yn,_n]=Rs(Xe,qt,rn,Vt==0?Q:fe);if(_n==0)return;let Cn=dt.distr==2,tr=Ge._splits=Ge.splits(r,Xe,qt,rn,yn,_n,Cn),Zr=dt.distr==2?tr.map(kn=>er[kn]):tr,nr=dt.distr==2?er[tr[1]]-er[tr[0]]:yn,hr=Ge._values=Ge.values(r,Ge.filter(r,Zr,Xe,_n,nr),Xe,_n,nr);Ge._rotate=Mt==2?Ge.rotate(r,hr,Xe,_n):0;let Bn=Ge._size;Ge._size=Wu(Ge.size(r,hr,Xe,he)),Bn!=null&&Ge._size!=Bn&&(Me=!1)}),Me}function ga(he){let Me=!0;return sn.forEach((Ge,Xe)=>{let dt=Ge(r,Xe,ct,he);dt!=nn[Xe]&&(Me=!1),nn[Xe]=dt}),Me}function Aa(){for(let he=0;he<A.length;he++){let Me=A[he];if(!Me.show||!Me._show)continue;let Ge=Me.side,Xe=Ge%2,dt,Mt,Vt=Me.stroke(r,he),qt=Ge==0||Ge==3?-1:1,[rn,yn]=Me._found;if(Me.label!=null){let oo=Me.labelGap*qt,vo=na((Me._lpos+oo)*Ri);Kr(Me.labelFont[0],Vt,"center",Ge==2?Kb:jI),p.save(),Xe==1?(dt=Mt=0,p.translate(vo,na(Ze+ut/2)),p.rotate((Ge==3?-BM:BM)/2)):(dt=na(Ye+it/2),Mt=vo);let zc=jW(Me.label)?Me.label(r,he,rn,yn):Me.label;p.fillText(zc,dt,Mt),p.restore()}if(yn==0)continue;let _n=N[Me.scale],Cn=Xe==0?it:ut,tr=Xe==0?Ye:Ze,Zr=Me._splits,nr=_n.distr==2?Zr.map(oo=>er[oo]):Zr,hr=_n.distr==2?er[Zr[1]]-er[Zr[0]]:rn,Bn=Me.ticks,kn=Me.border,$n=Bn.show?Bn.size:0,Ji=na($n*Ri),Ps=na((Me.alignTo==2?Me._size-$n-Me.gap:Me.gap)*Ri),xi=Me._rotate*-BM/180,li=S(Me._pos*Ri),os=(Ji+Ps)*qt,Is=li+os;Mt=Xe==0?Is:0,dt=Xe==1?Is:0;let Ko=Me.font[0],ko=Me.align==1?kv:Me.align==2?uA:xi>0?kv:xi<0?uA:Xe==0?"center":Ge==3?uA:kv,Gi=xi||Xe==1?"middle":Ge==2?Kb:jI;Kr(Ko,Vt,ko,Gi);let Vs=Me.font[1]*Me.lineGap,Do=Zr.map(oo=>S(a(oo,_n,Cn,tr))),Da=Me._values;for(let oo=0;oo<Da.length;oo++){let vo=Da[oo];if(vo!=null){Xe==0?dt=Do[oo]:Mt=Do[oo],vo=""+vo;let zc=vo.indexOf(`
`)==-1?[vo]:vo.split(/\n/gm);for(let Po=0;Po<zc.length;Po++){let Lx=zc[Po];xi?(p.save(),p.translate(dt,Mt+Po*Vs),p.rotate(xi),p.fillText(Lx,0,0),p.restore()):p.fillText(Lx,dt,Mt+Po*Vs)}}}Bn.show&&Pi(Do,Bn.filter(r,nr,he,yn,hr),Xe,Ge,li,Ji,ns(Bn.width*Ri,3),Bn.stroke(r,he),Bn.dash,Bn.cap);let so=Me.grid;so.show&&Pi(Do,so.filter(r,nr,he,yn,hr),Xe,Xe==0?2:1,Xe==0?Ze:Ye,Xe==0?ut:it,ns(so.width*Ri,3),so.stroke(r,he),so.dash,so.cap),kn.show&&Pi([li],[1],Xe==0?1:0,Xe==0?1:2,Xe==1?Ze:Ye,Xe==1?ut:it,ns(kn.width*Ri,3),kn.stroke(r,he),kn.dash,kn.cap)}Ds("drawAxes")}function Yl(he){C.forEach((Me,Ge)=>{Ge>0&&(Me._paths=null,he&&(i==1?(Me.min=null,Me.max=null):Me.facets.forEach(Xe=>{Xe.min=null,Xe.max=null})))})}let _l=!1,xa=!1,ks=[];function Kl(){xa=!1;for(let he=0;he<ks.length;he++)Ds(...ks[he]);ks.length=0}function Ya(){_l||(mpe(Ra),_l=!0)}function Na(he,Me=!1){_l=!0,xa=Me,he(r),Ra(),Me&&ks.length>0&&queueMicrotask(Kl)}r.batch=Na;function Ra(){if(De&&(kr(),De=!1),lt&&(Ke(),lt=!1),Ve){if(Es(x,kv,Se),Es(x,Kb,Ae),Es(x,__,Q),Es(x,S_,fe),Es(b,kv,Se),Es(b,Kb,Ae),Es(b,__,Q),Es(b,S_,fe),Es(m,__,Oe),Es(m,S_,ue),d.width=na(Oe*Ri),d.height=na(ue*Ri),A.forEach(({_el:he,_show:Me,_size:Ge,_pos:Xe,side:dt})=>{if(he!=null)if(Me){let Mt=dt===3||dt===0?Ge:0,Vt=dt%2==1;Es(he,Vt?"left":"top",Xe-Mt),Es(he,Vt?"width":"height",Ge),Es(he,Vt?"top":"left",Vt?Ae:Se),Es(he,Vt?"height":"width",Vt?fe:Q),cR(he,Ig)}else qc(he,Ig)}),vt=gt=Xt=Kt=Zt=xn=On=Wn=Jt=null,fn=1,md(!0),Se!=ve||Ae!=qe||Q!=Ee||fe!=Ce){Yl(!1);let he=Q/Ee,Me=fe/Ce;if(ce&&!Le&&j.left>=0){j.left*=he,j.top*=Me,Xo&&kf(Xo,na(j.left),0,Q,fe),io&&kf(io,0,na(j.top),Q,fe);for(let Ge=0;Ge<Dt.length;Ge++){let Xe=Dt[Ge];Xe!=null&&(Et[Ge]*=he,Be[Ge]*=Me,kf(Xe,Wu(Et[Ge]),Wu(Be[Ge]),Q,fe))}}if(qr.show&&!Ne&&qr.left>=0&&qr.width>0){qr.left*=he,qr.width*=he,qr.top*=Me,qr.height*=Me;for(let Ge in Am)Es(ka,Ge,qr[Ge])}ve=Se,qe=Ae,Ee=Q,Ce=fe}Ds("setSize"),Ve=!1}Oe>0&&ue>0&&(p.clearRect(0,0,d.width,d.height),Ds("drawClear"),R.forEach(he=>he()),Ds("draw")),qr.show&&Ne&&(wl(qr),Ne=!1),ce&&Le&&(Jl(null,!0,!1),Le=!1),G.show&&G.live&&$e&&(Dp(),$e=!1),l||(l=!0,r.status=1,Ds("ready")),ge=!1,_l=!1}r.redraw=(he,Me)=>{lt=Me||!1,he!==!1?go(P,F.min,F.max):Ya()};function Ic(he,Me){let Ge=N[he];if(Ge.from==null){if(En==0){let Xe=Ge.range(r,Me.min,Me.max,he);Me.min=Xe[0],Me.max=Xe[1]}if(Me.min>Me.max){let Xe=Me.min;Me.min=Me.max,Me.max=Xe}if(En>1&&Me.min!=null&&Me.max!=null&&Me.max-Me.min<1e-16)return;he==P&&Ge.distr==2&&En>0&&(Me.min=Hd(Me.min,e[0]),Me.max=Hd(Me.max,e[0]),Me.min==Me.max&&Me.max++),$[he]=Me,De=!0,Ya()}}r.setScale=Ic;let Oc,Zl,Xo,io,Ro,Sl,xs,Ka,Za,Lc,ri,Hr,Yo=!1;const vr=j.drag;let Si=vr.x,Ii=vr.y;ce&&(j.x&&(Oc=Uu(Fhe,b)),j.y&&(Zl=Uu(Uhe,b)),F.ori==0?(Xo=Oc,io=Zl):(Xo=Zl,io=Oc),ri=j.left,Hr=j.top);const qr=r.select=Ho({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),ka=qr.show?Uu(zhe,qr.over?b:x):null;function wl(he,Me){if(qr.show){for(let Ge in he)qr[Ge]=he[Ge],Ge in Am&&Es(ka,Ge,he[Ge]);Me!==!1&&Ds("setSelect")}}r.setSelect=wl;function Ql(he){if(C[he].show)ie&&cR(pe[he],Ig);else if(ie&&qc(pe[he],Ig),ce){let Ge=zt?Dt[0]:Dt[he];Ge!=null&&kf(Ge,-10,-10,Q,fe)}}function go(he,Me,Ge){Ic(he,{min:Me,max:Ge})}function gi(he,Me,Ge,Xe){Me.focus!=null&&Ml(he),Me.show!=null&&C.forEach((dt,Mt)=>{Mt>0&&(he==Mt||he==null)&&(dt.show=Me.show,Ql(Mt),i==2?(go(dt.facets[0].scale,null,null),go(dt.facets[1].scale,null,null)):go(dt.scale,null,null),Ya())}),Ge!==!1&&Ds("setSeries",he,Me),Xe&&vd("setSeries",r,he,Me)}r.setSeries=gi;function _h(he,Me){Ho(D[he],Me)}function dd(he,Me){he.fill=oi(he.fill||null),he.dir=Ti(he.dir,-1),Me=Me??D.length,D.splice(Me,0,he)}function fd(he){he==null?D.length=0:D.splice(he,1)}r.addBand=dd,r.setBand=_h,r.delBand=fd;function rf(he,Me){C[he].alpha=Me,ce&&Dt[he]!=null&&(Dt[he].style.opacity=Me),ie&&pe[he]&&(pe[he].style.opacity=Me)}let va,qi,Bs;const vs={focus:!0};function Ml(he){if(he!=Bs){let Me=he==null,Ge=yt.alpha!=1;C.forEach((Xe,dt)=>{if(i==1||dt>0){let Mt=Me||dt==0||dt==he;Xe._focus=Me?null:Mt,Ge&&rf(dt,Mt?1:yt.alpha)}}),Bs=he,Ge&&Ya()}}ie&&Pt&&Fe(BI,se,he=>{j._lock||(Lt(he),Bs!=null&&gi(null,vs,!0,ys.setSeries))});function xo(he,Me,Ge){let Xe=N[Me];Ge&&(he=he/Ri-(Xe.ori==1?Ae:Se));let dt=Q;Xe.ori==1&&(dt=fe,he=dt-he),Xe.dir==-1&&(he=dt-he);let Mt=Xe._min,Vt=Xe._max,qt=he/dt,rn=Mt+(Vt-Mt)*qt,yn=Xe.distr;return yn==3?ey(10,rn):yn==4?rpe(rn,Xe.asinh):yn==100?Xe.bwd(rn):rn}function Rp(he,Me){let Ge=xo(he,P,Me);return Hd(Ge,e[0],Hn,Nn)}r.valToIdx=he=>Hd(he,e[0]),r.posToIdx=Rp,r.posToVal=xo,r.valToPos=(he,Me,Ge)=>N[Me].ori==0?s(he,N[Me],Ge?it:Q,Ge?Ye:0):o(he,N[Me],Ge?ut:fe,Ge?Ze:0),r.setCursor=(he,Me,Ge)=>{ri=he.left,Hr=he.top,Jl(null,Me,Ge)};function Sh(he,Me){Es(ka,kv,qr.left=he),Es(ka,__,qr.width=Me)}function Cm(he,Me){Es(ka,Kb,qr.top=he),Es(ka,S_,qr.height=Me)}let sf=F.ori==0?Sh:Cm,hd=F.ori==1?Sh:Cm;function kp(){if(ie&&G.live)for(let he=i==2?1:0;he<C.length;he++){if(he==0&&Pe)continue;let Me=G.values[he],Ge=0;for(let Xe in Me)be[he][Ge++].firstChild.nodeValue=Me[Xe]}}function Dp(he,Me){if(he!=null&&(he.idxs?he.idxs.forEach((Ge,Xe)=>{B[Xe]=Ge}):ape(he.idx)||B.fill(he.idx),G.idx=B[0]),ie&&G.live){for(let Ge=0;Ge<C.length;Ge++)(Ge>0||i==1&&!Pe)&&pd(Ge,B[Ge]);kp()}$e=!1,Me!==!1&&Ds("setLegend")}r.setLegend=Dp;function pd(he,Me){let Ge=C[he],Xe=he==0&&U==2?er:e[he],dt;Pe?dt=Ge.values(r,he,Me)??me:(dt=Ge.value(r,Me==null?null:Xe[Me],he,Me),dt=dt==null?me:{_:dt}),G.values[he]=dt}function Jl(he,Me,Ge){Za=ri,Lc=Hr,[ri,Hr]=j.move(r,ri,Hr),j.left=ri,j.top=Hr,ce&&(Xo&&kf(Xo,na(ri),0,Q,fe),io&&kf(io,0,na(Hr),Q,fe));let Xe,dt=Hn>Nn;va=ts,qi=null;let Mt=F.ori==0?Q:fe,Vt=F.ori==1?Q:fe;if(ri<0||En==0||dt){Xe=j.idx=null;for(let qt=0;qt<C.length;qt++){let rn=Dt[qt];rn!=null&&kf(rn,-10,-10,Q,fe)}Pt&&gi(null,vs,!0,he==null&&ys.setSeries),G.live&&(B.fill(Xe),$e=!0)}else{let qt,rn,yn;i==1&&(qt=F.ori==0?ri:Hr,rn=xo(qt,P),Xe=j.idx=Hd(rn,e[0],Hn,Nn),yn=W(e[0][Xe],F,Mt,0));let _n=-10,Cn=-10,tr=0,Zr=0,nr=!0,hr="",Bn="";for(let kn=i==2?1:0;kn<C.length;kn++){let $n=C[kn],Ji=B[kn],Ps=Ji==null?null:i==1?e[kn][Ji]:e[kn][1][Ji],xi=j.dataIdx(r,kn,Xe,rn),li=xi==null?null:i==1?e[kn][xi]:e[kn][1][xi];if($e=$e||li!=Ps||xi!=Ji,B[kn]=xi,kn>0&&$n.show){let os=xi==null?-10:xi==Xe?yn:W(i==1?e[0][xi]:e[kn][0][xi],F,Mt,0),Is=li==null?-10:Y(li,i==1?N[$n.scale]:N[$n.facets[1].scale],Vt,0);if(Pt&&li!=null){let Ko=F.ori==1?ri:Hr,ko=ia(yt.dist(r,kn,xi,Is,Ko));if(ko<va){let Gi=yt.bias;if(Gi!=0){let Vs=xo(Ko,$n.scale),Do=li>=0?1:-1,Da=Vs>=0?1:-1;Da==Do&&(Da==1?Gi==1?li>=Vs:li<=Vs:Gi==1?li<=Vs:li>=Vs)&&(va=ko,qi=kn)}else va=ko,qi=kn}}if($e||zt){let Ko,ko;F.ori==0?(Ko=os,ko=Is):(Ko=Is,ko=os);let Gi,Vs,Do,Da,so,oo,vo=!0,zc=wt.bbox;if(zc!=null){vo=!1;let Po=zc(r,kn);Do=Po.left,Da=Po.top,Gi=Po.width,Vs=Po.height}else Do=Ko,Da=ko,Gi=Vs=wt.size(r,kn);if(oo=wt.fill(r,kn),so=wt.stroke(r,kn),zt)kn==qi&&va<=yt.prox&&(_n=Do,Cn=Da,tr=Gi,Zr=Vs,nr=vo,hr=oo,Bn=so);else{let Po=Dt[kn];Po!=null&&(Et[kn]=Do,Be[kn]=Da,XI(Po,Gi,Vs,vo),$I(Po,oo,so),kf(Po,Wu(Do),Wu(Da),Q,fe))}}}}if(zt){let kn=yt.prox,$n=Bs==null?va<=kn:va>kn||qi!=Bs;if($e||$n){let Ji=Dt[0];Ji!=null&&(Et[0]=_n,Be[0]=Cn,XI(Ji,tr,Zr,nr),$I(Ji,hr,Bn),kf(Ji,Wu(_n),Wu(Cn),Q,fe))}}}if(qr.show&&Yo)if(he!=null){let[qt,rn]=ys.scales,[yn,_n]=ys.match,[Cn,tr]=he.cursor.sync.scales,Zr=he.cursor.drag;if(Si=Zr._x,Ii=Zr._y,Si||Ii){let{left:nr,top:hr,width:Bn,height:kn}=he.select,$n=he.scales[Cn].ori,Ji=he.posToVal,Ps,xi,li,os,Is,Ko=qt!=null&&yn(qt,Cn),ko=rn!=null&&_n(rn,tr);Ko&&Si?($n==0?(Ps=nr,xi=Bn):(Ps=hr,xi=kn),li=N[qt],os=W(Ji(Ps,Cn),li,Mt,0),Is=W(Ji(Ps+xi,Cn),li,Mt,0),sf(Gd(os,Is),ia(Is-os))):sf(0,Mt),ko&&Ii?($n==1?(Ps=nr,xi=Bn):(Ps=hr,xi=kn),li=N[rn],os=Y(Ji(Ps,tr),li,Vt,0),Is=Y(Ji(Ps+xi,tr),li,Vt,0),hd(Gd(os,Is),ia(Is-os))):hd(0,Vt)}else Hs()}else{let qt=ia(Za-Ro),rn=ia(Lc-Sl);if(F.ori==1){let tr=qt;qt=rn,rn=tr}Si=vr.x&&qt>=vr.dist,Ii=vr.y&&rn>=vr.dist;let yn=vr.uni;yn!=null?Si&&Ii&&(Si=qt>=yn,Ii=rn>=yn,!Si&&!Ii&&(rn>qt?Ii=!0:Si=!0)):vr.x&&vr.y&&(Si||Ii)&&(Si=Ii=!0);let _n,Cn;Si&&(F.ori==0?(_n=xs,Cn=ri):(_n=Ka,Cn=Hr),sf(Gd(_n,Cn),ia(Cn-_n)),Ii||hd(0,Vt)),Ii&&(F.ori==1?(_n=xs,Cn=ri):(_n=Ka,Cn=Hr),hd(Gd(_n,Cn),ia(Cn-_n)),Si||sf(0,Mt)),!Si&&!Ii&&(sf(0,0),hd(0,0))}if(vr._x=Si,vr._y=Ii,he==null){if(Ge){if(Lp!=null){let[qt,rn]=ys.scales;ys.values[0]=qt!=null?xo(F.ori==0?ri:Hr,qt):null,ys.values[1]=rn!=null?xo(F.ori==1?ri:Hr,rn):null}vd(dA,r,ri,Hr,Q,fe,Xe)}if(Pt){let qt=Ge&&ys.setSeries,rn=yt.prox;Bs==null?va<=rn&&gi(qi,vs,!0,qt):va>rn?gi(null,vs,!0,qt):qi!=Bs&&gi(qi,vs,!0,qt)}}$e&&(G.idx=Xe,Dp()),Me!==!1&&Ds("setCursor")}let ec=null;Object.defineProperty(r,"rect",{get(){return ec==null&&md(!1),ec}});function md(he=!1){he?ec=null:(ec=b.getBoundingClientRect(),Ds("syncRect",ec))}function Em(he,Me,Ge,Xe,dt,Mt,Vt){j._lock||Yo&&he!=null&&he.movementX==0&&he.movementY==0||(Pp(he,Me,Ge,Xe,dt,Mt,Vt,!1,he!=null),he!=null?Jl(null,!0,!0):Jl(Me,!0,!1))}function Pp(he,Me,Ge,Xe,dt,Mt,Vt,qt,rn){if(ec==null&&md(!1),Lt(he),he!=null)Ge=he.clientX-ec.left,Xe=he.clientY-ec.top;else{if(Ge<0||Xe<0){ri=-10,Hr=-10;return}let[yn,_n]=ys.scales,Cn=Me.cursor.sync,[tr,Zr]=Cn.values,[nr,hr]=Cn.scales,[Bn,kn]=ys.match,$n=Me.axes[0].side%2==1,Ji=F.ori==0?Q:fe,Ps=F.ori==1?Q:fe,xi=$n?Mt:dt,li=$n?dt:Mt,os=$n?Xe:Ge,Is=$n?Ge:Xe;if(nr!=null?Ge=Bn(yn,nr)?a(tr,N[yn],Ji,0):-10:Ge=Ji*(os/xi),hr!=null?Xe=kn(_n,hr)?a(Zr,N[_n],Ps,0):-10:Xe=Ps*(Is/li),F.ori==1){let Ko=Ge;Ge=Xe,Xe=Ko}}rn&&(Me==null||Me.cursor.event.type==dA)&&((Ge<=1||Ge>=Q-1)&&(Ge=Ag(Ge,Q)),(Xe<=1||Xe>=fe-1)&&(Xe=Ag(Xe,fe))),qt?(Ro=Ge,Sl=Xe,[xs,Ka]=j.move(r,Ge,Xe)):(ri=Ge,Hr=Xe)}const Am={width:0,height:0,left:0,top:0};function Hs(){wl(Am,!1)}let Nm,Rm,km,Dm;function gu(he,Me,Ge,Xe,dt,Mt,Vt){Yo=!0,Si=Ii=vr._x=vr._y=!1,Pp(he,Me,Ge,Xe,dt,Mt,Vt,!0,!1),he!=null&&(Fe(fA,aR,gd,!1),vd(FI,r,xs,Ka,Q,fe,null));let{left:qt,top:rn,width:yn,height:_n}=qr;Nm=qt,Rm=rn,km=yn,Dm=_n}function gd(he,Me,Ge,Xe,dt,Mt,Vt){Yo=vr._x=vr._y=!1,Pp(he,Me,Ge,Xe,dt,Mt,Vt,!1,!0);let{left:qt,top:rn,width:yn,height:_n}=qr,Cn=yn>0||_n>0,tr=Nm!=qt||Rm!=rn||km!=yn||Dm!=_n;if(Cn&&tr&&wl(qr),vr.setScale&&Cn&&tr){let Zr=qt,nr=yn,hr=rn,Bn=_n;if(F.ori==1&&(Zr=rn,nr=_n,hr=qt,Bn=yn),Si&&go(P,xo(Zr,P),xo(Zr+nr,P)),Ii)for(let kn in N){let $n=N[kn];kn!=P&&$n.from==null&&$n.min!=ts&&go(kn,xo(hr+Bn,kn),xo(hr,kn))}Hs()}else j.lock&&(j._lock=!j._lock,Jl(Me,!0,he!=null));he!=null&&(Ue(fA,aR),vd(fA,r,ri,Hr,Q,fe,null))}function Ip(he,Me,Ge,Xe,dt,Mt,Vt){if(j._lock)return;Lt(he);let qt=Yo;if(Yo){let rn=!0,yn=!0,_n=10,Cn,tr;F.ori==0?(Cn=Si,tr=Ii):(Cn=Ii,tr=Si),Cn&&tr&&(rn=ri<=_n||ri>=Q-_n,yn=Hr<=_n||Hr>=fe-_n),Cn&&rn&&(ri=ri<xs?0:Q),tr&&yn&&(Hr=Hr<Ka?0:fe),Jl(null,!0,!0),Yo=!1}ri=-10,Hr=-10,B.fill(null),Jl(null,!0,!0),qt&&(Yo=qt)}function Op(he,Me,Ge,Xe,dt,Mt,Vt){j._lock||(Lt(he),bt(),Hs(),he!=null&&vd(HI,r,ri,Hr,Q,fe,null))}function Pm(){A.forEach(w0e),ft(r.width,r.height,!0)}Jg(P2,w1,Pm);const tc={};tc.mousedown=gu,tc.mousemove=Em,tc.mouseup=gd,tc.dblclick=Op,tc.setSeries=(he,Me,Ge,Xe)=>{let dt=ys.match[2];Ge=dt(r,Me,Ge),Ge!=-1&&gi(Ge,Xe,!0,!1)},ce&&(Fe(FI,b,gu),Fe(dA,b,Em),Fe(UI,b,he=>{Lt(he),md(!1)}),Fe(BI,b,Ip),Fe(HI,b,Op),mR.add(r),r.syncRect=md);const xd=r.hooks=t.hooks||{};function Ds(he,Me,Ge){xa?ks.push([he,Me,Ge]):he in xd&&xd[he].forEach(Xe=>{Xe.call(null,r,Me,Ge)})}(t.plugins||[]).forEach(he=>{for(let Me in he.hooks)xd[Me]=(xd[Me]||[]).concat(he.hooks[Me])});const xu=(he,Me,Ge)=>Ge,ys=Ho({key:null,setSeries:!1,filters:{pub:JI,sub:JI},scales:[P,C[1]?C[1].scale:null],match:[eO,eO,xu],values:[null,null]},j.sync);ys.match.length==2&&ys.match.push(xu),j.sync=ys;const Lp=ys.key,wh=a$(Lp);function vd(he,Me,Ge,Xe,dt,Mt,Vt){ys.filters.pub(he,Me,Ge,Xe,dt,Mt,Vt)&&wh.pub(he,Me,Ge,Xe,dt,Mt,Vt)}wh.sub(r);function jp(he,Me,Ge,Xe,dt,Mt,Vt){ys.filters.sub(he,Me,Ge,Xe,dt,Mt,Vt)&&tc[he](null,Me,Ge,Xe,dt,Mt,Vt)}r.pub=jp;function vu(){wh.unsub(r),mR.delete(r),_e.clear(),uR(P2,w1,Pm),c.remove(),se==null||se.remove(),Ds("destroy")}r.destroy=vu;function jc(){Ds("init",t,e),rt(e||t.data,!1),$[P]?Ic(P,$[P]):bt(),Ne=qr.show&&(qr.width>0||qr.height>0),Le=$e=!0,ft(t.width,t.height)}return C.forEach(ht),A.forEach(Ut),n?n instanceof HTMLElement?(n.appendChild(c),jc()):n(r,jc):jc(),r}no.assign=Ho;no.fmtNum=q7;no.rangeNum=I2;no.rangeLog=jT;no.rangeAsinh=W7;no.orient=Ax;no.pxRatio=Ri;no.join=ppe;no.fmtDate=Y7,no.tzDate=Tpe;no.sync=a$;{no.addGap=a0e,no.clipGaps=UT;let t=no.paths={points:h$};t.linear=m$,t.stepped=u0e,t.bars=d0e,t.spline=h0e}const n8=new Set(["timing_step_total","timing_step_active","timing_save_batch_total","timing_microbatch_count","timing_forward_total","timing_backward_total","timing_loss_computation_total","timing_compute_kl_total","timing_compute_entropy_total","timing_data_to_device_total","timing_prepare_tensors_total","timing_waiting_for_data","timing_weight_sync_trainer_total","timing_weight_sync_inference_total","timing_avg_inference_time","timing_avg_compute_reward_time","timing_generation_normal_pct","timing_generation_discarded_pct","timing_generation_canceled_pct","timing_generation_all_pct","timing_compute_reward_normal_pct","timing_compute_reward_discarded_pct","timing_compute_reward_canceled_pct","timing_compute_reward_all_pct","timing_idle_pct","timing_forward_microbatch_mean","timing_backward_microbatch_mean","timing_loss_computation_microbatch_mean","timing_compute_kl_microbatch_mean","timing_compute_entropy_microbatch_mean","timing_data_to_device_microbatch_mean","timing_prepare_tensors_microbatch_mean"]);function Ul({label:t,onRemove:e}){return f.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors whitespace-nowrap shrink-0",onClick:n=>{n.stopPropagation(),e()},children:[t,f.jsx(fu,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function r8(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}function y$(t){return t.split("/").pop()||t}function hx(t){var n;return((n=t.runName)==null?void 0:n.trim())||y$(t.runPath)}const M0e=y1-1,SO="max-w-[190px]";function u1(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function T0e(t){const e=u1(t),{isTruncated:n,prefix:r,suffix:i}=KG(t,M0e);return n?`<span class="inline-flex ${SO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${u1(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${u1(i)}</span></span>`:`<span class="inline-block ${SO} truncate align-bottom" title="${e}">${u1(r)}</span>`}function i8(t){const e=T0e(hx(t)),n=u1(y$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function b$(t){const e=Math.abs(t);if(e>=60)return kT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return qd(t)}const C0e=28;function E0e(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]:void 0,d=l<t.length?t[l]:void 0,p=c!=null,m=d!=null;if(p&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(p)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function f4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const A0e={reward:{title:"Reward",prefixes:[{prefix:"reward_sum",label:"Reward"}]},advantage:{title:"Advantage",prefixes:[{prefix:"advantage",label:"Advantage"}],showZeroLine:!0},rollouts:{title:"Rollouts",prefixes:[{prefix:"length_prompt",label:"Tokens (Prompt)"},{prefix:"length_completion",label:"Tokens (Completion)"},{prefix:"length_sum",label:"Tokens (Total)"}],unit:"tokens"}};function N0e(t){const e={...A0e};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:R0e(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function R0e(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const _$=["mean","std","min","max"],S$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function Dy(t,e){const n=typeof IntersectionObserver>"u",[r,i]=M.useState(n),[s,o]=M.useState(n),a=M.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return M.useEffect(()=>{const p=t.current;if(!p||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(([x])=>{const b=x.isIntersecting;i(b),b?(a.current&&(clearTimeout(a.current),a.current=null),o(!0)):(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o(!1),a.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return m.observe(p),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,d]),r||s}function k0e({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:o=null,availableRewardNames:a=[],availableSampleTags:l,customMetricSections:c={},xAxisMode:d="step",scrollRoot:p=null,evalsList:m=[]}){var Ee,Ce,Ye,Ze,it,ut,De,Ve,lt,Le,Ne,$e,ft,nt,We,Ke,je,et,pt,Lt,wt;const[x,b]=M.useState({}),[_,S]=M.useState(!0),[w,C]=M.useState(!0),[A,N]=M.useState(!0),[D,P]=M.useState(!0),[O,R]=M.useState({}),[L,V]=M.useState(!0),[F,U]=M.useState(!0),[W,Y]=M.useState(!0),[$,X]=M.useState(!0),[Z,K]=M.useState(!0),ne=M.useMemo(()=>N0e(a),[a]),H=d==="time",B=Fr(((Ee=t[0])==null?void 0:Ee.runPath)||"",H&&!!t[0],e),G=Fr(((Ce=t[1])==null?void 0:Ce.runPath)||"",H&&!!t[1],e),j=Fr(((Ye=t[2])==null?void 0:Ye.runPath)||"",H&&!!t[2],e),ie=Fr(((Ze=t[3])==null?void 0:Ze.runPath)||"",H&&!!t[3],e),ce=Fr(((it=t[4])==null?void 0:it.runPath)||"",H&&!!t[4],e),te=Fr(((ut=t[5])==null?void 0:ut.runPath)||"",H&&!!t[5],e),se=Fr(((De=t[6])==null?void 0:De.runPath)||"",H&&!!t[6],e),le=Fr(((Ve=t[7])==null?void 0:Ve.runPath)||"",H&&!!t[7],e),re=Fr(((lt=t[8])==null?void 0:lt.runPath)||"",H&&!!t[8],e),pe=Fr(((Le=t[9])==null?void 0:Le.runPath)||"",H&&!!t[9],e),be=Fr(((Ne=t[10])==null?void 0:Ne.runPath)||"",H&&!!t[10],e),xe=Fr((($e=t[11])==null?void 0:$e.runPath)||"",H&&!!t[11],e),Pe=Fr(((ft=t[12])==null?void 0:ft.runPath)||"",H&&!!t[12],e),me=Fr(((nt=t[13])==null?void 0:nt.runPath)||"",H&&!!t[13],e),ke=Fr(((We=t[14])==null?void 0:We.runPath)||"",H&&!!t[14],e),we=Fr(((Ke=t[15])==null?void 0:Ke.runPath)||"",H&&!!t[15],e),Te=Fr(((je=t[16])==null?void 0:je.runPath)||"",H&&!!t[16],e),oe=Fr(((et=t[17])==null?void 0:et.runPath)||"",H&&!!t[17],e),_e=Fr(((pt=t[18])==null?void 0:pt.runPath)||"",H&&!!t[18],e),Fe=Fr(((Lt=t[19])==null?void 0:Lt.runPath)||"",H&&!!t[19],e),{isStepTimesFetching:Ue,isStepTimesRefetching:Oe}=M.useMemo(()=>{if(!H)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const yt=[B,G,j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe],Pt=yt.some(Et=>Et.isFetching),zt=yt.filter(Et=>Et.isFetching),Dt=Pt&&zt.length>0&&zt.every(Et=>!!Et.data);return{isStepTimesFetching:Pt,isStepTimesRefetching:Dt}},[H,B,G,j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe]),{stepTimesByRun:ue,firstStepTimesByRun:Q}=M.useMemo(()=>{if(!H)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const yt=[B,G,j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe],Pt=new Map,zt=new Map;return t.forEach((Dt,Et)=>{if(Et>=20)return;const Qe=yt[Et].data;if(!Qe||Qe.first_step_time===null||Qe.first_step_time===void 0||!Qe.step_times||Qe.step_times.length===0)return;const ht=new Map;Qe.step_times.forEach(It=>{typeof It.time=="number"&&ht.set(It.step,It.time)}),ht.size>0&&(Pt.set(Dt.runPath,ht),zt.set(Dt.runPath,Qe.first_step_time))}),{stepTimesByRun:Pt,firstStepTimesByRun:zt}},[t,H,B,G,j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe]),fe={xAxisMode:d,stepTimesByRun:ue,firstStepTimesByRun:Q,isStepTimesFetching:Ue,isStepTimesRefetching:Oe,scrollRoot:p,maxStepLimit:n,maxTimeLimit:r},Se=M.useMemo(()=>Object.keys(c),[c]),Ae=M.useCallback(yt=>{b(Pt=>({...Pt,[yt]:!(Pt[yt]??!0)}))},[]),ve=M.useCallback(yt=>{R(Pt=>({...Pt,[yt]:!(Pt[yt]??!0)}))},[]),qe=m.length>0;return f.jsxs("div",{className:"-mt-3",children:[Se.map((yt,Pt)=>{const zt=x[yt]??!0,Dt=c[yt]??{},Et=Object.entries(Dt);return f.jsxs("div",{children:[Pt>0&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:zt,onOpenChange:()=>Ae(yt),children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!zt&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:f4(yt)})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-4 mt-3 mb-4",children:Et.map(([Be,Qe])=>f.jsxs("div",{children:[Be&&f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:f4(Be)}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Qe.map(ht=>f.jsx(ir,{runs:t,shouldPoll:e,metricName:ht,label:f4(ht),showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe},ht))})]},Be))})})]})]},yt)}),Se.length>0&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:_,onOpenChange:S,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:ne.reward.title})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:ne.reward.prefixes.map(yt=>f.jsx(lg,{runs:t,shouldPoll:e,prefix:yt.prefix,label:yt.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe,extraCharts:yt.prefix==="reward_sum"?f.jsx(ir,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${yt.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe}):void 0},yt.prefix))})})]}),ne.samples_metrics&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:w,onOpenChange:C,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!w&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:ne.samples_metrics.title})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:ne.samples_metrics.prefixes.map(yt=>f.jsx(lg,{runs:t,shouldPoll:e,prefix:yt.prefix,label:yt.label,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe,extraCharts:f.jsx(ir,{runs:t,shouldPoll:e,metricName:`${yt.prefix}_gini_mean`,label:`${yt.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe})},yt.prefix))})})]})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:A,onOpenChange:N,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!A&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:ne.advantage.title})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:ne.advantage.prefixes.map(yt=>f.jsx(lg,{runs:t,shouldPoll:e,prefix:yt.prefix,label:yt.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe},yt.prefix))})})]}),qe&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:D,onOpenChange:P,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!D&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"mt-3 mb-4 space-y-4",children:m.map((yt,Pt)=>{const zt=yt.eval_name,Dt=yt.available_rollout_metric_names,Et=O[zt]??!0;return f.jsxs("div",{children:[Pt>0&&f.jsx("div",{className:"border-t border-gray-100 my-3"}),f.jsxs(Fi,{open:Et,onOpenChange:()=>ve(zt),children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform",!Et&&"-rotate-90")}),f.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:zt})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3",children:[Dt.map(Be=>f.jsx(h4,{runs:t,shouldPoll:e,evalName:zt,prefix:`reward_${Be}`,label:f4(Be),showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:p,xAxisMode:d,stepTimesByRun:fe.stepTimesByRun,firstStepTimesByRun:fe.firstStepTimesByRun,isStepTimesFetching:fe.isStepTimesFetching,isStepTimesRefetching:fe.isStepTimesRefetching,maxStepLimit:fe.maxStepLimit,maxTimeLimit:fe.maxTimeLimit},`${zt}-reward_${Be}`)),f.jsx(h4,{runs:t,shouldPoll:e,evalName:zt,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:p,xAxisMode:d,stepTimesByRun:fe.stepTimesByRun,firstStepTimesByRun:fe.firstStepTimesByRun,isStepTimesFetching:fe.isStepTimesFetching,isStepTimesRefetching:fe.isStepTimesRefetching,maxStepLimit:fe.maxStepLimit,maxTimeLimit:fe.maxTimeLimit}),f.jsx(h4,{runs:t,shouldPoll:e,evalName:zt,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:p,xAxisMode:d,stepTimesByRun:fe.stepTimesByRun,firstStepTimesByRun:fe.firstStepTimesByRun,isStepTimesFetching:fe.isStepTimesFetching,isStepTimesRefetching:fe.isStepTimesRefetching,maxStepLimit:fe.maxStepLimit,maxTimeLimit:fe.maxTimeLimit}),f.jsx(h4,{runs:t,shouldPoll:e,evalName:zt,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:p,xAxisMode:d,stepTimesByRun:fe.stepTimesByRun,firstStepTimesByRun:fe.firstStepTimesByRun,isStepTimesFetching:fe.isStepTimesFetching,isStepTimesRefetching:fe.isStepTimesRefetching,maxStepLimit:fe.maxStepLimit,maxTimeLimit:fe.maxTimeLimit})]})})]})]},zt)})})})]})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:L,onOpenChange:V,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!L&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:ne.rollouts.title})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[ne.rollouts.prefixes.map(yt=>f.jsx(lg,{runs:t,shouldPoll:e,prefix:yt.prefix,label:yt.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe},yt.prefix)),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"General"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...fe})]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:F,onOpenChange:U,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!F&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Discarded Rollouts General"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Max Async %",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Zero Advantage Breakdown"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Canceled"}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.jsx(ir,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:o,...fe})})]}),f.jsx(lg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(lg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(lg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:W,onOpenChange:Y,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Trainer"})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Full Step (Total Time)"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Microbatch (Mean Time per Microbatch)"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:$,onOpenChange:X,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!$&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Inference"})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Batch & Averages"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_avg_inference_time",label:"Avg Generation Time",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Time Breakdown (% of Step Time)"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_generation_normal_pct",label:"Generation Normal",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_generation_discarded_pct",label:"Generation Discarded",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_generation_canceled_pct",label:"Generation Canceled",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_generation_all_pct",label:"Generation All",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_normal_pct",label:"Compute Reward Normal",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_discarded_pct",label:"Compute Reward Discarded",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_canceled_pct",label:"Compute Reward Canceled",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_all_pct",label:"Compute Reward All",showEma:i,emaSpan:s,hoveredRunId:o,...fe}),f.jsx(ir,{runs:t,shouldPoll:e,metricName:"timing_idle_pct",label:"Idle Time",showEma:i,emaSpan:s,hoveredRunId:o,...fe})]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:Z,onOpenChange:K,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!Z&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Inference Performance"})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"mt-3 mb-4",children:t[0]&&f.jsx(O0e,{runPath:((wt=t.find(yt=>yt.isSelected))==null?void 0:wt.runPath)??t[0].runPath,shouldPoll:e,scrollRoot:p})})})]})]})}const L2=100;function D0e(t,e,n){const r=t.length;if(r<=L2)return{steps:t,counts:e};const i=Math.ceil(r/L2),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const p=new Array(a).fill(0);for(let m=l;m<c;m++){const x=e[m];for(let b=0;b<a;b++)p[b]+=x[b]||0}o.push(p)}return{steps:s,counts:o}}function w$({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:o=null,headerPrefix:a,headerSuffix:l}){const c=Jn(No),d=M.useRef(null),p=M.useRef(null),m=M.useRef(null),x=M.useRef(null),b=M.useRef(null),_=Dy(d,{root:o,threshold:0}),{data:S,isFetching:w,isRefetching:C}=qG(t,e,_&&!!t&&!!e,s),A=S&&S.steps.length>0&&S.bin_edges.length>0,N=A&&S.steps.length>L2,D=M.useMemo(()=>!A||!S?null:N?D0e(S.steps,S.counts,S.bin_edges):{steps:S.steps,counts:S.counts},[A,S,N]),P=M.useCallback(U=>U==null?"N/A":i?Math.round(U).toLocaleString():td(U),[i]),O=M.useCallback(U=>Math.abs(U)>=1e3?`${parseFloat((U/1e3).toFixed(1))}k`:i?Math.round(U).toString():Number.isInteger(U)?U.toLocaleString():Math.abs(U)<.01&&U!==0?U.toExponential(1):String(parseFloat(U.toFixed(2))),[i]),R=M.useCallback(()=>{const U={top:8,right:8,bottom:24,left:40};if(!m.current||!S)return U;const W=m.current.getContext("2d");if(!W)return U;const Y="10px system-ui, sans-serif",$=5;let X=0;W.save(),W.setTransform(1,0,0,1,0,0),W.font=Y;for(let Z=0;Z<$;Z++){const K=(S.global_min??0)+Z/($-1)*((S.global_max??0)-(S.global_min??0)),ne=O(K);X=Math.max(X,W.measureText(ne).width)}return W.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(X)+12)}},[S,O]);M.useEffect(()=>{if(!p.current||!m.current||!A||!S||!D)return;const U=p.current,W=m.current,Y=W.getContext("2d");if(!Y)return;const $=U.clientWidth,X=200,Z=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",K=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ne="10px system-ui, sans-serif",H=window.devicePixelRatio||1;W.width=$*H,W.height=X*H,W.style.width=`${$}px`,W.style.height=`${X}px`,Y.scale(H,H),Y.font=ne,Y.clearRect(0,0,$,X);const B=R(),G=$-B.left-B.right,j=X-B.top-B.bottom,ie=D.steps,ce=S.bin_edges,te=D.counts,se=ie.length,le=ce.length-1;if(se===0||le===0)return;let re=0;for(const Te of te)for(const oe of Te)oe>re&&(re=oe);const pe=Math.min(5,se),be=5,xe=G/Math.max(se,1),Pe=Te=>B.left+(Te+.5)*xe,me=Te=>{const oe=(S.global_max??1)-(S.global_min??0),_e=(Te-(S.global_min??0))/(oe||1);return B.top+j-_e*j},ke=Te=>Te===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Te/re)*.75})`;Y.strokeStyle=K,Y.lineWidth=1;for(let Te=0;Te<pe;Te++){const oe=Math.floor(Te/Math.max(pe-1,1)*(se-1)),_e=Pe(oe);Y.beginPath(),Y.moveTo(_e,B.top),Y.lineTo(_e,X-B.bottom),Y.stroke()}for(let Te=0;Te<be;Te++){const oe=(S.global_min??0)+Te/(be-1)*((S.global_max??0)-(S.global_min??0)),_e=me(oe);Y.beginPath(),Y.moveTo(B.left,_e),Y.lineTo($-B.right,_e),Y.stroke()}const we=xe;for(let Te=0;Te<se;Te++){const oe=B.left+Te*xe,_e=te[Te];for(let Fe=0;Fe<le;Fe++){const Ue=_e[Fe];if(Ue===0)continue;const Oe=ce[Fe+1],ue=ce[Fe],Q=me(Oe),fe=me(ue),Se=Math.max(1,fe-Q);Y.fillStyle=ke(Ue),Y.fillRect(oe,Q,we,Se)}}if(r&&(S.global_min??0)<0&&(S.global_max??0)>0){const Te=me(0);Y.strokeStyle=c?"rgba(255, 255, 255, 0.3)":"rgba(128, 128, 128, 0.5)",Y.lineWidth=1,Y.setLineDash([5,5]),Y.beginPath(),Y.moveTo(B.left,Te),Y.lineTo($-B.right,Te),Y.stroke(),Y.setLineDash([])}Y.strokeStyle=Z,Y.lineWidth=1,Y.beginPath(),Y.moveTo(B.left,X-B.bottom),Y.lineTo($-B.right,X-B.bottom),Y.stroke(),Y.beginPath(),Y.moveTo(B.left,B.top),Y.lineTo(B.left,X-B.bottom),Y.stroke(),Y.fillStyle=Z,Y.font=ne,Y.textAlign="center";for(let Te=0;Te<pe;Te++){const oe=Math.floor(Te/Math.max(pe-1,1)*(se-1)),_e=ie[oe],Fe=Pe(oe),Ue=_e>=1e3?`${(_e/1e3).toFixed(0)}k`:_e.toString();Y.fillText(Ue,Fe,X-6)}Y.textAlign="right",Y.textBaseline="middle";for(let Te=0;Te<be;Te++){const oe=(S.global_min??0)+Te/(be-1)*((S.global_max??0)-(S.global_min??0)),_e=me(oe);Y.fillText(O(oe),B.left-4,_e)}},[S,D,A,r,O,R,c]),M.useEffect(()=>{if(!p.current)return;const U=p.current,W=new ResizeObserver(()=>{if(m.current&&p.current){const Y=p.current.clientWidth;m.current.style.width=`${Y}px`}});return W.observe(U),()=>{W.disconnect()}},[]);const L=M.useCallback(U=>{var Ue;if(!S||!D||!x.current||!m.current||!p.current)return;const W=m.current.getBoundingClientRect(),Y=U.clientX-W.left,$=U.clientY-W.top,X=p.current.clientWidth,Z=200,K=R(),ne=X-K.left-K.right,H=Z-K.top-K.bottom;if(ne<=0||H<=0){b.current&&(b.current.style.display="none");return}if(Y<K.left||Y>X-K.right||$<K.top||$>Z-K.bottom){x.current.style.display="none",b.current&&(b.current.style.display="none");return}const B=(Y-K.left)/ne,G=Math.min(D.steps.length-1,Math.max(0,Math.round(B*(D.steps.length-1)))),j=D.steps[G];if(b.current){const Oe=ne/Math.max(D.steps.length,1),ue=K.left+(G+.5)*Oe;b.current.style.display="block",b.current.style.left=`${ue}px`,b.current.style.top=`${K.top}px`,b.current.style.bottom=`${K.bottom}px`}const ie=1-($-K.top)/H,ce=S.bin_edges.length-1,te=Math.min(ce-1,Math.max(0,Math.floor(ie*ce))),se=S.bin_edges[te],le=S.bin_edges[te+1],re=((Ue=D.counts[G])==null?void 0:Ue[te])??0,be=(D.counts[G]??[]).reduce((Oe,ue)=>Oe+ue,0),xe=be>0?(re/be*100).toFixed(1):"0.0",me=N&&S.steps.length>L2?" (aggregated)":"";x.current.innerHTML=`
        <div class="font-medium mb-1">Step ${j.toLocaleString()}${me}</div>
        <div class="text-muted-foreground">Range: ${P(se)} to ${P(le)}</div>
        <div class="text-muted-foreground">Count: ${re.toLocaleString()} (${xe}%)</div>
      `,x.current.style.display="block",x.current.style.left="0px",x.current.style.top="0px";const ke=x.current.getBoundingClientRect(),we=U.clientX;let Te=we;Te+ke.width+20>window.innerWidth&&(Te=we-ke.width);const oe=Math.max(4,window.innerWidth-ke.width-4);Te=Math.min(Math.max(4,Te),oe);const _e=p.current.getBoundingClientRect();let Fe=_e.top-ke.height+20;Fe<4&&(Fe=_e.bottom-20),x.current.style.left=`${Te-ke.left}px`,x.current.style.top=`${Fe-ke.top}px`},[S,D,P,R,N]),V=M.useCallback(()=>{x.current&&(x.current.style.display="none"),b.current&&(b.current.style.display="none")},[]),F=w&&!C;return f.jsxs("div",{ref:d,className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background",F&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a,f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),l&&f.jsx("div",{className:"flex items-center gap-2 shrink-0",children:l})]}),A?f.jsxs("div",{className:"h-[200px] relative bg-background rounded",ref:p,children:[f.jsx("canvas",{className:"block w-full h-full max-w-full",ref:m,onMouseMove:L,onMouseLeave:V}),f.jsx("div",{ref:b,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),f.jsx("div",{ref:x,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),C&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground text-xs rounded",children:w?"Loading...":"No data"})]})}function P0e(t,e,n,r,i){const s=M.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),o=ede(s,e,n?[n]:[],i&&s.length>0&&!!n,r);return{metricsByRunPath:M.useMemo(()=>{var c,d;const l=new Map;return(d=(c=o.data)==null?void 0:c.runs)==null||d.forEach(p=>{l.set(p.run_path,p.metrics??[])}),l},[o.data]),isFetching:o.isFetching,isRefetching:o.isFetching&&!!o.data}}function M$({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:o,statType:a,isTokenMetric:l,showEma:c=!1,emaSpan:d=10,hoveredRunId:p=null,xAxisMode:m="step",stepTimesByRun:x,firstStepTimesByRun:b,isStepTimesFetching:_=!1,isStepTimesRefetching:S=!1,scrollRoot:w=null,maxStepLimit:C,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,filterKey:P}){const O=Jn(No),R=M.useRef(null),L=M.useRef(null),V=M.useRef(null),F=M.useRef(null),[U,W]=dn(jG),Y=M.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),$=M.useRef(!1),X=M.useRef(!1);M.useEffect(()=>{const Ve=Le=>{(Le.key==="Control"||Le.key==="Meta")&&(X.current=!0)},lt=Le=>{(Le.key==="Control"||Le.key==="Meta")&&(X.current=!1,W(null))};return window.addEventListener("keydown",Ve),window.addEventListener("keyup",lt),()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("keyup",lt)}},[W]);const Z=P??`eval/${n}/${r}`,[K,ne]=dn(b7),B=n8.has(r),G=K[Z],j=(G==null?void 0:G.ignoreOutliers)??!1,ie=(G==null?void 0:G.ignoreFirstStep)??B,ce=(G==null?void 0:G.minY)??null,te=(G==null?void 0:G.maxY)??null,se=(G==null?void 0:G.tagFilters)??{},le=Object.keys(se).length>0,re=M.useCallback(Ve=>{ne(lt=>{const Le={ignoreOutliers:!1,ignoreFirstStep:B,minY:null,maxY:null,tagFilters:{}},Ne=lt[Z]??Le,$e=Ve(Ne);if($e.ignoreOutliers===Le.ignoreOutliers&&$e.ignoreFirstStep===Le.ignoreFirstStep&&$e.minY===Le.minY&&$e.maxY===Le.maxY&&Object.keys($e.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(lt,Z))return lt;const nt={...lt};return delete nt[Z],nt}return{...lt,[Z]:$e}})},[Z,ne,B]),pe=M.useCallback(Ve=>{re(lt=>({...lt,ignoreOutliers:Ve}))},[re]),be=M.useCallback(Ve=>{re(lt=>({...lt,ignoreFirstStep:Ve}))},[re]),xe=M.useCallback(Ve=>{re(lt=>({...lt,minY:Ve}))},[re]),Pe=M.useCallback(Ve=>{re(lt=>({...lt,maxY:Ve}))},[re]),me=M.useCallback((Ve,lt)=>{re(Le=>{const Ne={...Le.tagFilters??{}},$e=Ne[Ve]??[];if($e.includes(lt)){const ft=$e.filter(nt=>nt!==lt);ft.length===0?delete Ne[Ve]:Ne[Ve]=ft}else Ne[Ve]=[...$e,lt];return{...Le,tagFilters:Ne}})},[re]),ke=Dy(R,{root:w,threshold:0}),we=M.useMemo(()=>{const Ve=t.filter(Le=>!Le.isSelected),lt=t.filter(Le=>Le.isSelected);return[...Ve,...lt]},[t]),Te=M.useMemo(()=>we.slice(0,20),[we]),oe=M.useMemo(()=>{const Ve=new Map;return Te.forEach((lt,Le)=>{Ve.set(lt.runPath,Le)}),Ve},[Te]),{metricsByRunPath:_e,isFetching:Fe,isRefetching:Ue}=P0e(t,n,r,e,ke),{uplotData:Oe,seriesConfig:ue,isFetching:Q,isRefetching:fe,hasData:Se,timeToStepByRun:Ae,outlierBounds:ve}=M.useMemo(()=>{const Ve=new Set,lt=new Map,Le=new Map,Ne=new Map,$e=m==="time"&&!!x&&!!b,ft=Fe;we.forEach((wt,yt)=>{if(yt>=20)return;const Pt=_e.get(wt.runPath)??[],zt=new Map;if(Pt.forEach(Dt=>{Ve.add(Dt.step),zt.set(Dt.step,Dt.value)}),lt.set(yt,zt),$e){const Dt=x==null?void 0:x.get(wt.runPath),Et=b==null?void 0:b.get(wt.runPath);if(Dt&&Et!==void 0){const Be=new Map,Qe=new Map;Dt.forEach((ht,It)=>{const Tt=ht-Et;Be.set(It,Tt),Qe.set(Tt,It)}),Le.set(yt,Be),Ne.set(yt,Qe)}}});const nt=()=>!(!ft&&!_||ft&&!Ue||_&&!S);if(Ve.size===0)return{uplotData:null,seriesConfig:[],isFetching:ft||_,isRefetching:nt(),hasData:!1,timeToStepByRun:Ne,outlierBounds:null};let We=Array.from(Ve).sort((wt,yt)=>wt-yt);C!=null&&!$e&&(We=We.filter(wt=>wt<=C));let Ke=We;if($e){const wt=new Set;if(lt.forEach((Pt,zt)=>{const Dt=Le.get(zt);Dt&&Pt.forEach((Et,Be)=>{const Qe=Dt.get(Be);Qe!==void 0&&wt.add(Qe)})}),wt.size===0)return{uplotData:null,seriesConfig:[],isFetching:ft||_,isRefetching:nt(),hasData:!1,timeToStepByRun:Ne,outlierBounds:null};let yt=Array.from(wt).sort((Pt,zt)=>Pt-zt);A!=null&&(yt=yt.filter(Pt=>Pt<=A)),Ke=yt}let je=null;if(j){const wt=[];lt.forEach(yt=>{yt.forEach(Pt=>{wt.push(Pt)})}),je=r8(wt)}const et=new Float64Array(Ke),pt=[{label:$e?"Time (s)":"Step"}],Lt=[et];return we.forEach((wt,yt)=>{if(yt>=20)return;const Pt=lt.get(yt)||new Map;let zt;if($e){const Qe=Le.get(yt),ht=new Map;Qe&&Pt.forEach((It,Tt)=>{const ct=Qe.get(Tt);ct!==void 0&&ht.set(ct,It)}),zt=Ke.map(It=>ht.get(It)??null)}else zt=We.map(Qe=>Pt.get(Qe)??null);const Dt=p===wt.runPath,Be=p!==null&&!Dt?.1:c?.3:1;Lt.push(zt),pt.push({label:hx(wt),stroke:wt.color,width:1,alpha:Be,spanGaps:!0,points:{show:!1}})}),c&&we.forEach((wt,yt)=>{if(yt>=20)return;const Pt=lt.get(yt)||new Map,zt=2/(d+1);let Dt=null,Et;if($e){const It=Le.get(yt),Tt=new Map;We.forEach(ct=>{const Ut=Pt.get(ct);if(Ut!==void 0){Dt=Dt===null?Ut:zt*Ut+(1-zt)*Dt;const Gt=It==null?void 0:It.get(ct);Gt!==void 0&&Dt!==null&&Tt.set(Gt,Dt)}}),Et=Ke.map(ct=>Tt.get(ct)??null)}else{const It=[];We.forEach(Tt=>{const ct=Pt.get(Tt);ct!==void 0?(Dt=Dt===null?ct:zt*ct+(1-zt)*Dt,It.push(Dt)):It.push(null)}),Et=It}const Be=p===wt.runPath,ht=p!==null&&!Be?.1:1;Lt.push(Et),pt.push({label:`${hx(wt)} (EMA)`,stroke:wt.color,width:1.5,alpha:ht,spanGaps:!0,points:{show:!1}})}),{uplotData:Lt,seriesConfig:pt,isFetching:ft||_,isRefetching:nt(),hasData:!0,timeToStepByRun:Ne,outlierBounds:je}},[we,_e,Fe,Ue,c,d,p,m,x,b,_,S,C,A,j]),qe=a||r.split("_").pop()||"",Ee=m==="time",Ce=M.useCallback(Ve=>Ve==null?"N/A":l&&(qe==="min"||qe==="max")?Math.round(Ve).toLocaleString():td(Ve),[l,qe]),Ye=M.useCallback(Ve=>Math.abs(Ve)>=1e3?`${parseFloat((Ve/1e3).toFixed(1))}k`:l?qe==="min"||qe==="max"?Math.round(Ve).toString():String(parseFloat(Ve.toFixed(1))):Number.isInteger(Ve)?Ve.toLocaleString():Math.abs(Ve)<.01&&Ve!==0?Ve.toExponential(1):String(parseFloat(Ve.toFixed(2))),[l,qe]),Ze=M.useCallback(Ve=>Ee?qd(Ve):Ve>=1e3?`${(Ve/1e3).toFixed(0)}k`:Ve.toString(),[Ee]);M.useEffect(()=>{if(!L.current||!Oe||!Se)return;const Ve=L.current,lt=Ve.clientWidth,Le=Ve.clientHeight||192;let Ne=1/0,$e=-1/0;for(let Dt=1;Dt<Oe.length;Dt++){const Et=Oe[Dt];for(let Be=0;Be<Et.length;Be++){if(ie&&Be===0)continue;const Qe=Et[Be];Qe!=null&&(j&&ve?Qe>=ve.lower&&Qe<=ve.upper&&(Qe<Ne&&(Ne=Qe),Qe>$e&&($e=Qe)):(Qe<Ne&&(Ne=Qe),Qe>$e&&($e=Qe)))}}Ne===1/0&&ve&&(Ne=ve.lower,$e=ve.upper);const ft=$e-Ne,nt=Math.max(Math.abs($e),Math.abs(Ne)),We=Math.max(nt*.05,1e-10),Ke=Math.max(ft*.1,We);let je,et;o?(je=Math.min(Ne-Ke,0),et=Math.max($e+Ke,0)):(je=Ne-Ke,et=$e+Ke),ce!==null&&(je=ce),te!==null&&(et=te);const pt=O?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Lt=O?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",yt={width:lt,height:Le,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[je,et]}},axes:[{stroke:Lt,grid:{stroke:pt,width:1},ticks:{stroke:pt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Dt,Et)=>Et.map(Ze)},{stroke:Lt,grid:{stroke:pt,width:1},ticks:{stroke:pt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Dt,Et)=>{if(!Et||Et.length===0)return 40;const Be=Math.max(...Et.map(Qe=>Qe.length));return Math.max(40,Be*7+14)},values:(Dt,Et)=>Et.map(Ye)}],series:ue,hooks:{draw:[Dt=>{var It,Tt;if(!Oe)return;const Et=Oe[0],Be=Math.min(we.length,20),Qe=Dt.series.length,ht=Dt.ctx;ht.save();for(let ct=1;ct<Qe;ct++){const Ut=Oe[ct];if(!Ut)continue;let Gt=-1;for(let ge=Ut.length-1;ge>=0;ge--)if(Ut[ge]!==null&&Ut[ge]!==void 0){Gt=ge;break}if(Gt===-1)continue;const sn=Et[Gt],nn=Ut[Gt];if(sn===void 0||nn===void 0||nn===null)continue;const En=Dt.valToPos(Number(sn),"x",!0),Hn=Dt.valToPos(Number(nn),"y",!0);if(!Number.isFinite(En)||!Number.isFinite(Hn))continue;const Nn=Dt.series[ct],Br=typeof(Nn==null?void 0:Nn.alpha)=="number"?Nn.alpha:1;let er=typeof(Nn==null?void 0:Nn.stroke)=="string"?Nn.stroke:void 0;if(!er){const ge=ct-1;if(ge<Be)er=(It=we[ge])==null?void 0:It.color;else if(c){const rt=ge-Be;rt>=0&&rt<Be&&(er=(Tt=we[rt])==null?void 0:Tt.color)}}er&&(ht.globalAlpha=Br,ht.fillStyle=er,ht.beginPath(),ht.arc(En,Hn,4,0,Math.PI*2),ht.fill())}ht.restore()}],setCursor:[Dt=>{if(!F.current)return;const{left:Et,top:Be,idx:Qe}=Dt.cursor;if(Qe==null||Et===void 0||Be===void 0||Et<0){F.current.style.display="none";return}const ht=Oe[0][Qe];if(ht===void 0){F.current.style.display="none";return}X.current&&!$.current&&W({xValue:Number(ht),sourceChartId:Y});let Tt=`<div class="font-medium mb-1">${Ee?`Time ${b$(Number(ht))}`:`Step ${Number(ht).toLocaleString()}`}</div>`;const ct=Te.length;t.forEach(En=>{var rt;const Hn=oe.get(En.runPath);if(Hn===void 0)return;const Nn=Hn+1,Br=Oe[Nn];if(!Br)return;const er=Br[Qe];let ge;if(c){const bt=ct+Hn+1;ge=(rt=Oe[bt])==null?void 0:rt[Qe]}er!=null&&(Tt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${En.color}"></div>
                    <span>${i8(En)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${Ce(er)}${s?` ${s}`:""}</span>
                    ${c&&ge!==void 0&&ge!==null?`<span class="text-muted-foreground">(EMA: ${Ce(ge)})</span>`:""}
                  </div>
                </div>
              `)}),F.current.innerHTML=Tt,F.current.style.display="block";const Ut=L.current.getBoundingClientRect(),Gt=F.current.getBoundingClientRect();let sn=Ut.left+Et+15;sn+Gt.width+20>window.innerWidth&&(sn=Ut.left+Et-Gt.width-15+Dt.bbox.left),sn=Math.max(4,sn);let nn=Ut.top-Gt.height+20;nn<4&&(nn=Ut.bottom-20),F.current.style.left=`${sn}px`,F.current.style.top=`${nn}px`}]}};V.current&&V.current.destroy();const Pt=new no(yt,Oe,Ve);V.current=Pt;const zt=new ResizeObserver(Dt=>{for(const Et of Dt){const{width:Be,height:Qe}=Et.contentRect;Pt&&Be>0&&Qe>0&&Pt.setSize({width:Be,height:Qe})}});return zt.observe(Ve),()=>{zt.disconnect(),Pt.destroy(),V.current=null}},[Oe,ue,Se,Ze,Ye,Ce,Ee,Ae,we,p,c,o,s,t,Te,oe,Y,W,j,ie,ve,ce,te,O]),M.useEffect(()=>{if(!U){F.current&&(F.current.style.display="none");return}if(U.sourceChartId===Y||!V.current||!Oe)return;const Ve=V.current,lt=Oe[0];if(!lt||lt.length===0)return;const Le=U.xValue;let Ne=0,$e=1/0;for(let nt=0;nt<lt.length;nt++){const We=Math.abs(Number(lt[nt])-Le);We<$e&&($e=We,Ne=nt)}const ft=Ve.valToPos(Number(lt[Ne]),"x");ft>=0&&ft<=Ve.width&&($.current=!0,Ve.setCursor({left:ft,top:0}),$.current=!1)},[U,Y,Oe]);const it=M.useCallback(()=>{F.current&&(F.current.style.display="none"),(U==null?void 0:U.sourceChartId)===Y&&W(null)},[U,Y,W]),ut=Q&&!fe,De=i||(qe?`${qe.charAt(0).toUpperCase()}${qe.slice(1)}`:r);return f.jsxs("div",{ref:R,className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background h-[246px] flex flex-col",ut&&"opacity-50"),children:[f.jsxs("div",{className:"shrink-0 mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:De})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:j,onCheckedChange:pe,children:"Ignore Outliers"}),f.jsx(ti,{checked:ie,onCheckedChange:be,children:"Ignore First Step"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:ce??"",onChange:Ve=>{const lt=Ve.target.value;xe(lt===""?null:Number(lt))},onClick:Ve=>Ve.stopPropagation(),onKeyDown:Ve=>Ve.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:te??"",onChange:Ve=>{const lt=Ve.target.value;Pe(lt===""?null:Number(lt))},onClick:Ve=>Ve.stopPropagation(),onKeyDown:Ve=>Ve.stopPropagation()})]})]})]}),D]})]}),(j||ie||ce!==null||te!==null||le)&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[j&&f.jsx(Ul,{label:"Ignore Outliers",onRemove:()=>pe(!1)}),ie&&f.jsx(Ul,{label:"Ignore First Step",onRemove:()=>be(!1)}),ce!==null&&f.jsx(Ul,{label:`Min Y: ${ce}`,onRemove:()=>xe(null)}),te!==null&&f.jsx(Ul,{label:`Max Y: ${te}`,onRemove:()=>Pe(null)}),Object.entries(se).map(([Ve,lt])=>lt.map(Le=>f.jsx(Ul,{label:`${Ve}: ${Le}`,onRemove:()=>me(Ve,Le)},`${Ve}:${Le}`)))]})]}),Se?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:L,onMouseLeave:it,children:[f.jsx("div",{ref:F,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),fe&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Q?"Loading...":"No data"})]})}function h4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:o,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:p,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:w,maxTimeLimit:C}){return f.jsxs("div",{children:[f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:i}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:_$.map(A=>f.jsx(M$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${A}`,label:`${i} ${S$[A]}`,unit:s,showZeroLine:o,statType:A,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:p,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:w,maxTimeLimit:C},`${n}-${r}_${A}`))})]})}function lg({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:p,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:w,extraCharts:C,hideGroupLabel:A,availableSampleTags:N}){const D=t.find(P=>P.isSelected)??t[0];return f.jsxs("div",{children:[!A&&f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:r}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[_$.map(P=>f.jsx(ir,{runs:t,shouldPoll:e,metricName:`${n}_${P}`,label:`${r} ${S$[P]}`,unit:i,showZeroLine:s,statType:P,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:p,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:w,availableSampleTags:N},`${n}_${P}`)),C,D&&f.jsx(w$,{runPath:D.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:o,shouldPoll:e,scrollRoot:_})]})]})}function I0e(t,e,n,r,i){const s=M.useMemo(()=>t.slice(0,20).map(c=>c.runPath).filter(Boolean),[t]),o=M.useMemo(()=>e?[e]:[],[e]),a=Que(s,o,r&&s.length>0&&o.length>0,n,i);return{metricsByRunPath:M.useMemo(()=>{var d,p;const c=new Map;return(p=(d=a.data)==null?void 0:d.runs)==null||p.forEach(m=>{c.set(m.run_path,m.metrics??[])}),c},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function ir({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:o,isTokenMetric:a,showEma:l=!1,emaSpan:c=10,hoveredRunId:d=null,xAxisMode:p="step",stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b=!1,isStepTimesRefetching:_=!1,scrollRoot:S=null,defaultIgnoreOutliers:w,maxStepLimit:C,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,availableSampleTags:P,filterKey:O}){const R=Jn(No),L=M.useRef(null),V=M.useRef(null),F=M.useRef(null),U=M.useRef(null),[W,Y]=dn(jG),[$,X]=dn(b7),Z=M.useMemo(()=>`metric-${n}`,[n]),K=M.useRef(!1),ne=M.useRef(!1);M.useEffect(()=>{const Ne=ft=>{(ft.key==="Control"||ft.key==="Meta")&&(ne.current=!0)},$e=ft=>{(ft.key==="Control"||ft.key==="Meta")&&(ne.current=!1,Y(null))};return window.addEventListener("keydown",Ne),window.addEventListener("keyup",$e),()=>{window.removeEventListener("keydown",Ne),window.removeEventListener("keyup",$e)}},[Y]);const H=O??n,B=w??!1,j=n8.has(n),ie=$[H],ce=(ie==null?void 0:ie.ignoreOutliers)??B,te=(ie==null?void 0:ie.ignoreFirstStep)??j,se=(ie==null?void 0:ie.minY)??null,le=(ie==null?void 0:ie.maxY)??null,re=(ie==null?void 0:ie.tagFilters)??{},pe=M.useCallback(Ne=>{X($e=>{const ft={ignoreOutliers:B,ignoreFirstStep:j,minY:null,maxY:null,tagFilters:{}},nt=$e[H]??ft,We=Ne(nt);if(We.ignoreOutliers===ft.ignoreOutliers&&We.ignoreFirstStep===ft.ignoreFirstStep&&We.minY===ft.minY&&We.maxY===ft.maxY&&Object.keys(We.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call($e,H))return $e;const je={...$e};return delete je[H],je}return{...$e,[H]:We}})},[H,X,B,j]),be=M.useCallback(Ne=>{pe($e=>({...$e,ignoreOutliers:Ne}))},[pe]),xe=M.useCallback(Ne=>{pe($e=>({...$e,ignoreFirstStep:Ne}))},[pe]),Pe=M.useCallback(Ne=>{pe($e=>({...$e,minY:Ne}))},[pe]),me=M.useCallback(Ne=>{pe($e=>({...$e,maxY:Ne}))},[pe]),ke=M.useCallback((Ne,$e)=>{pe(ft=>{const nt={...ft.tagFilters??{}},We=nt[Ne]??[];if(We.includes($e)){const Ke=We.filter(je=>je!==$e);Ke.length===0?delete nt[Ne]:nt[Ne]=Ke}else nt[Ne]=[...We,$e];return{...ft,tagFilters:nt}})},[pe]),we=Object.keys(re).length>0,Te=Dy(L,{root:S,threshold:0}),oe=M.useMemo(()=>{const Ne=t.filter(ft=>!ft.isSelected),$e=t.filter(ft=>ft.isSelected);return[...Ne,...$e]},[t]),_e=M.useMemo(()=>oe.slice(0,20),[oe]),Fe=M.useMemo(()=>{const Ne=new Map;return _e.forEach(($e,ft)=>{Ne.set($e.runPath,ft)}),Ne},[_e]),{metricsByRunPath:Ue,isFetching:Oe,isRefetching:ue}=I0e(t,n,e,Te,re),{uplotData:Q,seriesConfig:fe,isFetching:Se,isRefetching:Ae,hasData:ve,timeToStepByRun:qe,outlierBounds:Ee}=M.useMemo(()=>{const Ne=new Set,$e=new Map,ft=new Map,nt=new Map,We=p==="time"&&!!m&&!!x,Ke=Oe;oe.forEach((Dt,Et)=>{if(Et>=20)return;const Be=Ue.get(Dt.runPath)??[],Qe=new Map;if(Be.forEach(ht=>{Ne.add(ht.step),Qe.set(ht.step,ht.value)}),$e.set(Et,Qe),We){const ht=m==null?void 0:m.get(Dt.runPath),It=x==null?void 0:x.get(Dt.runPath);if(ht&&It!==void 0){const Tt=new Map,ct=new Map;ht.forEach((Ut,Gt)=>{const sn=Ut-It;Tt.set(Gt,sn),ct.set(sn,Gt)}),ft.set(Et,Tt),nt.set(Et,ct)}}});const je=()=>!(!Ke&&!b||Ke&&!ue||b&&!_);if(Ne.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ke||b,isRefetching:je(),hasData:!1,timeToStepByRun:nt,outlierBounds:null,minStep:null};const et=Math.min(...Array.from(Ne));let pt=Array.from(Ne).sort((Dt,Et)=>Dt-Et);C!=null&&!We&&(pt=pt.filter(Dt=>Dt<=C));let Lt=pt;if(We){const Dt=new Set;if($e.forEach((Be,Qe)=>{const ht=ft.get(Qe);ht&&Be.forEach((It,Tt)=>{const ct=ht.get(Tt);ct!==void 0&&Dt.add(ct)})}),Dt.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ke||b,isRefetching:je(),hasData:!1,timeToStepByRun:nt,outlierBounds:null,minStep:null};let Et=Array.from(Dt).sort((Be,Qe)=>Be-Qe);A!=null&&(Et=Et.filter(Be=>Be<=A)),Lt=Et}let wt=null;if(ce){const Dt=[];$e.forEach(Et=>{Et.forEach(Be=>{Dt.push(Be)})}),wt=r8(Dt)}const yt=new Float64Array(Lt),Pt=[{label:We?"Time (s)":"Step"}],zt=[yt];return oe.forEach((Dt,Et)=>{if(Et>=20)return;const Be=$e.get(Et)||new Map;let Qe;if(We){const ct=ft.get(Et),Ut=new Map;ct&&Be.forEach((Gt,sn)=>{const nn=ct.get(sn);nn!==void 0&&Ut.set(nn,Gt)}),Qe=Lt.map(Gt=>Ut.get(Gt)??null)}else Qe=pt.map(ct=>Be.get(ct)??null);const ht=d===Dt.runPath,It=d!==null;let Tt;It&&!ht?Tt=.1:Tt=l?.3:1,zt.push(Qe),Pt.push({label:hx(Dt),stroke:Dt.color,width:1,alpha:Tt,spanGaps:!0,points:{show:!1}})}),l&&oe.forEach((Dt,Et)=>{if(Et>=20)return;const Be=$e.get(Et)||new Map,Qe=2/(c+1);let ht=null,It;if(We){const Gt=ft.get(Et),sn=new Map;pt.forEach(nn=>{const En=Be.get(nn);if(En!==void 0){!(wt&&(En<wt.lower||En>wt.upper))&&!(te&&nn===et)&&(ht=ht===null?En:Qe*En+(1-Qe)*ht);const Br=Gt==null?void 0:Gt.get(nn);Br!==void 0&&ht!==null&&sn.set(Br,ht)}}),It=Lt.map(nn=>sn.get(nn)??null)}else{const Gt=[];pt.forEach(sn=>{const nn=Be.get(sn);nn!==void 0?(!(wt&&(nn<wt.lower||nn>wt.upper))&&!(te&&sn===et)&&(ht===null?ht=nn:ht=Qe*nn+(1-Qe)*ht),Gt.push(ht)):Gt.push(null)}),It=Gt}const Tt=d===Dt.runPath,ct=d!==null;let Ut;ct&&!Tt?Ut=.1:Ut=1,zt.push(It),Pt.push({label:`${hx(Dt)} (EMA)`,stroke:Dt.color,width:1.5,alpha:Ut,spanGaps:!0,points:{show:!1}})}),{uplotData:zt,seriesConfig:Pt,isFetching:Ke||b,isRefetching:je(),hasData:!0,timeToStepByRun:nt,outlierBounds:wt,minStep:et}},[oe,Ue,Oe,ue,l,c,d,p,m,x,b,_,ce,te,C,A]),Ce=o||n.split("_").pop()||"",Ye=p==="time",Ze=n.startsWith("timing_")&&n!=="timing_microbatch_count"&&!n.endsWith("_pct"),it=M.useCallback(Ne=>Ne==null?"N/A":a&&(Ce==="min"||Ce==="max")?Math.round(Ne).toLocaleString():td(Ne),[a,Ce]),ut=M.useCallback(Ne=>Ze?qd(Ne):Math.abs(Ne)>=1e3?`${parseFloat((Ne/1e3).toFixed(1))}k`:a?Ce==="min"||Ce==="max"?Math.round(Ne).toString():String(parseFloat(Ne.toFixed(1))):Number.isInteger(Ne)?Ne.toLocaleString():Math.abs(Ne)<.01&&Ne!==0?Ne.toExponential(1):String(parseFloat(Ne.toFixed(2))),[a,Ze,Ce]),De=M.useCallback(Ne=>Ye?qd(Ne):Ne>=1e3?`${(Ne/1e3).toFixed(0)}k`:Ne.toString(),[Ye]);M.useEffect(()=>{if(!V.current||!Q||!ve)return;const Ne=V.current,$e=Ne.clientWidth,ft=Ne.clientHeight||192;let nt=1/0,We=-1/0;for(let Qe=1;Qe<Q.length;Qe++){const ht=Q[Qe];for(let It=0;It<ht.length;It++){if(te&&It===0)continue;const Tt=ht[It];Tt!=null&&(ce&&Ee?Tt>=Ee.lower&&Tt<=Ee.upper&&(Tt<nt&&(nt=Tt),Tt>We&&(We=Tt)):(Tt<nt&&(nt=Tt),Tt>We&&(We=Tt)))}}nt===1/0&&Ee&&(nt=Ee.lower,We=Ee.upper);const Ke=We-nt,je=Math.max(Math.abs(We),Math.abs(nt)),et=Math.max(je*.05,1e-10),pt=Math.max(Ke*.1,et);let Lt,wt;s?(Lt=Math.min(nt-pt,0),wt=Math.max(We+pt,0)):(Lt=nt-pt,wt=We+pt),se!==null&&(Lt=se),le!==null&&(wt=le);const yt=R?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Pt=R?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Dt={width:$e,height:ft,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Lt,wt]}},axes:[{stroke:Pt,grid:{stroke:yt,width:1},ticks:{stroke:yt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Qe,ht)=>ht.map(De)},{stroke:Pt,grid:{stroke:yt,width:1},ticks:{stroke:yt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Qe,ht)=>{if(!ht||ht.length===0)return 40;const It=Math.max(...ht.map(Tt=>Tt.length));return Math.max(40,It*7+14)},values:(Qe,ht)=>ht.map(ut)}],series:fe,hooks:{draw:[Qe=>{var Ut,Gt;if(!Q)return;const ht=Q[0],It=Math.min(oe.length,20),Tt=Qe.series.length,ct=Qe.ctx;ct.save();for(let sn=1;sn<Tt;sn++){const nn=Q[sn];if(!nn)continue;let En=-1;for(let vt=nn.length-1;vt>=0;vt--){const gt=nn[vt];if(gt!=null){En=vt;break}}if(En===-1)continue;const Hn=ht[En],Nn=nn[En];if(Hn===void 0||Nn===void 0||Nn===null)continue;const Br=Qe.valToPos(Number(Hn),"x",!0),er=Qe.valToPos(Number(Nn),"y",!0);if(!Number.isFinite(Br)||!Number.isFinite(er))continue;const ge=Qe.series[sn],rt=typeof(ge==null?void 0:ge.alpha)=="number"?ge.alpha:1;let bt=typeof(ge==null?void 0:ge.stroke)=="string"?ge.stroke:void 0;if(!bt){const vt=sn-1;if(vt<It)bt=(Ut=oe[vt])==null?void 0:Ut.color;else if(l){const gt=vt-It;gt>=0&&gt<It&&(bt=(Gt=oe[gt])==null?void 0:Gt.color)}}bt&&(ct.globalAlpha=rt,ct.fillStyle=bt,ct.beginPath(),ct.arc(Br,er,4,0,Math.PI*2),ct.fill())}ct.restore()}],setCursor:[Qe=>{if(!U.current)return;const{left:ht,top:It,idx:Tt}=Qe.cursor;if(Tt==null||ht===void 0||It===void 0||ht<0){U.current.style.display="none";return}const ct=Q[0][Tt];if(ct===void 0){U.current.style.display="none";return}ne.current&&!K.current&&Y({xValue:Number(ct),sourceChartId:Z});const Ut=(()=>{var Xt,Jt;if(!Ye||!qe)return null;const rt=Number(ct);if(d){const Kt=oe.findIndex(Zt=>Zt.runPath===d);if(Kt>=0){const Zt=(Xt=qe.get(Kt))==null?void 0:Xt.get(rt);if(Zt!==void 0)return Zt}}const bt=oe.findIndex(Kt=>Kt.isSelected);if(bt>=0){const Kt=(Jt=qe.get(bt))==null?void 0:Jt.get(rt);if(Kt!==void 0)return Kt}let vt=null;const gt=new Set;return oe.forEach((Kt,Zt)=>{var On;const xn=(On=qe.get(Zt))==null?void 0:On.get(rt);xn!==void 0&&(gt.add(xn),vt===null&&(vt=xn))}),gt.size===1,vt})();let sn=`<div class="font-medium mb-1">${Ye?`Time ${b$(Number(ct))}${Ut!==null?` <span class="text-muted-foreground">(Step ${Number(Ut).toLocaleString()})</span>`:""}`:`Step ${Number(ct).toLocaleString()}`}</div>`;const nn=_e.length,En=Q[0],Hn=(()=>{if(!Ye)return null;const rt=Qe.scales.x,bt=Number(rt.min),vt=Number(rt.max);if(!Number.isFinite(bt)||!Number.isFinite(vt))return null;const gt=Math.abs(vt-bt);if(gt<=0)return null;const Xt=Math.max(1,Qe.bbox.width);return gt*C0e/Xt})();t.forEach(rt=>{const bt=Fe.get(rt.runPath);if(bt===void 0)return;const vt=bt+1,gt=Q[vt];if(!gt)return;const Xt=Ye?E0e(gt,En,Tt,Hn):Tt;if(Xt===null)return;const Jt=gt[Xt];let Kt;if(l){const Zt=nn+bt+1,xn=Q[Zt];Kt=xn==null?void 0:xn[Xt]}Jt!=null&&(sn+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${rt.color}"></div>
                    <span>${i8(rt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${Ze?fI(Jt):`${it(Jt)}${i?` ${i}`:""}`}</span>
                    ${l&&Kt!==void 0&&Kt!==null?`<span class="text-muted-foreground">(EMA: ${Ze?fI(Kt):it(Kt)})</span>`:""}
                  </div>
                </div>
              `)}),U.current.innerHTML=sn,U.current.style.display="block";const Nn=V.current.getBoundingClientRect(),Br=U.current.getBoundingClientRect();let er=Nn.left+ht+15;er+Br.width+20>window.innerWidth&&(er=Nn.left+ht-Br.width-15+Qe.bbox.left),er=Math.max(4,er);let ge=Nn.top-Br.height+20;ge<4&&(ge=Nn.bottom-20),U.current.style.left=`${er}px`,U.current.style.top=`${ge}px`}]}};F.current&&F.current.destroy();const Et=new no(Dt,Q,Ne);F.current=Et;const Be=new ResizeObserver(Qe=>{for(const ht of Qe){const{width:It,height:Tt}=ht.contentRect;Et&&It>0&&Tt>0&&Et.setSize({width:It,height:Tt})}});return Be.observe(Ne),()=>{Be.disconnect(),Et.destroy(),F.current=null}},[Q,fe,ve,De,ut,it,Ye,qe,oe,d,l,s,i,ce,Ee,te,se,le,t,_e,Fe,Z,Ze,Y,R]),M.useEffect(()=>{if(!W){U.current&&(U.current.style.display="none");return}if(W.sourceChartId===Z||!F.current||!Q)return;const Ne=F.current,$e=Q[0];if(!$e||$e.length===0)return;const ft=W.xValue;let nt=0,We=1/0;for(let je=0;je<$e.length;je++){const et=Math.abs(Number($e[je])-ft);et<We&&(We=et,nt=je)}const Ke=Ne.valToPos(Number($e[nt]),"x");Ke>=0&&Ke<=Ne.width&&(K.current=!0,Ne.setCursor({left:Ke,top:0}),K.current=!1)},[W,Z,Q]);const Ve=M.useCallback(()=>{U.current&&(U.current.style.display="none"),(W==null?void 0:W.sourceChartId)===Z&&Y(null)},[W,Z,Y]),lt=Se&&!Ae,Le=r||(Ce?`${Ce.charAt(0).toUpperCase()}${Ce.slice(1)}`:n);return f.jsxs("div",{ref:L,className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background h-[246px] flex flex-col",lt&&"opacity-50"),children:[f.jsxs("div",{className:"shrink-0 mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:Le})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:ce,onCheckedChange:be,children:"Ignore Outliers"}),f.jsx(ti,{checked:te,onCheckedChange:xe,children:"Ignore First Step"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:se??"",onChange:Ne=>{const $e=Ne.target.value;Pe($e===""?null:Number($e))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:le??"",onChange:Ne=>{const $e=Ne.target.value;me($e===""?null:Number($e))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]}),P&&Object.keys(P).length>0&&f.jsxs(f.Fragment,{children:[f.jsx(aa,{}),f.jsx(K1,{className:"text-[10px] text-muted-foreground",children:"Filter by Tag"}),Object.entries(P).map(([Ne,$e])=>{var ft;return f.jsxs(Rue,{children:[f.jsxs(kue,{className:"text-xs",children:[Ne,(ft=re[Ne])!=null&&ft.length?f.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",re[Ne].length,")"]}):null]}),f.jsx(Due,{className:"max-h-[300px] overflow-y-auto",children:$e.map(nt=>f.jsx(ti,{checked:(re[Ne]??[]).includes(nt),onCheckedChange:()=>ke(Ne,nt),children:nt},nt))})]},Ne)})]})]})]}),D]})]}),(ce||te||se!==null||le!==null||we)&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[ce&&f.jsx(Ul,{label:"Ignore Outliers",onRemove:()=>be(!1)}),te&&f.jsx(Ul,{label:"Ignore First Step",onRemove:()=>xe(!1)}),se!==null&&f.jsx(Ul,{label:`Min Y: ${se}`,onRemove:()=>Pe(null)}),le!==null&&f.jsx(Ul,{label:`Max Y: ${le}`,onRemove:()=>me(null)}),Object.entries(re).map(([Ne,$e])=>$e.map(ft=>f.jsx(Ul,{label:`${Ne}: ${ft}`,onRemove:()=>ke(Ne,ft)},`${Ne}:${ft}`)))]})]}),ve?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:V,onMouseLeave:Ve,children:[f.jsx("div",{ref:U,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),Ae&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Se?"Loading...":"No data"})]})}function T$(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function Rg({data:t,stepTimes:e,firstTime:n,bucketSeconds:r,label:i,color:s,showSteps:o,scrollRoot:a=null,isFetching:l,isRefetching:c,onShowStepsChange:d,intervalInput:p,onIntervalInputChange:m,onIntervalCommit:x,headerPrefix:b,headerSuffix:_,onRemove:S}){const w=Jn(No),C=M.useRef(null),A=M.useRef(null),N=M.useRef(null),D=M.useRef(null),P=Dy(C,{root:a,threshold:0}),O=t.length>0&&n!==null,{uplotData:R,relativeStepTimes:L}=M.useMemo(()=>{if(!O||n===null)return{uplotData:null,relativeStepTimes:[]};const U=new Map;let W=0;for(let K=0;K<t.length;K++){const ne=t[K].time-n;U.set(ne,t[K].count),ne>W&&(W=ne)}const Y=Math.floor(W/r)+1,$=new Float64Array(Y),X=new Float64Array(Y);for(let K=0;K<Y;K++){const ne=K*r;$[K]=ne,X[K]=U.get(ne)??0}const Z=e.filter(K=>K.time!==null).map(K=>({step:K.step,relativeTime:K.time-n}));return{uplotData:[$,X],relativeStepTimes:Z}},[t,e,n,O,r]);M.useEffect(()=>{if(!A.current||!R||!O||!P)return;const U=A.current,W=U.clientWidth,Y=U.clientHeight||192;let $=0;const X=R[1];for(let le=0;le<X.length;le++){const re=X[le];re!=null&&re>$&&($=re)}const Z=Math.max($*.1,1),K=0,ne=$+Z,H=w?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",B=w?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",G=w?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.2)",j=(le,re)=>{if(!re||re.length===0)return 40;const pe=Math.max(...re.map(be=>be.length));return Math.max(40,pe*7+14)},ie=o,ce={width:W,height:Y,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1,range:(le,re,pe)=>[re,pe+r]},y:{range:[K,ne]}},axes:[{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(le,re)=>re.map(pe=>qd(pe))},{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:j,values:(le,re)=>re.map(pe=>Math.abs(pe)>=1e3?`${parseFloat((pe/1e3).toFixed(1))}k`:Number.isInteger(pe)?pe.toLocaleString():String(parseFloat(pe.toFixed(1))))}],series:[{label:"Time"},{label:i,stroke:w?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.2)",fill:s,width:1,points:{show:!1},paths:(le,re,pe,be)=>{const xe=le.data[0],Pe=le.data[re],me=le.scales.y,ke=new Path2D,we=new Path2D;for(let Te=pe;Te<=be;Te++){const oe=Number(xe[Te]),_e=Number(Pe[Te]);if(_e==null||!Number.isFinite(_e))continue;const Fe=le.valToPos(oe,"x",!0),Ue=le.valToPos(oe+r,"x",!0),Oe=le.valToPos(_e,"y",!0),Q=le.valToPos(Math.max(0,me.min),"y",!0)-Oe,fe=Ue-Fe;we.rect(Fe,Oe,fe,Q),ke.rect(Fe,Oe,fe,Q)}return{stroke:ke,fill:we}}}],hooks:{drawAxes:[le=>{if(!ie)return;const re=le.ctx;re.save(),re.strokeStyle=G,re.lineWidth=1*devicePixelRatio;const pe=le.scales.x,be=le.bbox.top,xe=le.bbox.top+le.bbox.height;for(const Pe of L){if(Pe.relativeTime<pe.min||Pe.relativeTime>pe.max)continue;const me=le.valToPos(Pe.relativeTime,"x",!0);re.beginPath(),re.moveTo(me,be),re.lineTo(me,xe),re.stroke()}re.restore()}],setCursor:[le=>{if(!D.current||!R)return;const{left:re,top:pe}=le.cursor;if(re===void 0||pe===void 0||re<0){D.current.style.display="none";return}const be=le.posToVal(re,"x");let xe=null;for(let _e=0;_e<R[0].length;_e++){const Fe=Number(R[0][_e]);if(be>=Fe&&be<Fe+r){xe=_e;break}}let Pe=!1;if(xe!==null){const _e=Number(R[1][xe]);if(Number.isFinite(_e)&&_e>0){const Fe=le.valToPos(_e,"y",!0),Ue=le.valToPos(0,"y",!0),Oe=le.bbox.top+pe*devicePixelRatio;Oe>=Fe&&Oe<=Ue&&(Pe=!0)}}let me=null;if(ie&&!Pe)for(const Fe of L){const Ue=le.scales.x;if(Fe.relativeTime<Ue.min||Fe.relativeTime>Ue.max)continue;const Oe=le.valToPos(Fe.relativeTime,"x");if(Math.abs(Oe-re)<=6){me=Fe;break}}if(me){const _e=qd(me.relativeTime);D.current.innerHTML=`
                <div class="font-medium">Step ${me.step.toLocaleString()}</div>
                <div class="text-muted-foreground">${_e}</div>
              `,D.current.style.display="block"}else if(xe!==null){const _e=R[0][xe],Fe=R[1][xe],Ue=Number(_e),Oe=Ue+r,ue=`${qd(Ue)} — ${qd(Oe)}`,Q=Fe!=null?Math.round(Number(Fe)).toLocaleString():"N/A";D.current.innerHTML=`
                <div class="font-medium mb-1">${ue}</div>
                <div class="flex items-center gap-2">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${s}"></div>
                  <span>${u1(i)}: <span class="font-medium">${Q}</span></span>
                </div>
              `,D.current.style.display="block"}else{D.current.style.display="none";return}D.current.style.left="0px",D.current.style.top="0px";const ke=D.current.getBoundingClientRect(),we=A.current.getBoundingClientRect();let Te=we.left+re+15;Te+ke.width+20>window.innerWidth&&(Te=we.left+re-ke.width-15+le.bbox.left),Te=Math.max(4,Te);let oe=we.top-ke.height+20;oe<4&&(oe=we.bottom-20),D.current.style.left=`${Te-ke.left}px`,D.current.style.top=`${oe-ke.top}px`}]}};N.current&&N.current.destroy();const te=new no(ce,R,U);N.current=te;const se=new ResizeObserver(le=>{for(const re of le){const{width:pe,height:be}=re.contentRect;te&&pe>0&&be>0&&te.setSize({width:pe,height:be})}});return se.observe(U),()=>{se.disconnect(),te.destroy(),N.current=null}},[R,O,P,L,o,r,i,s,w]);const V=M.useCallback(()=>{D.current&&(D.current.style.display="none")},[]),F=l&&!c;return f.jsxs("div",{ref:C,className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background h-[246px] flex flex-col",F&&"opacity-50"),children:[f.jsxs("div",{className:"shrink-0 mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[b,f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words min-w-0",title:i,children:i})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:o,onCheckedChange:d,children:"Show Steps"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),f.jsx("input",{type:"text",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"1m",value:p,onChange:U=>m(U.target.value),onBlur:U=>x(U.target.value),onKeyDown:U=>{U.stopPropagation(),U.key==="Enter"&&x(U.currentTarget.value)},onClick:U=>U.stopPropagation()})]})]})]}),_,S&&f.jsx("button",{onClick:S,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/chart:opacity-100 transition-opacity",children:f.jsx(fu,{className:"h-3.5 w-3.5"})})]})]}),!o&&f.jsx("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:!o&&f.jsx(Ul,{label:"Steps Hidden",onRemove:()=>d(!0)})})]}),O?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:A,onMouseLeave:V,children:[f.jsx("div",{ref:D,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),c&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:l?"Loading...":"No data"})]})}function O0e({runPath:t,shouldPoll:e,scrollRoot:n=null}){const r=M.useRef(null),i=Dy(r,{root:n,threshold:0}),[s,o]=M.useState(!0),[a,l]=M.useState(60),[c,d]=M.useState(rh(60)),p=M.useCallback(R=>{const L=T$(R);L!==null&&L>=1?(l(L),d(rh(L))):d(rh(a))},[a]),{data:m,isFetching:x}=WG(t,i&&!!t,e,a),b=(m==null?void 0:m.inference_calls)??[],_=(m==null?void 0:m.requests_done)??[],S=(m==null?void 0:m.rollouts_group_done)??[],w=(m==null?void 0:m.rollouts_group_done_kept)??[],C=(m==null?void 0:m.rollouts_group_done_discarded)??[],A=(m==null?void 0:m.rollouts_group_done_canceled)??[],N=(m==null?void 0:m.step_times)??[],D=(m==null?void 0:m.first_time)??null,O={stepTimes:N,firstTime:D,bucketSeconds:a,showSteps:s,scrollRoot:n,shouldPoll:e,isFetching:x||!m,isRefetching:x&&!!m,onShowStepsChange:o,intervalInput:c,onIntervalInputChange:d,onIntervalCommit:p};return f.jsx("div",{ref:r,children:f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(Rg,{data:b,label:"Inference Calls",color:"#0284c7",...O}),f.jsx(Rg,{data:_,label:"Requests Done",color:"#22c55e",...O}),f.jsx(Rg,{data:S,label:"Rollouts Group Done",color:"#f59e0b",...O}),f.jsx(Rg,{data:w,label:"Rollouts Group Done Kept",color:"#10b981",...O}),f.jsx(Rg,{data:C,label:"Rollouts Group Done Discarded",color:"#ef4444",...O}),f.jsx(Rg,{data:A,label:"Rollouts Group Done Canceled",color:"#8b5cf6",...O})]})})}const L0e={inference_calls:"#0284c7",requests_done:"#22c55e",rollouts_group_done:"#f59e0b",rollouts_group_done_kept:"#10b981",rollouts_group_done_discarded:"#ef4444",rollouts_group_done_canceled:"#8b5cf6"};function C$({runPath:t,shouldPoll:e,scrollRoot:n=null,inferenceMetricType:r,label:i,headerPrefix:s,headerSuffix:o,onRemove:a}){const l=M.useRef(null),c=Dy(l,{root:n,threshold:0}),[d,p]=M.useState(!0),[m,x]=M.useState(60),[b,_]=M.useState(rh(60)),S=M.useCallback(R=>{const L=T$(R);L!==null&&L>=1?(x(L),_(rh(L))):_(rh(m))},[m]),{data:w,isFetching:C}=WG(t,c&&!!t,e,m),A=w?w[r]??[]:[],N=(w==null?void 0:w.step_times)??[],D=(w==null?void 0:w.first_time)??null,P=C||!w,O=L0e[r]??"#0284c7";return f.jsx("div",{ref:l,children:f.jsx(Rg,{data:A,stepTimes:N,firstTime:D,bucketSeconds:m,label:i,color:O,showSteps:d,scrollRoot:n,shouldPoll:e,isFetching:P,isRefetching:C&&!!w,onShowStepsChange:p,intervalInput:b,onIntervalInputChange:_,onIntervalCommit:S,headerPrefix:s,headerSuffix:o,onRemove:a})})}const cg=["mean","std","min","max"],ug={mean:"Mean",std:"Std",min:"Min",max:"Max"};function j2(){return Math.random().toString(36).slice(2,10)}function a1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function E$(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const o=a1(i);for(const[a,l]of Object.entries(s)){const c=a?a1(a):void 0;for(const d of l)r.push({section:o,group:c,metricKey:d,label:a1(d),plotType:"step_metric",simple:!0})}}for(const i of cg)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${ug[i]}`,plotType:"step_metric"});r.push({section:"Reward",metricKey:"reward_gini_mean",label:"Reward Sparsity (Gini)",plotType:"step_metric",simple:!0}),r.push({section:"Reward",metricKey:"reward_sum_distribution_over_time",label:"Reward Dist. Over Time",plotType:"distribution_over_time",distMetricType:"reward_sum"});for(const i of e){const s=a1(i);for(const o of cg)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${o}`,label:`${s} ${ug[o]}`,plotType:"step_metric"});r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_gini_mean`,label:`${s} Sparsity (Gini)`,plotType:"step_metric",simple:!0}),r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:`reward_${i}`})}for(const i of cg)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${ug[i]}`,plotType:"step_metric"});r.push({section:"Advantage",metricKey:"advantage_distribution_over_time",label:"Advantage Dist. Over Time",plotType:"distribution_over_time",distMetricType:"advantage"});for(const i of n){const s=i.eval_name;for(const o of i.available_rollout_metric_names){const a=a1(o);for(const l of cg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`reward_${o}_${l}`,label:`${s} ${a} ${ug[l]}`,plotType:"eval_metric",evalName:s})}for(const o of["length_completion","length_prompt","length_sum"]){const a=o==="length_completion"?"Tokens Completion":o==="length_prompt"?"Tokens Prompt":"Tokens Total";for(const l of cg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`${o}_${l}`,label:`${s} ${a} ${ug[l]}`,plotType:"eval_metric",evalName:s})}}for(const i of["length_prompt","length_completion","length_sum"]){const s=i==="length_prompt"?"Tokens Prompt":i==="length_completion"?"Tokens Completion":"Tokens Total";for(const o of cg)r.push({section:"Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${ug[o]}`,plotType:"step_metric"});r.push({section:"Rollouts",group:s,metricKey:`${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:i})}for(const i of[{key:"stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"group_length_gini_mean",label:"Group Completion Length Gini"},{key:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"}])r.push({section:"Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"discarded_count",label:"Discarded Count"},{key:"discarded_zero_advantage_pct",label:"Zero Advantage %"},{key:"discarded_max_async_pct",label:"Max Async %"},{key:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"discarded_group_length_gini_mean",label:"Group Completion Length Gini"},{key:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"},{key:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %"},{key:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %"},{key:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward"}])r.push({section:"Discarded Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});r.push({section:"Discarded Rollouts",group:"Canceled",metricKey:"canceled_count",label:"Canceled Count",plotType:"step_metric",simple:!0});for(const i of["discarded_length_prompt","discarded_length_completion","discarded_length_sum"]){const s=i.includes("prompt")?"Discarded Tokens Prompt":i.includes("completion")?"Discarded Tokens Completion":"Discarded Tokens Total";for(const o of cg)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${ug[o]}`,plotType:"step_metric"});r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:i})}for(const i of[{key:"timing_step_total",label:"Time per Step"},{key:"timing_step_active",label:"Time per Step Active"},{key:"timing_microbatch_count",label:"Microbatches per Step"},{key:"timing_forward_total",label:"Timing Forward"},{key:"timing_backward_total",label:"Timing Backward"},{key:"timing_loss_computation_total",label:"Timing Loss Computation"},{key:"timing_compute_kl_total",label:"Timing Compute KL"},{key:"timing_compute_entropy_total",label:"Timing Compute Entropy"},{key:"timing_data_to_device_total",label:"Timing Data to Device"},{key:"timing_prepare_tensors_total",label:"Timing Prepare Tensors"},{key:"timing_waiting_for_data",label:"Timing Waiting for Data"},{key:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)"},{key:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)"}])r.push({section:"Timeline Trainer",group:"Full Step (Total Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward"},{key:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward"},{key:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation"},{key:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL"},{key:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy"},{key:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device"},{key:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors"}])r.push({section:"Timeline Trainer",group:"Microbatch (Mean Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_save_batch_total",label:"Batch Completion (Save Batch)"},{key:"timing_avg_inference_time",label:"Avg Generation Time"},{key:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time"}])r.push({section:"Timeline Inference",group:"Batch & Averages",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_generation_normal_pct",label:"Generation Normal"},{key:"timing_generation_discarded_pct",label:"Generation Discarded"},{key:"timing_generation_canceled_pct",label:"Generation Canceled"},{key:"timing_generation_all_pct",label:"Generation All"},{key:"timing_compute_reward_normal_pct",label:"Compute Reward Normal"},{key:"timing_compute_reward_discarded_pct",label:"Compute Reward Discarded"},{key:"timing_compute_reward_canceled_pct",label:"Compute Reward Canceled"},{key:"timing_compute_reward_all_pct",label:"Compute Reward All"},{key:"timing_idle_pct",label:"Idle Time"}])r.push({section:"Timeline Inference",group:"Time Breakdown (% of Step Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"inference_calls",label:"Inference Calls",inferenceMetricType:"inference_calls"},{key:"requests_done",label:"Requests Done",inferenceMetricType:"requests_done"},{key:"rollouts_group_done",label:"Rollouts Group Done",inferenceMetricType:"rollouts_group_done"},{key:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",inferenceMetricType:"rollouts_group_done_kept"},{key:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",inferenceMetricType:"rollouts_group_done_discarded"},{key:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",inferenceMetricType:"rollouts_group_done_canceled"}])r.push({section:"Inference Performance",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});return r}async function wO(t){await fetch(`${ar}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}async function MO(t,e){await fetch(`${ar}/custom-metrics-templates/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}function z2({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[o,a]=M.useState(i),[l,c]=M.useState(""),d=M.useRef(null),p=x=>{x&&(a(i),c(""),setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50)),e(x)},m=()=>{const x=o.trim();if(!x){c("Name cannot be empty");return}if(r.some(b=>b.toLowerCase()===x.toLowerCase())&&x.toLowerCase()!==i.toLowerCase()){c("Name already exists");return}s(x),e(!1)};return f.jsx(qu,{open:t,onOpenChange:p,children:f.jsxs(Xu,{className:"sm:max-w-[340px]",children:[f.jsx(Zc,{children:f.jsx(Qc,{children:n})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(cp,{ref:d,value:o,onChange:x=>{a(x.target.value),c("")},onKeyDown:x=>{x.key==="Enter"&&m()},placeholder:"Name..."}),l&&f.jsx("p",{className:"text-xs text-destructive",children:l})]}),f.jsx(ET,{children:f.jsx(Mn,{size:"sm",onClick:m,children:i?"Rename":"Create"})})]})})}function TO(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function iy({catalog:t,onSelect:e,onDeselect:n,existingPlots:r,children:i,allowDuplicates:s=!1}){const o=M.useMemo(()=>{const m=new Map;for(const x of r??[]){const b=TO(x);m.set(b,(m.get(b)??0)+1)}return m},[r]),[a,l]=M.useState(!1),[c,d]=M.useState(""),p=M.useMemo(()=>{const m=c.toLowerCase(),x=m?t.filter(_=>{var S;return _.label.toLowerCase().includes(m)||_.metricKey.toLowerCase().includes(m)||_.section.toLowerCase().includes(m)||(((S=_.group)==null?void 0:S.toLowerCase().includes(m))??!1)}):t,b=[];for(const _ of x){let S=b.find(A=>A.section===_.section);S||(S={section:_.section,groups:[]},b.push(S));const w=_.group||"";let C=S.groups.find(A=>A.group===w);C||(C={group:w,items:[]},S.groups.push(C)),C.items.push(_)}return b},[t,c]);return f.jsxs(AT,{open:a,onOpenChange:l,children:[f.jsx(NT,{asChild:!0,children:i}),f.jsxs(RT,{align:"start",className:"w-[320px] p-0",onClick:m=>m.stopPropagation(),children:[f.jsx("div",{className:"p-2 border-b",children:f.jsx(cp,{value:c,onChange:m=>d(m.target.value),placeholder:"Search metrics...",className:"h-7 text-xs"})}),f.jsxs("div",{className:"max-h-[50vh] overflow-y-auto p-1.5",children:[p.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No metrics found"}),p.map(m=>f.jsxs("div",{className:"mb-2",children:[f.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider px-1.5 py-1",children:m.section}),m.groups.map(x=>f.jsxs("div",{children:[x.group&&f.jsx("div",{className:"text-[10px] font-medium text-muted-foreground/70 px-3 py-0.5",children:x.group}),x.items.map(b=>{const _=o.get(TO(b))??0,S=_>0;return f.jsxs("button",{type:"button",className:Rt("flex w-full items-center gap-1.5 rounded px-3 py-0.5 text-xs text-left transition-colors hover:bg-accent hover:text-accent-foreground",!s&&S&&"text-accent-foreground"),onClick:()=>{!s&&S&&n?n(b):e(b),s&&(l(!1),d(""))},children:[f.jsx("span",{className:"flex-1",children:b.label}),s?_>0&&f.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:_}):S&&f.jsx(vm,{className:"h-3 w-3 text-muted-foreground shrink-0"})]},`${b.plotType}-${b.evalName||""}-${b.metricKey}`)})]},`${m.section}-${x.group}`))]},m.section))]})]})]})}function A$({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return f.jsx(m2,{open:t,onOpenChange:e,children:f.jsxs(g2,{children:[f.jsxs(x2,{children:[f.jsx(y2,{children:n}),f.jsx(b2,{children:r})]}),f.jsxs(v2,{children:[f.jsx(S2,{children:"Cancel"}),f.jsx(_2,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function s8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:o,transition:a,isDragging:l}=F7({id:t.id}),c={transform:o?`translate3d(${Math.round(o.x)}px, ${Math.round(o.y)}px, 0)`:void 0,transition:a,opacity:l?.4:1,position:"relative",zIndex:l?50:void 0},d=t.label||a1(t.metricKey),p=f.jsx("button",{...r,...i,className:"-ml-1.5 cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0 opacity-0 group-hover/chart:opacity-100",children:f.jsx(T7,{className:"h-3 w-3 text-muted-foreground"})}),m=f.jsx("button",{onClick:e,className:"-mr-1 h-5 px-1.5 rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(fu,{className:"h-3 w-3"})});return f.jsx("div",{ref:s,style:c,children:t.plotType==="distribution_over_time"&&t.distMetricType?(()=>{const x=n.runs.find(b=>b.isSelected)??n.runs[0];return x?f.jsx(w$,{runPath:x.runPath,metricType:t.distMetricType,label:d,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,headerPrefix:p,headerSuffix:m}):null})():t.plotType==="inference_performance"&&t.inferenceMetricType?(()=>{const x=n.runs.find(b=>b.isSelected)??n.runs[0];return x?f.jsx(C$,{runPath:x.runPath,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,inferenceMetricType:t.inferenceMetricType,label:d,headerPrefix:p,headerSuffix:m}):null})():t.plotType==="eval_metric"&&t.evalName?f.jsx(M$,{runs:n.runs,shouldPoll:n.shouldPoll,evalName:t.evalName,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,headerPrefix:p,headerSuffix:m,filterKey:t.id}):f.jsx(ir,{runs:n.runs,shouldPoll:n.shouldPoll,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,availableSampleTags:n.availableSampleTags,headerPrefix:p,headerSuffix:m,filterKey:t.id})})}function j0e({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=M.useState(!0),[l,c]=M.useState(!1),[d,p]=M.useState(!1),[m,x]=M.useState(!1),{attributes:b,listeners:_,setNodeRef:S,transform:w,transition:C,isDragging:A}=F7({id:t.id}),N={transform:Q1.Transform.toString(w),transition:C,opacity:A?.4:1},D=V=>{const F={id:j2(),metricKey:V.metricKey,label:V.label,plotType:V.plotType,evalName:V.evalName,distMetricType:V.distMetricType,inferenceMetricType:V.inferenceMetricType};r({...t,plots:[...t.plots,F]})},P=V=>{r({...t,plots:t.plots.filter(F=>F.id!==V)})},O=V=>{r({...t,name:V})},R=cS(Zf(ux,{activationConstraint:{distance:5}}),Zf(cx,{coordinateGetter:pS})),L=V=>{const{active:F,over:U}=V;if(!U||F.id===U.id)return;const W=t.plots.findIndex($=>$.id===F.id),Y=t.plots.findIndex($=>$.id===U.id);W===-1||Y===-1||r({...t,plots:dx(t.plots,W,Y)})};return f.jsxs("div",{ref:S,style:N,children:[f.jsxs(Fi,{open:o,onOpenChange:a,children:[f.jsxs("div",{className:"flex items-center gap-1 h-8",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-1.5 py-1 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors shrink-0",children:[f.jsx(Ir,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),f.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),f.jsx("button",{...b,..._,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:f.jsx(T7,{className:"h-3.5 w-3.5 text-muted-foreground"})}),f.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[f.jsx(iy,{catalog:e,onSelect:D,existingPlots:t.plots,allowDuplicates:!0,children:f.jsxs("button",{className:"flex items-center gap-0.5 h-6 px-2 text-[10px] rounded-md border border-input hover:bg-accent transition-colors",children:[f.jsx(lp,{className:"h-3 w-3"}),"New Plot"]})}),f.jsx("button",{onClick:()=>p(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename group",children:f.jsx(FG,{className:"h-3 w-3 text-muted-foreground"})}),f.jsx("button",{onClick:()=>x(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:f.jsx(fu,{className:"h-3 w-3 text-muted-foreground"})})]})]}),f.jsx(Bi,{children:f.jsx(fS,{sensors:R,collisionDetection:uS,onDragEnd:L,children:f.jsx(hS,{items:t.plots.map(V=>V.id),strategy:mw,children:f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-3 mb-4",children:[t.plots.map(V=>f.jsx(s8,{plot:V,onRemove:()=>P(V.id),chartProps:s},V.id)),t.plots.length===0&&f.jsx(iy,{catalog:e,onSelect:D,existingPlots:t.plots,allowDuplicates:!0,children:f.jsxs("button",{className:"h-32 rounded-lg border-2 border-dashed border-gray-200 hover:border-gray-300 hover:bg-muted/50 transition-colors flex items-center justify-center text-xs text-muted-foreground gap-1",children:[f.jsx(lp,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),f.jsx(z2,{open:d,onOpenChange:p,title:"Rename Group",existingNames:n.filter(V=>V!==t.name),onSubmit:O,initialValue:t.name}),f.jsx(A$,{open:m,onOpenChange:x,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function z0e({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=M.useState(!0),[l,c]=M.useState(!1),[d,p]=M.useState(!1),[m,x]=M.useState(!1),[b,_]=M.useState(!1),{attributes:S,listeners:w,setNodeRef:C,transform:A,transition:N,isDragging:D}=F7({id:t.id}),P={transform:Q1.Transform.toString(A),transition:N,opacity:D?.4:1},O=t.groups.map(K=>K.name),R=K=>{const ne={id:j2(),name:K,plots:[]};r({...t,groups:[...t.groups,ne]})},L=(K,ne)=>{r({...t,groups:t.groups.map(H=>H.id===K?ne:H)})},V=K=>{r({...t,groups:t.groups.filter(ne=>ne.id!==K)})},F=K=>{const ne={id:j2(),metricKey:K.metricKey,label:K.label,plotType:K.plotType,evalName:K.evalName,distMetricType:K.distMetricType,inferenceMetricType:K.inferenceMetricType};r({...t,plots:[...t.plots,ne]})},U=K=>{r({...t,plots:t.plots.filter(ne=>ne.id!==K)})},W=K=>{r({...t,name:K})},Y=cS(Zf(ux,{activationConstraint:{distance:5}}),Zf(cx,{coordinateGetter:pS})),$=K=>{const{active:ne,over:H}=K;if(!H||ne.id===H.id)return;const B=t.groups.findIndex(j=>j.id===ne.id),G=t.groups.findIndex(j=>j.id===H.id);B===-1||G===-1||r({...t,groups:dx(t.groups,B,G)})},X=cS(Zf(ux,{activationConstraint:{distance:5}}),Zf(cx,{coordinateGetter:pS})),Z=K=>{const{active:ne,over:H}=K;if(!H||ne.id===H.id)return;const B=t.plots.findIndex(j=>j.id===ne.id),G=t.plots.findIndex(j=>j.id===H.id);B===-1||G===-1||r({...t,plots:dx(t.plots,B,G)})};return f.jsxs("div",{ref:C,style:P,children:[f.jsxs(Fi,{open:o,onOpenChange:a,children:[f.jsxs("div",{className:"flex items-center gap-1.5 h-9",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),f.jsx("button",{...S,...w,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:f.jsx(T7,{className:"h-4 w-4 text-muted-foreground"})}),f.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[f.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-0.5 h-7 px-2 text-xs rounded-md border border-input hover:bg-accent transition-colors",children:[f.jsx(lp,{className:"h-3 w-3"}),"New Group"]}),f.jsx(iy,{catalog:e,onSelect:F,existingPlots:t.plots,allowDuplicates:!0,children:f.jsxs("button",{className:"flex items-center gap-0.5 h-7 px-2 text-xs rounded-md border border-input hover:bg-accent transition-colors",children:[f.jsx(lp,{className:"h-3 w-3"}),"New Plot"]})}),f.jsx("button",{onClick:()=>x(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename section",children:f.jsx(FG,{className:"h-3.5 w-3.5 text-muted-foreground"})}),f.jsx("button",{onClick:()=>_(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:f.jsx(fu,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),f.jsxs(Bi,{children:[t.plots.length>0&&f.jsx(fS,{sensors:X,collisionDetection:uS,onDragEnd:Z,children:f.jsx(hS,{items:t.plots.map(K=>K.id),strategy:mw,children:f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-3 mb-4",children:t.plots.map(K=>f.jsx(s8,{plot:K,onRemove:()=>U(K.id),chartProps:s},K.id))})})}),f.jsx(fS,{sensors:Y,collisionDetection:uS,onDragEnd:$,children:f.jsx(hS,{items:t.groups.map(K=>K.id),strategy:yW,children:f.jsx("div",{className:"space-y-2",children:t.groups.map(K=>f.jsx(j0e,{group:K,catalog:e,groupNames:O,onUpdate:ne=>L(K.id,ne),onRemove:()=>V(K.id),chartProps:s},K.id))})})}),t.plots.length===0&&t.groups.length===0&&f.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[f.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"No plots yet. Add a group or a plot."}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Mn,{size:"sm",variant:"outline",onClick:()=>p(!0),children:[f.jsx(lp,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),f.jsx(iy,{catalog:e,onSelect:F,existingPlots:t.plots,allowDuplicates:!0,children:f.jsxs(Mn,{size:"sm",variant:"outline",children:[f.jsx(lp,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),f.jsx(z2,{open:d,onOpenChange:p,title:"New Group",existingNames:O,onSubmit:R}),f.jsx(z2,{open:m,onOpenChange:x,title:"Rename Section",existingNames:n.filter(K=>K!==t.name),onSubmit:W,initialValue:t.name}),f.jsx(A$,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function F0e({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:o,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:d,evalsList:p,newSectionTrigger:m,availableSampleTags:x,activeTemplateId:b,layoutSnapshotTrigger:_,onLayoutSnapshot:S}){var ut,De,Ve,lt,Le,Ne,$e,ft,nt,We,Ke,je,et,pt,Lt,wt,yt,Pt,zt,Dt;const w=bx(),{data:C,isLoading:A}=XG(),{data:N}=rde(b),[D,P]=M.useState({sections:[]}),[O,R]=M.useState(!1),[L,V]=M.useState(!1),[F,U]=M.useState(void 0);b!==F?b===null?C&&(U(null),P(C.layout??{sections:[]})):N&&N.id===b&&(U(b),P(N.layout??{sections:[]})):!L&&b===null&&C&&(V(!0),U(null),C.layout&&P(C.layout));const[W,Y]=M.useState(m);m!==W&&(Y(m),R(!0));const[$,X]=M.useState(_);_!==$&&(X(_),S(D));const Z=M.useRef(null),K=M.useRef(null),ne=M.useRef(b);ne.current=b;const H=M.useCallback(Et=>{P(Et);const Be=ne.current;Be===null?w.setQueryData(["custom-metrics-layout"],{layout:Et}):w.setQueryData(["custom-metrics-template",Be],Qe=>Qe&&{...Qe,layout:Et}),K.current=Et,Z.current&&clearTimeout(Z.current),Z.current=setTimeout(async()=>{if(K.current){const Qe=K.current;K.current=null;const ht=ne.current;ht===null?await wO(Qe):await MO(ht,Qe)}},500)},[w]);M.useEffect(()=>()=>{if(Z.current&&clearTimeout(Z.current),K.current){const Et=K.current;K.current=null;const Be=ne.current;Be===null?wO(Et):MO(Be,Et)}},[]);const B=M.useMemo(()=>E$(o,s,p),[o,s,p]),G=a==="time",j=Fr(((ut=t[0])==null?void 0:ut.runPath)||"",G&&!!t[0],e),ie=Fr(((De=t[1])==null?void 0:De.runPath)||"",G&&!!t[1],e),ce=Fr(((Ve=t[2])==null?void 0:Ve.runPath)||"",G&&!!t[2],e),te=Fr(((lt=t[3])==null?void 0:lt.runPath)||"",G&&!!t[3],e),se=Fr(((Le=t[4])==null?void 0:Le.runPath)||"",G&&!!t[4],e),le=Fr(((Ne=t[5])==null?void 0:Ne.runPath)||"",G&&!!t[5],e),re=Fr((($e=t[6])==null?void 0:$e.runPath)||"",G&&!!t[6],e),pe=Fr(((ft=t[7])==null?void 0:ft.runPath)||"",G&&!!t[7],e),be=Fr(((nt=t[8])==null?void 0:nt.runPath)||"",G&&!!t[8],e),xe=Fr(((We=t[9])==null?void 0:We.runPath)||"",G&&!!t[9],e),Pe=Fr(((Ke=t[10])==null?void 0:Ke.runPath)||"",G&&!!t[10],e),me=Fr(((je=t[11])==null?void 0:je.runPath)||"",G&&!!t[11],e),ke=Fr(((et=t[12])==null?void 0:et.runPath)||"",G&&!!t[12],e),we=Fr(((pt=t[13])==null?void 0:pt.runPath)||"",G&&!!t[13],e),Te=Fr(((Lt=t[14])==null?void 0:Lt.runPath)||"",G&&!!t[14],e),oe=Fr(((wt=t[15])==null?void 0:wt.runPath)||"",G&&!!t[15],e),_e=Fr(((yt=t[16])==null?void 0:yt.runPath)||"",G&&!!t[16],e),Fe=Fr(((Pt=t[17])==null?void 0:Pt.runPath)||"",G&&!!t[17],e),Ue=Fr(((zt=t[18])==null?void 0:zt.runPath)||"",G&&!!t[18],e),Oe=Fr(((Dt=t[19])==null?void 0:Dt.runPath)||"",G&&!!t[19],e),ue=M.useMemo(()=>[j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe,Ue,Oe],[j,ie,ce,te,se,le,re,pe,be,xe,Pe,me,ke,we,Te,oe,_e,Fe,Ue,Oe]),{isStepTimesFetching:Q,isStepTimesRefetching:fe}=M.useMemo(()=>{if(!G)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Et=ue.some(ht=>ht.isFetching),Be=ue.filter(ht=>ht.isFetching),Qe=Et&&Be.length>0&&Be.every(ht=>!!ht.data);return{isStepTimesFetching:Et,isStepTimesRefetching:Qe}},[G,ue]),{stepTimesByRun:Se,firstStepTimesByRun:Ae}=M.useMemo(()=>{if(!G)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Et=new Map,Be=new Map;return t.forEach((Qe,ht)=>{if(ht>=20)return;const Tt=ue[ht].data;if(!Tt||Tt.first_step_time===null||Tt.first_step_time===void 0||!Tt.step_times||Tt.step_times.length===0)return;const ct=new Map;Tt.step_times.forEach(Ut=>{typeof Ut.time=="number"&&ct.set(Ut.step,Ut.time)}),ct.size>0&&(Et.set(Qe.runPath,ct),Be.set(Qe.runPath,Tt.first_step_time))}),{stepTimesByRun:Et,firstStepTimesByRun:Be}},[t,G,ue]),ve=M.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:d,stepTimesByRun:Se,firstStepTimesByRun:Ae,isStepTimesFetching:Q,isStepTimesRefetching:fe,availableSampleTags:x}),[t,e,n,r,i,a,l,c,d,Se,Ae,Q,fe,x]),qe=D.sections.map(Et=>Et.name),Ee=Et=>{const Be={id:j2(),name:Et,groups:[],plots:[]};H({sections:[...D.sections,Be]})},Ce=(Et,Be)=>{H({sections:D.sections.map(Qe=>Qe.id===Et?Be:Qe)})},Ye=Et=>{H({sections:D.sections.filter(Be=>Be.id!==Et)})},Ze=cS(Zf(ux,{activationConstraint:{distance:8}}),Zf(cx,{coordinateGetter:pS})),it=Et=>{const{active:Be,over:Qe}=Et;if(!Qe||Be.id===Qe.id)return;const ht=D.sections.findIndex(Tt=>Tt.id===Be.id),It=D.sections.findIndex(Tt=>Tt.id===Qe.id);ht===-1||It===-1||H({sections:dx(D.sections,ht,It)})};return f.jsxs("div",{className:"-mt-3",children:[f.jsx(fS,{sensors:Ze,collisionDetection:uS,onDragEnd:it,children:f.jsx(hS,{items:D.sections.map(Et=>Et.id),strategy:yW,children:D.sections.map((Et,Be)=>f.jsxs("div",{children:[Be>0&&f.jsx("div",{className:"border-t border-gray-200 my-3"}),f.jsx(z0e,{section:Et,catalog:B,allSectionNames:qe,onUpdate:Qe=>Ce(Et.id,Qe),onRemove:()=>Ye(Et.id),chartProps:ve})]},Et.id))})}),D.sections.length===0&&A&&f.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[f.jsx(ld,{className:"h-4 w-4 animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading..."})]}),D.sections.length===0&&!A&&f.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[f.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No custom sections yet. Create one to start building your dashboard."}),f.jsxs(Mn,{size:"sm",variant:"outline",onClick:()=>R(!0),children:[f.jsx(lp,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),f.jsx(z2,{open:O,onOpenChange:R,title:"New Section",existingNames:qe,onSubmit:Ee})]})}const CO=100;function N$({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/CO;return f.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:CO}).map((s,o)=>{const a=o*i,l=(o+1)*i;let c=0;t>=l?c=1:t>a&&(c=(t-a)/i);const d=c>0&&r?r:"border-muted-foreground/50";return f.jsx("div",{className:`relative flex-1 h-8 border ${d} rounded-[2px] overflow-hidden bg-background`,children:c>0&&f.jsx("div",{className:`absolute top-0 left-0 bottom-0 transition-all duration-200 ${n}`,style:{width:`${c*100}%`}})},o)})})}function EO(t){const e=Math.floor(t/86400),n=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=Math.floor(t%60);return e>0?`${e}d ${n}h ${r}m`:n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function U0e(t,e){const[n,r]=M.useState(null);if(M.useEffect(()=>{if(!t||!e)return;const o=setTimeout(()=>r(Date.now()),0),a=setInterval(()=>{r(Date.now())},1e3);return()=>{clearTimeout(o),clearInterval(a)}},[t,e]),!t||!e||n===null)return null;const i=new Date(t).getTime();return isNaN(i)?null:(n-i)/1e3}function B0e(t){const e=new Date(t);if(isNaN(e.getTime()))return t;const n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),i=e.getFullYear(),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${i} ${s}:${o}:${a}`}function H0e(t){const e=a=>a&&typeof a=="object"&&"value"in a?a.value:a,n=e(t.model),r=typeof n=="string"?n:null,i=e(t.environments);let s=[],o=i;if(typeof o=="string")try{o=JSON.parse(o)}catch{}return o&&typeof o=="object"&&!Array.isArray(o)?s=Object.keys(o):Array.isArray(o)&&(s=o.map(a=>typeof a=="string"?a:a&&typeof a=="object"&&"name"in a?String(a.name):String(a))),{model:r,envNames:s}}function Qb(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=Number(t);if(Number.isFinite(e))return e}return null}function V0e(t,e,n){if(t.length===0||e>=n)return null;const i=[...t].sort((m,x)=>m.step-x.step).slice(-50);if(i.length===0)return null;const o=Math.pow(.5,1/10),a=i.length;let l=0,c=0;for(let m=0;m<a;m++){const x=Math.pow(o,a-1-m);l+=i[m].value*x,c+=x}const d=l/c,p=n-e;return d*p}function G0e({currentStep:t,totalSteps:e,runtimeSeconds:n,estimatedSecondsToFinish:r}){const i=t>=0?t+1:0,s=e>0?i/e*100:0,o=Math.min(s,100);return f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),f.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[f.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[o.toFixed(2),"%"]}),f.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[i," / ",e," Steps"]}),n!==null&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),f.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:EO(n)})]}),r!==null&&r>0&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),f.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:["ETA: ",EO(r)]})]})]}),f.jsx(N$,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function W0e({groupsDone:t,totalGroups:e,step:n,waitingBuckets:r}){const i=e>0?t/e*100:0,s=Math.min(i,100),o=(r==null?void 0:r.length)??0;return f.jsxs("div",{className:"space-y-1.5",children:[f.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["Trainer Bucket",n!==null?` (Step ${n})`:"",o>0&&f.jsxs("span",{className:"ml-2 font-normal",children:["· ",o," batch",o!==1?"es":""," waiting for trainer"," · ",f.jsxs("span",{className:"tabular-nums",children:["steps ",r.join(", ")]})]})]}),f.jsxs("div",{className:"flex items-baseline gap-1.5",children:[f.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[s.toFixed(2),"%"]}),f.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[t," / ",e," Groups"]})]}),f.jsx(N$,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function $0e(){var _e,Fe,Ue,Oe,ue,Q,fe,Se,Ae,ve,qe;const t=Jn(xl),e=Jn(yT),n=Jn(ST),r=$d(EG),i=$d(AG),[s,o]=M.useState(!0),[a,l]=M.useState(!0),[c,d]=M.useState("custom"),[p,m]=M.useState(0),[x,b]=M.useState(0),[_,S]=dn(kle),[w,C]=dn(Dle),[A,N]=M.useState(String(w)),[D,P]=dn(Ple),[O,R]=dn(NG),[L,V]=dn(Ole),F=D?n:null,{data:U,isLoading:W,error:Y}=cd(t||"",!!t,!0),{data:$}=ym(),X=M.useMemo(()=>{const Ee=($==null?void 0:$.runs)||[],Ce=new Set(e);return t&&Ce.add(t),Ee.filter(Ye=>Ce.has(Ye.run_id)).map(Ye=>({runPath:Ye.run_id,runName:Ye.name,color:Ye.color,isSelected:Ye.run_id===t}))},[t,e,$==null?void 0:$.runs]);M.useEffect(()=>{U&&(r(U.is_tracking),i(U.is_syncing))},[U,r,i]);const Z=typeof((_e=U==null?void 0:U.config)==null?void 0:_e.number_of_steps)=="number"?U.config.number_of_steps:null,K=typeof((Fe=U==null?void 0:U.config)==null?void 0:Fe.prompts_batch_size_for_trainer)=="number"?U.config.prompts_batch_size_for_trainer:typeof((Ue=U==null?void 0:U.config)==null?void 0:Ue.batch_size_for_trainer)=="number"?U.config.batch_size_for_trainer:null,ne=(Oe=U==null?void 0:U.summary)!=null&&Oe.steps&&typeof U.summary.steps=="object"?U.summary.steps:null,H=Qb((ue=U==null?void 0:U.summary)==null?void 0:ue["steps/last_training_step"])??Qb(ne==null?void 0:ne.last_training_step)??Qb((Q=U==null?void 0:U.trainer_info)==null?void 0:Q.last_training_step)??Qb((fe=U==null?void 0:U.rollout_info)==null?void 0:fe.last_training_step)??Qb(U==null?void 0:U.last_rollout_step)??-1,B=U==null?void 0:U.trainer_bucket_info,G=((Se=U==null?void 0:U.step_metrics_info)==null?void 0:Se.local_steps)??0,j=((Ae=U==null?void 0:U.step_metrics_info)==null?void 0:Ae.custom_metric_sections)??{},ie=(U==null?void 0:U.available_rollout_metric_names)??[],ce=((ve=U==null?void 0:U.eval_info)==null?void 0:ve.evals)??[],te=M.useMemo(()=>E$(j,ie,ce),[j,ie,ce]),se=M.useMemo(()=>{if(D)return X;const Ee=X.find(Ce=>Ce.isSelected);return Ee?[Ee]:X.slice(0,1)},[D,X]),le=cS(Zf(ux,{activationConstraint:{distance:5}}),Zf(cx,{coordinateGetter:pS})),re=M.useCallback(Ee=>{const{active:Ce,over:Ye}=Ee;!Ye||Ce.id===Ye.id||V(Ze=>{const it=Ze.findIndex(De=>De.id===Ce.id),ut=Ze.findIndex(De=>De.id===Ye.id);return it===-1||ut===-1?Ze:dx(Ze,it,ut)})},[V]),pe=(U==null?void 0:U.available_sample_tags)??{},be=M.useMemo(()=>({runs:se,shouldPoll:!0,showEma:_,emaSpan:w,hoveredRunId:F,xAxisMode:"step",scrollRoot:null,availableSampleTags:pe}),[se,_,w,F,pe]),xe=M.useMemo(()=>!t||!($!=null&&$.runs)?null:$.runs.find(Ee=>Ee.run_id===t)??null,[t,$]),Pe=((qe=xe==null?void 0:xe.state)==null?void 0:qe.toLowerCase())==="running",me=U0e((xe==null?void 0:xe.created_at)??null,Pe),ke=M.useMemo(()=>{var Ye,Ze,it;if(Pe)return null;const Ee=(Ye=U==null?void 0:U.summary)==null?void 0:Ye._runtime;if(typeof Ee=="number")return Ee;const Ce=(it=(Ze=U==null?void 0:U.summary)==null?void 0:Ze._wandb)==null?void 0:it.runtime;return typeof Ce=="number"?Ce:null},[Pe,U==null?void 0:U.summary]),we=Pe?me:ke,{data:Te}=$G(t||"","timing_step_total",!!t&&!!Z&&H>0,!0),oe=M.useMemo(()=>{if(!(Te!=null&&Te.metrics)||!Z||H<=0)return null;const Ee=Te.metrics.filter(Ze=>Ze.metric_name==="timing_step_total").map(Ze=>({step:Ze.step,value:Ze.value}));if(Ee.length===0)return null;const Ce=Math.min(...Ee.map(Ze=>Ze.step)),Ye=Ee.filter(Ze=>Ze.step!==Ce);return V0e(Ye,H,Z)},[Te,Z,H]);return t?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:f.jsx("div",{className:"py-2.5 px-6",children:f.jsx("div",{className:"max-w-7xl mx-auto flex items-center gap-2.5 h-7",children:xe&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:xe.color}}),f.jsx("span",{className:"text-sm font-semibold truncate",children:xe.name||xe.run_id.split("/").pop()}),f.jsx("span",{className:"text-sm text-muted-foreground truncate",children:xe.run_id}),xe.created_at&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),f.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums whitespace-nowrap",children:["Created at ",B0e(xe.created_at)]})]})]})})})}),f.jsx("div",{className:O?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:O?f.jsx(Ahe,{runPath:t,onBack:()=>R(!1)},t):f.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[W?f.jsxs("div",{className:"space-y-3",children:[f.jsx(tp,{className:"h-4 w-32"}),f.jsx(tp,{className:"h-8 w-64"}),f.jsx(tp,{className:"h-8 w-full"})]}):Y?f.jsx(Ju,{className:"border-destructive",children:f.jsx(ih,{className:"pt-6",children:f.jsx("p",{className:"text-destructive",children:"Failed to load run summary. Make sure the run has been synced."})})}):f.jsxs("div",{className:"space-y-5",children:[Z!==null?f.jsx(G0e,{currentStep:H,totalSteps:Z,runtimeSeconds:we??null,estimatedSecondsToFinish:oe}):f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),f.jsx("div",{className:"flex items-baseline gap-1.5",children:f.jsx("span",{className:"text-sm text-muted-foreground",children:"Waiting for data…"})})]}),K!==null&&B&&f.jsx(W0e,{groupsDone:B.groups_done,totalGroups:K,step:B.step,waitingBuckets:U==null?void 0:U.waiting_buckets})]}),G>0&&X.length>0&&f.jsx("div",{children:s?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o(!1),children:"Hide Plots"}),f.jsx(mS,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:S,value:A,onValueChange:N,onValueCommit:Ee=>{const Ce=parseInt(Ee,10);!isNaN(Ce)&&Ce>=2&&Ce<=100?(C(Ce),N(Ce.toString())):N(w.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),f.jsx(S1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:P,className:"text-xs px-2",children:"All selected runs"}),f.jsx(iy,{catalog:te,existingPlots:L,onSelect:Ee=>{const Ce=Math.random().toString(36).slice(2,10);V(Ye=>[...Ye,{id:Ce,metricKey:Ee.metricKey,label:Ee.label,plotType:Ee.plotType,evalName:Ee.evalName,distMetricType:Ee.distMetricType,inferenceMetricType:Ee.inferenceMetricType}])},children:f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),f.jsx(fS,{sensors:le,collisionDetection:uS,onDragEnd:re,children:f.jsx(hS,{items:L.map(Ee=>Ee.id),strategy:mw,children:f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:L.map(Ee=>f.jsx(s8,{plot:Ee,onRemove:()=>V(Ce=>Ce.filter(Ye=>Ye.id!==Ee.id)),chartProps:be},Ee.id))})})})]}):f.jsxs("button",{onClick:()=>o(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors flex items-center gap-1.5",children:[f.jsx("svg",{className:"h-4 w-4 text-muted-foreground -rotate-90",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),f.jsx("span",{className:"text-sm font-semibold",children:"Plots"})]})}),(U==null?void 0:U.config)&&(()=>{const{model:Ee,envNames:Ce}=H0e(U.config);return!Ee&&Ce.length===0?null:f.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Ee&&f.jsx("span",{className:"font-semibold",children:Ee}),Ce.map(Ye=>f.jsx("span",{className:"text-muted-foreground",children:Ye},Ye))]})})(),(U==null?void 0:U.config)&&Object.keys(U.config).length>0&&f.jsx("div",{children:a?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[f.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"}),U.custom_config&&f.jsxs(em,{type:"single",value:c,onValueChange:Ee=>{Ee&&d(Ee)},variant:"outline",size:"sm",children:[f.jsx(Wa,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),f.jsx(Wa,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),f.jsx(fhe,{currentRunId:t,currentConfig:U.config}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{m(Ee=>Ee+1)},children:"Collapse All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(Ee=>Ee+1)},children:"Expand All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>R(!0),children:"Code"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),f.jsx(QG,{config:c==="custom"&&U.custom_config?U.custom_config:U.config,collapseAllSignal:p,expandAllSignal:x})]}):f.jsxs("button",{onClick:()=>l(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors flex items-center gap-1.5",children:[f.jsx("svg",{className:"h-4 w-4 text-muted-foreground -rotate-90",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),f.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"})]})})]})})]}):f.jsx(bm,{description:"Select a run from the sidebar or add a new one to get started."})}const p4=rh;function q0e(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function X0e(){var Ee;const[t,e]=M.useState(null),n=M.useRef(0),[r,i]=dn(Hle),s=Jn(xl),o=Jn(yT),a=Jn(ST),[l,c]=dn(Vle),[d,p]=M.useState(0),m=bx(),[x,b]=dn(Gle),[_,S]=dn(Wle),{data:w}=nde(),C=(w==null?void 0:w.templates)??[],[A,N]=M.useState(!1),[D,P]=M.useState(!1),[O,R]=M.useState("new"),[L,V]=M.useState(""),[F,U]=M.useState(!1),[W,Y]=M.useState(0),$=M.useRef(null),X=M.useRef(null),Z=M.useCallback(Ce=>{R(Ce),V(Ce==="rename"?_??"":""),Ce==="new"?(X.current={sections:[]},P(!0)):Ce==="duplicate"?($.current=Ye=>{$.current=null,X.current=Ye,P(!0)},Y(Ye=>Ye+1)):P(!0)},[_]),K=M.useCallback(async()=>{const Ce=L.trim();if(Ce){if(O==="new"||O==="duplicate"){const Ye=X.current??{sections:[]},Ze=await fetch(`${ar}/custom-metrics-templates`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Ce,layout:Ye})});if(Ze.ok){const it=await Ze.json();b(it.id),S(it.name),m.invalidateQueries({queryKey:["custom-metrics-templates"]})}X.current=null}else O==="rename"&&x&&(await fetch(`${ar}/custom-metrics-templates/${x}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Ce})})).ok&&(S(Ce),m.invalidateQueries({queryKey:["custom-metrics-templates"]}));P(!1)}},[L,O,x,b,S,m]),ne=M.useCallback(Ce=>{Ce===null?(b(null),S(null)):(b(Ce.id),S(Ce.name)),N(!1)},[b,S]),H=M.useCallback(async()=>{x&&(await fetch(`${ar}/custom-metrics-templates/${x}`,{method:"DELETE"}),b(null),S(null),m.invalidateQueries({queryKey:["custom-metrics-templates"]}),U(!1))},[x,b,S,m]),[B,G]=dn(Lle),[j,ie]=dn(jle),[ce,te]=M.useState(j.toString()),[se,le]=dn(zle),[re,pe]=dn(Fle),[be,xe]=dn(Ule),[Pe,me]=dn(Ble),[ke,we]=M.useState(be.toString()),[Te,oe]=M.useState(p4(Pe));M.useEffect(()=>{we(be.toString())},[be]),M.useEffect(()=>{oe(p4(Pe))},[Pe]),XG();const _e=!0;M.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),M.useEffect(()=>{if(!t)return;const Ce=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",Ce,{passive:!0}),()=>{t.removeEventListener("scroll",Ce),i(n.current)}},[t]);const{data:Fe}=ym(),Ue=M.useMemo(()=>{const Ce=(Fe==null?void 0:Fe.runs)||[],Ye=new Set(o);return s&&Ye.add(s),Ce.filter(Ze=>Ye.has(Ze.run_id)).map(Ze=>({runPath:Ze.run_id,runName:Ze.name,color:Ze.color,isSelected:Ze.run_id===s}))},[s,o,Fe==null?void 0:Fe.runs]),{data:Oe,error:ue}=cd(s||"",!!s,_e),Q=Oe==null?void 0:Oe.step_metrics_info,fe=(Q==null?void 0:Q.local_steps)??0,Se=(Oe==null?void 0:Oe.available_rollout_metric_names)??[],Ae=(Q==null?void 0:Q.custom_metric_sections)??{},ve=((Ee=Oe==null?void 0:Oe.eval_info)==null?void 0:Ee.evals)??[],qe=(Oe==null?void 0:Oe.available_sample_tags)??{};return s?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center justify-start gap-2 h-7",children:[f.jsxs(em,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:Ce=>{Ce&&c(Ce)},children:[f.jsx(Wa,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),f.jsx(Wa,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&f.jsxs(f.Fragment,{children:[f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>p(Ce=>Ce+1),children:[f.jsx(lp,{className:"h-3 w-3 mr-1"}),"New Section"]}),f.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",children:["Templates",_&&f.jsxs("span",{className:"ml-1 text-muted-foreground",children:["(",_,")"]})]})}),f.jsxs(ua,{align:"start",children:[f.jsx(ra,{onClick:()=>N(!0),children:"Load"}),f.jsx(ra,{onClick:()=>Z("new"),children:"New"}),f.jsx(ra,{onClick:()=>Z("duplicate"),children:"Duplicate"}),f.jsx(aa,{}),f.jsx(ra,{onClick:()=>Z("rename"),disabled:!x,children:"Rename"}),f.jsx(ra,{onClick:()=>U(!0),disabled:!x,className:"text-destructive focus:text-destructive",children:"Delete"})]})]})]}),f.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),f.jsxs(em,{type:"single",variant:"outline",size:"sm",value:se,onValueChange:Ce=>{Ce&&le(Ce)},children:[f.jsx(Wa,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),f.jsx(Wa,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),f.jsx(mS,{label:"EMA",variant:"selecting",size:"sm",enabled:B,onEnabledChange:G,value:ce,onValueChange:te,onValueCommit:Ce=>{const Ye=parseInt(Ce,10);!isNaN(Ye)&&Ye>=2&&Ye<=100?(ie(Ye),te(Ye.toString())):te(j.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),f.jsx(mS,{label:se==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:re,onEnabledChange:pe,value:se==="step"?ke:Te,inputType:se==="step"?"number":"text",onValueChange:Ce=>{se==="step"?we(Ce):oe(Ce)},onValueCommit:Ce=>{if(se==="step"){const Ye=parseInt(Ce,10);!isNaN(Ye)&&Ye>=1?(xe(Ye),we(Ye.toString())):we(be.toString())}else{const Ye=q0e(Ce);Ye!==null?(me(Ye),oe(p4(Ye))):oe(p4(Pe))}},inputMin:1,inputWidth:"w-16"})]})})}),f.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:f.jsxs("div",{className:"max-w-7xl mx-auto",children:[ue&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",ue instanceof Error?ue.message:"Unknown error"]})})}),l==="all"?f.jsx(k0e,{runs:Ue,shouldPoll:_e,totalSteps:fe,showEma:B,emaSpan:j,hoveredRunId:a,availableRewardNames:Se,customMetricSections:Ae,xAxisMode:se,scrollRoot:t,maxStep:re&&se==="step"?be:void 0,maxTime:re&&se==="time"?Pe:void 0,evalsList:ve,availableSampleTags:qe}):f.jsx(F0e,{runs:Ue,shouldPoll:_e,showEma:B,emaSpan:j,hoveredRunId:a,availableRewardNames:Se,customMetricSections:Ae,xAxisMode:se,scrollRoot:t,maxStep:re&&se==="step"?be:void 0,maxTime:re&&se==="time"?Pe:void 0,evalsList:ve,availableSampleTags:qe,newSectionTrigger:d,activeTemplateId:x,layoutSnapshotTrigger:W,onLayoutSnapshot:Ce=>{$.current&&$.current(Ce)}})]})}),f.jsx(qu,{open:A,onOpenChange:N,children:f.jsxs(Xu,{className:"sm:max-w-[400px]",children:[f.jsx(Zc,{children:f.jsx(Qc,{children:"Load Template"})}),f.jsxs("div",{className:"flex flex-col gap-1 max-h-[300px] overflow-y-auto",children:[f.jsx("button",{className:Rt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===null&&"bg-accent font-medium"),onClick:()=>ne(null),children:"Default"}),C.map(Ce=>f.jsx("button",{className:Rt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===Ce.id&&"bg-accent font-medium"),onClick:()=>ne(Ce),children:Ce.name},Ce.id)),C.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:"No saved templates yet."})]})]})}),f.jsx(qu,{open:D,onOpenChange:P,children:f.jsxs(Xu,{className:"sm:max-w-[400px]",children:[f.jsx(Zc,{children:f.jsx(Qc,{children:O==="new"?"New Template":O==="duplicate"?"Duplicate Template":"Rename Template"})}),f.jsx(cp,{placeholder:"Template name",value:L,onChange:Ce=>V(Ce.target.value),onKeyDown:Ce=>{Ce.key==="Enter"&&L.trim()&&K()},autoFocus:!0}),f.jsxs(ET,{children:[f.jsx(Mn,{variant:"outline",size:"sm",onClick:()=>P(!1),children:"Cancel"}),f.jsx(Mn,{size:"sm",onClick:K,disabled:!L.trim(),children:O==="rename"?"Rename":"Create"})]})]})}),f.jsx(m2,{open:F,onOpenChange:U,children:f.jsxs(g2,{children:[f.jsxs(x2,{children:[f.jsx(y2,{children:"Delete Template"}),f.jsxs(b2,{children:["Are you sure you want to delete “",_,"”? This action cannot be undone."]})]}),f.jsxs(v2,{children:[f.jsx(S2,{children:"Cancel"}),f.jsx(_2,{onClick:H,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]}):f.jsx(bm,{description:"Select a run from the sidebar to view training metrics."})}function o8({...t}){return f.jsx(Qoe,{"data-slot":"select",...t})}function a8({...t}){return f.jsx(eae,{"data-slot":"select-value",...t})}function l8({className:t,size:e="default",children:n,...r}){return f.jsxs(Joe,{"data-slot":"select-trigger","data-size":e,className:Rt("border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,f.jsx(tae,{asChild:!0,children:f.jsx(Ir,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function c8({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return f.jsx(nae,{children:f.jsxs(rae,{"data-slot":"select-content",className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,align:r,...i,children:[f.jsx(Y0e,{}),f.jsx(iae,{"data-position":n,className:Rt("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]",n==="popper"&&""),children:e}),f.jsx(K0e,{})]})})}function u8({className:t,children:e,...n}){return f.jsxs(sae,{"data-slot":"select-item",className:Rt("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[f.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:f.jsx(aae,{children:f.jsx(vm,{className:"pointer-events-none"})})}),f.jsx(oae,{children:e})]})}function Y0e({className:t,...e}){return f.jsx(lae,{"data-slot":"select-scroll-up-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:f.jsx(M7,{})})}function K0e({className:t,...e}){return f.jsx(cae,{"data-slot":"select-scroll-down-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:f.jsx(Ir,{})})}const m4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],GT={gpu_memory_used_gb:{label:"Memory Used",unit:"GB"},gpu_memory_total_gb:{label:"Memory Total",unit:"GB"},gpu_memory_free_gb:{label:"Memory Free",unit:"GB"},gpu_temperature_c:{label:"Temperature",unit:"degC"},gpu_power_w:{label:"Power",unit:"W"},gpu_power_limit_w:{label:"Power Limit",unit:"W"},gpu_utilization_percent:{label:"GPU Utilization",unit:"%"},gpu_memory_used_percent:{label:"Memory Capacity Used",unit:"%"},gpu_memory_bandwidth_utilization_percent:{label:"Memory Bandwidth Utilization",unit:"%"},gpu_clock_sm_mhz:{label:"SM Clock",unit:"MHz"},gpu_clock_mem_mhz:{label:"Memory Clock",unit:"MHz"},gpu_fan_speed_percent:{label:"Fan Speed",unit:"%"},torch_allocated_gb:{label:"Torch Memory Allocated",unit:"GB"},torch_reserved_gb:{label:"Torch Memory Reserved",unit:"GB"},torch_max_allocated_gb:{label:"Torch Max Memory Allocated",unit:"GB"},cpu_utilization_percent:{label:"CPU Utilization",unit:"%"},system_memory_total_gb:{label:"Memory Total",unit:"GB"},system_memory_used_gb:{label:"Memory Used",unit:"GB"},system_memory_available_gb:{label:"Memory Available",unit:"GB"},system_memory_percent:{label:"Memory Usage",unit:"%"},requests_running:{label:"Requests Running",unit:""},requests_waiting:{label:"Requests Waiting",unit:""},cache_usage:{label:"KV Cache Usage",unit:"%"},cache_hit_rate:{label:"KV Cache Hit Rate",unit:"%"},requests_total:{label:"Requests Total",unit:""},prompt_tokens_total:{label:"Prompt Tokens Total",unit:""},rollout_tokens_total:{label:"Rollout Tokens Total",unit:""},preemptions_total:{label:"Preemptions Total",unit:""},cache_hits_total:{label:"Cache Hits Total",unit:""},cache_queries_total:{label:"Cache Queries Total",unit:""},ttft_mean:{label:"TTFT (Mean)",unit:"s"},e2e_latency_mean:{label:"E2E Latency (Mean)",unit:"s"},itl_mean:{label:"ITL (Mean)",unit:"s"}};function Z0e(t){const e=Math.abs(t);if(e>=60)return kT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return qd(t)}const Q0e=28;function J0e(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]:void 0,d=l<t.length?t[l]:void 0,p=c!=null,m=d!=null;if(p&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(p)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function eme(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}function xA({label:t,onRemove:e}){return f.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,f.jsx(fu,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function g4(t){return typeof t=="number"&&Number.isFinite(t)}function tme(t,e){if(t.startsWith("#")){const i=t.slice(1),s=i.length===3?i.split("").map(o=>o+o).join(""):i;if(s.length===6){const o=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${o}, ${a}, ${l}, ${e})`}}const n=t.match(/^rgb\(([^)]+)\)$/i);if(n)return`rgba(${n[1]}, ${e})`;const r=t.match(/^rgba\(([^)]+)\)$/i);return r?`rgba(${r[1].split(",").slice(0,3).join(",")}, ${e})`:t}function R$({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:o,gpuDisplayNames:a,isLoading:l,seriesMode:c="gpu",showLegend:d,seriesRoles:p,activeSeriesKeys:m=null,xOffset:x=0,xAxisMode:b="elapsed",xAxisTicks:_="auto",isRefetching:S=!1}){const w=Jn(No),C=M.useRef(null),A=M.useRef(null),N=M.useRef(null),[D,P]=M.useState(!1),[O,R]=M.useState(null),[L,V]=M.useState(null),F=GT[t]||{label:t.replace(/_/g," "),unit:""},U=s==="timeline",W=b==="clock"&&_==="bounds",Y=M.useMemo(()=>{if(c==="node_gpu"){const ie=new Map,ce=[...e].sort((te,se)=>{const le=g4(te.node_id)?te.node_id:Number.MAX_SAFE_INTEGER,re=g4(se.node_id)?se.node_id:Number.MAX_SAFE_INTEGER;return le!==re?le-re:te.gpu_index-se.gpu_index});for(const te of ce){const se=g4(te.node_id)?te.node_id:null,le=`${se??"?"}:${te.gpu_index}`;if(ie.has(le))continue;const re=se===null?"Node ?":`Node ${se}`,pe=ie.size;ie.set(le,{key:le,label:`${re} GPU ${te.gpu_index}`,stroke:o||m4[pe%m4.length],gpuIndex:te.gpu_index,nodeId:se})}return Array.from(ie.values())}return(n.length>0?Array.from(new Set(n)).sort((ie,ce)=>ie-ce):Array.from(new Set(e.map(ie=>ie.gpu_index))).sort((ie,ce)=>ie-ce)).map(ie=>({key:`gpu:${ie}`,label:(a==null?void 0:a[ie])??`GPU ${ie}`,stroke:o||m4[ie%m4.length],gpuIndex:ie,nodeId:null}))},[c,e,n,a,o]),$=M.useMemo(()=>new Set(Y.map(j=>j.key)),[Y]),{uplotData:X,seriesConfig:Z,hasData:K,outlierBounds:ne}=M.useMemo(()=>{if(e.length===0||Y.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const j={},ie=new Set,ce=[];for(const pe of e){const be=c==="node_gpu"?`${g4(pe.node_id)?pe.node_id:"?"}:${pe.gpu_index}`:`gpu:${pe.gpu_index}`;$.has(be)&&(ie.add(pe.timestamp),j[pe.timestamp]||(j[pe.timestamp]={}),j[pe.timestamp][be]=pe.value,ce.push(pe.value))}const te=Array.from(ie).sort((pe,be)=>pe-be);if(te.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const se=te.map(pe=>pe-r),le=[{label:"Time"}],re=[se];for(const pe of Y){const be=te.map(Pe=>{var me;return((me=j[Pe])==null?void 0:me[pe.key])??null}),xe=m!==null&&m.size>0&&!m.has(pe.key);re.push(be),le.push({label:pe.label,stroke:xe?tme(pe.stroke,.25):pe.stroke,width:xe?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:re,seriesConfig:le,hasData:!0,outlierBounds:eme(ce)}},[e,r,Y,c,$,m]),H=d??(!U&&Y.length>1),B=M.useCallback(j=>Math.abs(j)>=1e3?`${parseFloat((j/1e3).toFixed(1))}k`:Number.isInteger(j)?j.toLocaleString():Math.abs(j)<.01&&j!==0?j.toExponential(1):String(parseFloat(j.toFixed(2))),[]);M.useEffect(()=>{if(!C.current||!X||!K)return;const j=C.current,ie=j.clientWidth,ce=192;let te=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY;for(let _e=1;_e<X.length;_e+=1){const Fe=X[_e];for(let Ue=0;Ue<Fe.length;Ue+=1){const Oe=Fe[Ue];Oe!=null&&(D&&ne?Oe>=ne.lower&&Oe<=ne.upper&&(Oe<te&&(te=Oe),Oe>se&&(se=Oe)):(Oe<te&&(te=Oe),Oe>se&&(se=Oe)))}}te===Number.POSITIVE_INFINITY&&ne&&(te=ne.lower,se=ne.upper);const le=se-te,re=Math.max(Math.abs(se),Math.abs(te)),pe=Math.max(re*.05,1e-10),be=Math.max(le*.1,pe),xe=[O!==null?O:Math.max(0,te-be),L!==null?L:se+be],Pe=w?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",me=w?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",we={width:ie,height:ce,padding:U?[0,0,0,0]:W?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!U,y:!1}},legend:{show:H},...U?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(_e,Fe,Ue)=>{const Oe=i-r;return Oe>0?[0,Oe]:[Fe,Ue]}},y:{range:xe}},axes:U?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:me,grid:{stroke:Pe,width:1},ticks:{stroke:Pe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(_e,Fe,Ue,Oe)=>[Ue,Oe]:void 0,values:(_e,Fe)=>Fe.map(Ue=>b==="clock"?J0(r+Number(Ue),i-r):qd(Number(Ue)+x))},{stroke:me,grid:{stroke:Pe,width:1},ticks:{stroke:Pe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(_e,Fe)=>{if(!Fe||Fe.length===0)return 40;const Ue=Math.max(...Fe.map(Oe=>Oe.length));return Math.max(40,Ue*7+14)},values:(_e,Fe)=>Fe.map(B)}],series:Z,hooks:{setCursor:[_e=>{if(!N.current||!C.current)return;const{left:Fe,idx:Ue}=_e.cursor;if(Ue==null||Fe===void 0||Fe<0){N.current.style.display="none";return}const Oe=X[0][Ue];if(Oe===void 0){N.current.style.display="none";return}const ue=X[0],Q=(()=>{const De=_e.scales.x,Ve=Number(De.min),lt=Number(De.max);if(!Number.isFinite(Ve)||!Number.isFinite(lt))return null;const Le=Math.abs(lt-Ve);if(Le<=0)return null;const Ne=Math.max(1,_e.bbox.width);return Le*Q0e/Ne})(),fe=Z0e(Number(Oe)+x),Se=r+Number(Oe),Ae=J0(Se,i-r);let ve="";U||(ve+=`<div class="font-medium mb-1">${Ae}</div>`,ve+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${fe}</div>`,ve+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Se.toFixed(3)}</div>`);const qe=[];for(let De=0;De<Y.length;De+=1){const Ve=Y[De],lt=X[De+1],Le=J0e(lt,ue,Ue,Q);if(Le===null)continue;const Ne=lt==null?void 0:lt[Le];Ne!=null&&qe.push({entry:Ve,formatted:td(Ne),role:(p==null?void 0:p[Ve.key])??null})}const Ee=qe.length>0;if(qe.some(De=>De.role!==null)&&!U){const De={Trainer:0,Inference:1},Ve=[];for(const lt of qe){const Le=lt.role??"Other";Ve.includes(Le)||Ve.push(Le)}Ve.sort((lt,Le)=>(De[lt]??99)-(De[Le]??99));for(const lt of Ve){ve+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${lt}</div>`;for(const Le of qe)(Le.role??"Other")===lt&&(ve+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Le.entry.stroke}"></div>
                      <span class="text-muted-foreground">${Le.entry.label}:</span>
                      <span class="font-medium">${Le.formatted} ${F.unit}</span>
                    </div>
                  `)}}else for(const De of qe)U?ve+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${De.entry.label}:</span>
                      <span class="font-medium">${De.formatted} ${F.unit}</span>
                    </div>
                  `:ve+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${De.entry.stroke}"></div>
                      <span class="text-muted-foreground">${De.entry.label}:</span>
                      <span class="font-medium">${De.formatted} ${F.unit}</span>
                    </div>
                  `;if(!Ee){N.current.style.display="none";return}U&&(ve+=`<div class="text-muted-foreground mt-1">Time: ${fe}</div>`),N.current.innerHTML=ve,N.current.style.display="block";const Ye=C.current.getBoundingClientRect(),Ze=N.current.getBoundingClientRect();let it=Ye.left+Fe+15;it+Ze.width+20>window.innerWidth&&(it=Ye.left+Fe-Ze.width-15+_e.bbox.left),it=Math.max(4,it);let ut=Ye.top-Ze.height+20;ut<4&&(ut=Ye.bottom-20),N.current.style.left=`${it}px`,N.current.style.top=`${ut}px`}]}};A.current&&A.current.destroy();const Te=new no(we,X,j);A.current=Te;const oe=new ResizeObserver(_e=>{for(const Fe of _e){const{width:Ue}=Fe.contentRect;Te&&Ue>0&&Te.setSize({width:Ue,height:ce})}});return oe.observe(j),()=>{oe.disconnect(),Te.destroy(),A.current=null}},[X,K,Z,t,r,i,x,b,_,W,U,F.unit,H,Y,p,B,D,ne,O,L,w]);const G=M.useCallback(()=>{N.current&&(N.current.style.display="none")},[]);return!K&&U?f.jsx("div",{className:"h-48 bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):f.jsxs("div",{className:Rt("rounded-lg border transition-opacity",U?"overflow-hidden":"group/chart border-border p-3 bg-background",l&&"opacity-60"),children:[!U&&f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:F.label}),D&&f.jsx(xA,{label:"Ignore Outliers",onRemove:()=>P(!1)}),O!==null&&f.jsx(xA,{label:`Min Y: ${O}`,onRemove:()=>R(null)}),L!==null&&f.jsx(xA,{label:`Max Y: ${L}`,onRemove:()=>V(null)})]}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:D,onCheckedChange:P,children:"Ignore Outliers"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:O??"",onChange:j=>{const ie=j.target.value;R(ie===""?null:Number(ie))},onClick:j=>j.stopPropagation(),onKeyDown:j=>j.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:L??"",onChange:j=>{const ie=j.target.value;V(ie===""?null:Number(ie))},onClick:j=>j.stopPropagation(),onKeyDown:j=>j.stopPropagation()})]})]})]})})]}),K?f.jsxs("div",{className:"h-48 relative bg-background rounded",ref:C,onMouseLeave:G,children:[!U&&S&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),f.jsx("div",{ref:N,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):f.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:l?"Loading...":`No data for ${F.label}`})]})}function AO(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function nme(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ime=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sme={};function NO(t,e){return(sme.jsx?ime:rme).test(t)}const ome=/[ \t\n\f\r]/g;function ame(t){return typeof t=="object"?t.type==="text"?RO(t.value):!1:RO(t)}function RO(t){return t.replace(ome,"")===""}class gw{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}gw.prototype.normal={};gw.prototype.property={};gw.prototype.space=void 0;function k$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new gw(n,r,e)}function xS(t){return t.toLowerCase()}class kc{constructor(e,n){this.attribute=n,this.property=e}}kc.prototype.attribute="";kc.prototype.booleanish=!1;kc.prototype.boolean=!1;kc.prototype.commaOrSpaceSeparated=!1;kc.prototype.commaSeparated=!1;kc.prototype.defined=!1;kc.prototype.mustUseProperty=!1;kc.prototype.number=!1;kc.prototype.overloadedBoolean=!1;kc.prototype.property="";kc.prototype.spaceSeparated=!1;kc.prototype.space=void 0;let lme=0;const Pr=Nx(),Bo=Nx(),xR=Nx(),un=Nx(),ds=Nx(),M1=Nx(),$c=Nx();function Nx(){return 2**++lme}const vR=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pr,booleanish:Bo,commaOrSpaceSeparated:$c,commaSeparated:M1,number:un,overloadedBoolean:xR,spaceSeparated:ds},Symbol.toStringTag,{value:"Module"})),vA=Object.keys(vR);class d8 extends kc{constructor(e,n,r,i){let s=-1;if(super(e,n),kO(this,"space",i),typeof r=="number")for(;++s<vA.length;){const o=vA[s];kO(this,vA[s],(r&vR[o])===vR[o])}}}d8.prototype.defined=!0;function kO(t,e,n){n&&(t[e]=n)}function Py(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new d8(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[xS(r)]=r,n[xS(s.attribute)]=r}return new gw(e,n,t.space)}const D$=Py({properties:{ariaActiveDescendant:null,ariaAtomic:Bo,ariaAutoComplete:null,ariaBusy:Bo,ariaChecked:Bo,ariaColCount:un,ariaColIndex:un,ariaColSpan:un,ariaControls:ds,ariaCurrent:null,ariaDescribedBy:ds,ariaDetails:null,ariaDisabled:Bo,ariaDropEffect:ds,ariaErrorMessage:null,ariaExpanded:Bo,ariaFlowTo:ds,ariaGrabbed:Bo,ariaHasPopup:null,ariaHidden:Bo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ds,ariaLevel:un,ariaLive:null,ariaModal:Bo,ariaMultiLine:Bo,ariaMultiSelectable:Bo,ariaOrientation:null,ariaOwns:ds,ariaPlaceholder:null,ariaPosInSet:un,ariaPressed:Bo,ariaReadOnly:Bo,ariaRelevant:null,ariaRequired:Bo,ariaRoleDescription:ds,ariaRowCount:un,ariaRowIndex:un,ariaRowSpan:un,ariaSelected:Bo,ariaSetSize:un,ariaSort:null,ariaValueMax:un,ariaValueMin:un,ariaValueNow:un,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function P$(t,e){return e in t?t[e]:e}function I$(t,e){return P$(t,e.toLowerCase())}const cme=Py({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:M1,acceptCharset:ds,accessKey:ds,action:null,allow:null,allowFullScreen:Pr,allowPaymentRequest:Pr,allowUserMedia:Pr,alt:null,as:null,async:Pr,autoCapitalize:null,autoComplete:ds,autoFocus:Pr,autoPlay:Pr,blocking:ds,capture:null,charSet:null,checked:Pr,cite:null,className:ds,cols:un,colSpan:null,content:null,contentEditable:Bo,controls:Pr,controlsList:ds,coords:un|M1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pr,defer:Pr,dir:null,dirName:null,disabled:Pr,download:xR,draggable:Bo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pr,formTarget:null,headers:ds,height:un,hidden:xR,high:un,href:null,hrefLang:null,htmlFor:ds,httpEquiv:ds,id:null,imageSizes:null,imageSrcSet:null,inert:Pr,inputMode:null,integrity:null,is:null,isMap:Pr,itemId:null,itemProp:ds,itemRef:ds,itemScope:Pr,itemType:ds,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pr,low:un,manifest:null,max:null,maxLength:un,media:null,method:null,min:null,minLength:un,multiple:Pr,muted:Pr,name:null,nonce:null,noModule:Pr,noValidate:Pr,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Pr,optimum:un,pattern:null,ping:ds,placeholder:null,playsInline:Pr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pr,referrerPolicy:null,rel:ds,required:Pr,reversed:Pr,rows:un,rowSpan:un,sandbox:ds,scope:null,scoped:Pr,seamless:Pr,selected:Pr,shadowRootClonable:Pr,shadowRootDelegatesFocus:Pr,shadowRootMode:null,shape:null,size:un,sizes:null,slot:null,span:un,spellCheck:Bo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:un,step:null,style:null,tabIndex:un,target:null,title:null,translate:null,type:null,typeMustMatch:Pr,useMap:null,value:Bo,width:un,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ds,axis:null,background:null,bgColor:null,border:un,borderColor:null,bottomMargin:un,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pr,declare:Pr,event:null,face:null,frame:null,frameBorder:null,hSpace:un,leftMargin:un,link:null,longDesc:null,lowSrc:null,marginHeight:un,marginWidth:un,noResize:Pr,noHref:Pr,noShade:Pr,noWrap:Pr,object:null,profile:null,prompt:null,rev:null,rightMargin:un,rules:null,scheme:null,scrolling:Bo,standby:null,summary:null,text:null,topMargin:un,valueType:null,version:null,vAlign:null,vLink:null,vSpace:un,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Pr,disableRemotePlayback:Pr,prefix:null,property:null,results:un,security:null,unselectable:null},space:"html",transform:I$}),ume=Py({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:$c,accentHeight:un,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:un,amplitude:un,arabicForm:null,ascent:un,attributeName:null,attributeType:null,azimuth:un,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:un,by:null,calcMode:null,capHeight:un,className:ds,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:un,diffuseConstant:un,direction:null,display:null,dur:null,divisor:un,dominantBaseline:null,download:Pr,dx:null,dy:null,edgeMode:null,editable:null,elevation:un,enableBackground:null,end:null,event:null,exponent:un,externalResourcesRequired:null,fill:null,fillOpacity:un,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:M1,g2:M1,glyphName:M1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:un,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:un,horizOriginX:un,horizOriginY:un,id:null,ideographic:un,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:un,k:un,k1:un,k2:un,k3:un,k4:un,kernelMatrix:$c,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:un,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:un,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:un,overlineThickness:un,paintOrder:null,panose1:null,path:null,pathLength:un,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ds,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:un,pointsAtY:un,pointsAtZ:un,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$c,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$c,rev:$c,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$c,requiredFeatures:$c,requiredFonts:$c,requiredFormats:$c,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:un,specularExponent:un,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:un,strikethroughThickness:un,string:null,stroke:null,strokeDashArray:$c,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:un,strokeOpacity:un,strokeWidth:null,style:null,surfaceScale:un,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$c,tabIndex:un,tableValues:null,target:null,targetX:un,targetY:un,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$c,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:un,underlineThickness:un,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:un,values:null,vAlphabetic:un,vMathematical:un,vectorEffect:null,vHanging:un,vIdeographic:un,version:null,vertAdvY:un,vertOriginX:un,vertOriginY:un,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:un,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:P$}),O$=Py({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),L$=Py({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I$}),j$=Py({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),dme={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fme=/[A-Z]/g,DO=/-[a-z]/g,hme=/^data[-\w.:]+$/i;function z$(t,e){const n=xS(e);let r=e,i=kc;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hme.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(DO,mme);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!DO.test(s)){let o=s.replace(fme,pme);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=d8}return new i(r,e)}function pme(t){return"-"+t.toLowerCase()}function mme(t){return t.charAt(1).toUpperCase()}const F$=k$([D$,cme,O$,L$,j$],"html"),WT=k$([D$,ume,O$,L$,j$],"svg");function PO(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function gme(t){return t.join(" ").trim()}var Dv={},yA,IO;function xme(){if(IO)return yA;IO=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
`,c="/",d="*",p="",m="comment",x="declaration";function b(S,w){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];w=w||{};var C=1,A=1;function N(Y){var $=Y.match(e);$&&(C+=$.length);var X=Y.lastIndexOf(l);A=~X?Y.length-X:A+Y.length}function D(){var Y={line:C,column:A};return function($){return $.position=new P(Y),L(),$}}function P(Y){this.start=Y,this.end={line:C,column:A},this.source=w.source}P.prototype.content=S;function O(Y){var $=new Error(w.source+":"+C+":"+A+": "+Y);if($.reason=Y,$.filename=w.source,$.line=C,$.column=A,$.source=S,!w.silent)throw $}function R(Y){var $=Y.exec(S);if($){var X=$[0];return N(X),S=S.slice(X.length),$}}function L(){R(n)}function V(Y){var $;for(Y=Y||[];$=F();)$!==!1&&Y.push($);return Y}function F(){var Y=D();if(!(c!=S.charAt(0)||d!=S.charAt(1))){for(var $=2;p!=S.charAt($)&&(d!=S.charAt($)||c!=S.charAt($+1));)++$;if($+=2,p===S.charAt($-1))return O("End of comment missing");var X=S.slice(2,$-2);return A+=2,N(X),S=S.slice($),A+=2,Y({type:m,comment:X})}}function U(){var Y=D(),$=R(r);if($){if(F(),!R(i))return O("property missing ':'");var X=R(s),Z=Y({type:x,property:_($[0].replace(t,p)),value:X?_(X[0].replace(t,p)):p});return R(o),Z}}function W(){var Y=[];V(Y);for(var $;$=U();)$!==!1&&(Y.push($),V(Y));return Y}return L(),W()}function _(S){return S?S.replace(a,p):p}return yA=b,yA}var OO;function vme(){if(OO)return Dv;OO=1;var t=Dv&&Dv.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dv,"__esModule",{value:!0}),Dv.default=n;const e=t(xme());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,e.default)(r),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;a?i(c,d,l):d&&(s=s||{},s[c]=d)}),s}return Dv}var Jb={},LO;function yme(){if(LO)return Jb;LO=1,Object.defineProperty(Jb,"__esModule",{value:!0}),Jb.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||t.test(c)},o=function(c,d){return d.toUpperCase()},a=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(e,o))};return Jb.camelCase=l,Jb}var e_,jO;function bme(){if(jO)return e_;jO=1;var t=e_&&e_.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(vme()),n=yme();function r(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,n.camelCase)(a,s)]=l)}),o}return r.default=r,e_=r,e_}var _me=bme();const Sme=xy(_me),U$=B$("end"),f8=B$("start");function B$(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function wme(t){const e=f8(t),n=U$(t);if(e&&n)return{start:e,end:n}}function O_(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?zO(t.position):"start"in t||"end"in t?zO(t):"line"in t||"column"in t?yR(t):""}function yR(t){return FO(t&&t.line)+":"+FO(t&&t.column)}function zO(t){return yR(t&&t.start)+"-"+yR(t&&t.end)}function FO(t){return t&&typeof t=="number"?t:1}class yl extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=O_(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yl.prototype.file="";yl.prototype.name="";yl.prototype.reason="";yl.prototype.message="";yl.prototype.stack="";yl.prototype.column=void 0;yl.prototype.line=void 0;yl.prototype.ancestors=void 0;yl.prototype.cause=void 0;yl.prototype.fatal=void 0;yl.prototype.place=void 0;yl.prototype.ruleId=void 0;yl.prototype.source=void 0;const h8={}.hasOwnProperty,Mme=new Map,Tme=/[A-Z]/g,Cme=new Set(["table","tbody","thead","tfoot","tr"]),Eme=new Set(["td","th"]),H$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Ame(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Lme(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Ome(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?WT:F$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=V$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function V$(t,e,n){if(e.type==="element")return Nme(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Rme(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Dme(t,e,n);if(e.type==="mdxjsEsm")return kme(t,e);if(e.type==="root")return Pme(t,e,n);if(e.type==="text")return Ime(t,e)}function Nme(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=WT,t.schema=i),t.ancestors.push(e);const s=W$(t,e.tagName,!1),o=jme(t,e);let a=m8(t,e);return Cme.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ame(l):!0})),G$(t,o,s,e),p8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function Rme(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}vS(t,e.position)}function kme(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);vS(t,e.position)}function Dme(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=WT,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:W$(t,e.name,!0),o=zme(t,e),a=m8(t,e);return G$(t,o,s,e),p8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function Pme(t,e,n){const r={};return p8(r,m8(t,e)),t.create(e,t.Fragment,r,n)}function Ime(t,e){return e.value}function G$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function p8(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Ome(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function Lme(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=f8(r);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function jme(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&h8.call(e.properties,i)){const s=Fme(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Eme.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function zme(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else vS(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else vS(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function m8(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:Mme;for(;++r<e.children.length;){const s=e.children[r];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=V$(t,s,o);a!==void 0&&n.push(a)}return n}function Fme(t,e,n){const r=z$(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?nme(n):gme(n)),r.property==="style"){let i=typeof n=="object"?n:Ume(t,String(n));return t.stylePropertyNameCase==="css"&&(i=Bme(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?dme[r.property]||r.property:r.attribute,n]}}function Ume(t,e){try{return Sme(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new yl("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=H$+"#cannot-parse-style-attribute",i}}function W$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=NO(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=NO(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return h8.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);vS(t)}function vS(t,e){const n=new yl("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=H$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Bme(t){const e={};let n;for(n in t)h8.call(t,n)&&(e[Hme(n)]=t[n]);return e}function Hme(t){let e=t.replace(Tme,Vme);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Vme(t){return"-"+t.toLowerCase()}const bA={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Gme={};function Wme(t,e){const n=Gme,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $$(t,r,i)}function $$(t,e,n){if($me(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return UO(t.children,e,n)}return Array.isArray(t)?UO(t,e,n):""}function UO(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=$$(t[i],e,n);return r.join("")}function $me(t){return!!(t&&typeof t=="object")}const BO=document.createElement("i");function g8(t){const e="&"+t+";";BO.innerHTML=e;const n=BO.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function lh(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function $u(t,e){return t.length>0?(lh(t,t.length,0,e),t):e}const HO={}.hasOwnProperty;function qme(t){const e={};let n=-1;for(;++n<t.length;)Xme(e,t[n]);return e}function Xme(t,e){let n;for(n in e){const i=(HO.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){HO.call(i,o)||(i[o]=[]);const a=s[o];Yme(i[o],Array.isArray(a)?a:a?[a]:[])}}}function Yme(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);lh(t,0,0,r)}function q$(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function T1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xf=_m(/[A-Za-z]/),Jc=_m(/[\dA-Za-z]/),Kme=_m(/[#-'*+\--9=?A-Z^-~]/);function bR(t){return t!==null&&(t<32||t===127)}const _R=_m(/\d/),Zme=_m(/[\dA-Fa-f]/),Qme=_m(/[!-/:-@[-`{-~]/);function Xn(t){return t!==null&&t<-2}function Nc(t){return t!==null&&(t<0||t===32)}function ki(t){return t===-2||t===-1||t===32}const Jme=_m(new RegExp("\\p{P}|\\p{S}","u")),ege=_m(/\s/);function _m(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Iy(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&Jc(t.charCodeAt(n+1))&&Jc(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Hi(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return ki(l)?(t.enter(n),a(l)):e(l)}function a(l){return ki(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const tge={tokenize:nge};function nge(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Hi(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Xn(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const rge={tokenize:ige},VO={tokenize:sge};function ige(t){const e=this,n=[];let r=0,i,s,o;return a;function a(A){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,l,c)(A)}return c(A)}function l(A){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const N=e.events.length;let D=N,P;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){P=e.events[D][1].end;break}w(r);let O=N;for(;O<e.events.length;)e.events[O][1].end={...P},O++;return lh(e.events,D+1,0,e.events.slice(N)),e.events.length=O,c(A)}return a(A)}function c(A){if(r===n.length){if(!i)return m(A);if(i.currentConstruct&&i.currentConstruct.concrete)return b(A);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(VO,d,p)(A)}function d(A){return i&&C(),w(r),m(A)}function p(A){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,b(A)}function m(A){return e.containerState={},t.attempt(VO,x,b)(A)}function x(A){return r++,n.push([e.currentConstruct,e.containerState]),m(A)}function b(A){if(A===null){i&&C(),w(0),t.consume(A);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),_(A)}function _(A){if(A===null){S(t.exit("chunkFlow"),!0),w(0),t.consume(A);return}return Xn(A)?(t.consume(A),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(A),_)}function S(A,N){const D=e.sliceStream(A);if(N&&D.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(D),e.parser.lazy[A.start.line]){let P=i.events.length;for(;P--;)if(i.events[P][1].start.offset<o&&(!i.events[P][1].end||i.events[P][1].end.offset>o))return;const O=e.events.length;let R=O,L,V;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(L){V=e.events[R][1].end;break}L=!0}for(w(r),P=O;P<e.events.length;)e.events[P][1].end={...V},P++;lh(e.events,R+1,0,e.events.slice(O)),e.events.length=P}}function w(A){let N=n.length;for(;N-- >A;){const D=n[N];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function C(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function sge(t,e,n){return Hi(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function GO(t){if(t===null||Nc(t)||ege(t))return 1;if(Jme(t))return 2}function x8(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const SR={name:"attention",resolveAll:oge,tokenize:age};function oge(t,e){let n=-1,r,i,s,o,a,l,c,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},m={...t[n][1].start};WO(p,-l),WO(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:m},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=$u(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=$u(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=$u(c,x8(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=$u(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,c=$u(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,lh(t,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function age(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=GO(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),d=GO(l),p=!d||d===2&&i||n.includes(l),m=!i||i===2&&d||n.includes(r);return c._open=!!(s===42?p:p&&(i||!m)),c._close=!!(s===42?m:m&&(d||!p)),e(l)}}function WO(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const lge={name:"autolink",tokenize:cge};function cge(t,e,n){let r=0;return i;function i(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(x){return Xf(x)?(t.consume(x),o):x===64?n(x):c(x)}function o(x){return x===43||x===45||x===46||Jc(x)?(r=1,a(x)):c(x)}function a(x){return x===58?(t.consume(x),r=0,l):(x===43||x===45||x===46||Jc(x))&&r++<32?(t.consume(x),a):(r=0,c(x))}function l(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):x===null||x===32||x===60||bR(x)?n(x):(t.consume(x),l)}function c(x){return x===64?(t.consume(x),d):Kme(x)?(t.consume(x),c):n(x)}function d(x){return Jc(x)?p(x):n(x)}function p(x){return x===46?(t.consume(x),r=0,d):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):m(x)}function m(x){if((x===45||Jc(x))&&r++<63){const b=x===45?m:p;return t.consume(x),b}return n(x)}}const $T={partial:!0,tokenize:uge};function uge(t,e,n){return r;function r(s){return ki(s)?Hi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Xn(s)?e(s):n(s)}}const X$={continuation:{tokenize:fge},exit:hge,name:"blockQuote",tokenize:dge};function dge(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return ki(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function fge(t,e,n){const r=this;return i;function i(o){return ki(o)?Hi(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(X$,e,n)(o)}}function hge(t){t.exit("blockQuote")}const Y$={name:"characterEscape",tokenize:pge};function pge(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return Qme(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const K$={name:"characterReference",tokenize:mge};function mge(t,e,n){const r=this;let i=0,s,o;return a;function a(p){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),l}function l(p){return p===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(p),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=Jc,d(p))}function c(p){return p===88||p===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(p),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Zme,d):(t.enter("characterReferenceValue"),s=7,o=_R,d(p))}function d(p){if(p===59&&i){const m=t.exit("characterReferenceValue");return o===Jc&&!g8(r.sliceSerialize(m))?n(p):(t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(p)&&i++<s?(t.consume(p),d):n(p)}}const $O={partial:!0,tokenize:xge},qO={concrete:!0,name:"codeFenced",tokenize:gge};function gge(t,e,n){const r=this,i={partial:!0,tokenize:D};let s=0,o=0,a;return l;function l(P){return c(P)}function c(P){const O=r.events[r.events.length-1];return s=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=P,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(P)}function d(P){return P===a?(o++,t.consume(P),d):o<3?n(P):(t.exit("codeFencedFenceSequence"),ki(P)?Hi(t,p,"whitespace")(P):p(P))}function p(P){return P===null||Xn(P)?(t.exit("codeFencedFence"),r.interrupt?e(P):t.check($O,_,N)(P)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(P))}function m(P){return P===null||Xn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),p(P)):ki(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Hi(t,x,"whitespace")(P)):P===96&&P===a?n(P):(t.consume(P),m)}function x(P){return P===null||Xn(P)?p(P):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(P))}function b(P){return P===null||Xn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),p(P)):P===96&&P===a?n(P):(t.consume(P),b)}function _(P){return t.attempt(i,N,S)(P)}function S(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),w}function w(P){return s>0&&ki(P)?Hi(t,C,"linePrefix",s+1)(P):C(P)}function C(P){return P===null||Xn(P)?t.check($O,_,N)(P):(t.enter("codeFlowValue"),A(P))}function A(P){return P===null||Xn(P)?(t.exit("codeFlowValue"),C(P)):(t.consume(P),A)}function N(P){return t.exit("codeFenced"),e(P)}function D(P,O,R){let L=0;return V;function V($){return P.enter("lineEnding"),P.consume($),P.exit("lineEnding"),F}function F($){return P.enter("codeFencedFence"),ki($)?Hi(P,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):U($)}function U($){return $===a?(P.enter("codeFencedFenceSequence"),W($)):R($)}function W($){return $===a?(L++,P.consume($),W):L>=o?(P.exit("codeFencedFenceSequence"),ki($)?Hi(P,Y,"whitespace")($):Y($)):R($)}function Y($){return $===null||Xn($)?(P.exit("codeFencedFence"),O($)):R($)}}}function xge(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const _A={name:"codeIndented",tokenize:yge},vge={partial:!0,tokenize:bge};function yge(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Hi(t,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Xn(c)?t.attempt(vge,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Xn(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function bge(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Xn(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Hi(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Xn(o)?i(o):n(o)}}const _ge={name:"codeText",previous:wge,resolve:Sge,tokenize:Mge};function Sge(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function wge(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Mge(t,e,n){let r=0,i,s;return o;function o(p){return t.enter("codeText"),t.enter("codeTextSequence"),a(p)}function a(p){return p===96?(t.consume(p),r++,a):(t.exit("codeTextSequence"),l(p))}function l(p){return p===null?n(p):p===32?(t.enter("space"),t.consume(p),t.exit("space"),l):p===96?(s=t.enter("codeTextSequence"),i=0,d(p)):Xn(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||Xn(p)?(t.exit("codeTextData"),l(p)):(t.consume(p),c)}function d(p){return p===96?(t.consume(p),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(s.type="codeTextData",c(p))}}class Tge{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&t_(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),t_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),t_(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);t_(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);t_(this.left,n.reverse())}}}function t_(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Z$(t){const e={};let n=-1,r,i,s,o,a,l,c;const d=new Tge(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Cge(d,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return lh(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Cge(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let d,p,m=-1,x=n,b=0,_=0;const S=[_];for(;x;){for(;t.get(++i)[1]!==x;);s.push(i),x._tokenizer||(d=r.sliceStream(x),x.next||d.push(null),p&&o.defineSkip(x.start),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=x,x=x.next}for(x=n;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(_=m+1,S.push(_),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(o.events=[],x?(x._tokenizer=void 0,x.previous=void 0):S.pop(),m=S.length;m--;){const w=a.slice(S[m],S[m+1]),C=s.pop();l.push([C,C+w.length-1]),t.splice(C,2,w)}for(l.reverse(),m=-1;++m<l.length;)c[b+l[m][0]]=b+l[m][1],b+=l[m][1]-l[m][0]-1;return c}const Ege={resolve:Nge,tokenize:Rge},Age={partial:!0,tokenize:kge};function Nge(t){return Z$(t),t}function Rge(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Xn(a)?t.check(Age,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function kge(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Hi(t,s,"linePrefix")}function s(o){if(o===null||Xn(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function Q$(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return p;function p(w){return w===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(w),t.exit(s),m):w===null||w===32||w===41||bR(w)?n(w):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(w))}function m(w){return w===62?(t.enter(s),t.consume(w),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===62?(t.exit("chunkString"),t.exit(a),m(w)):w===null||w===60||Xn(w)?n(w):(t.consume(w),w===92?b:x)}function b(w){return w===60||w===62||w===92?(t.consume(w),x):x(w)}function _(w){return!d&&(w===null||w===41||Nc(w))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(w)):d<c&&w===40?(t.consume(w),d++,_):w===41?(t.consume(w),d--,_):w===null||w===32||w===40||bR(w)?n(w):(t.consume(w),w===92?S:_)}function S(w){return w===40||w===41||w===92?(t.consume(w),_):_(w)}}function J$(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(x){return t.enter(r),t.enter(i),t.consume(x),t.exit(i),t.enter(s),d}function d(x){return a>999||x===null||x===91||x===93&&!l||x===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(x):x===93?(t.exit(s),t.enter(i),t.consume(x),t.exit(i),t.exit(r),e):Xn(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||x===91||x===93||Xn(x)||a++>999?(t.exit("chunkString"),d(x)):(t.consume(x),l||(l=!ki(x)),x===92?m:p)}function m(x){return x===91||x===92||x===93?(t.consume(x),a++,p):p(x)}}function eq(t,e,n,r,i,s){let o;return a;function a(m){return m===34||m===39||m===40?(t.enter(r),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):n(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):(t.enter(s),c(m))}function c(m){return m===o?(t.exit(s),l(o)):m===null?n(m):Xn(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Hi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Xn(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?p:d)}function p(m){return m===o||m===92?(t.consume(m),d):d(m)}}function L_(t,e){let n;return r;function r(i){return Xn(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ki(i)?Hi(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Dge={name:"definition",tokenize:Ige},Pge={partial:!0,tokenize:Oge};function Ige(t,e,n){const r=this;let i;return s;function s(x){return t.enter("definition"),o(x)}function o(x){return J$.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function a(x){return i=T1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),l):n(x)}function l(x){return Nc(x)?L_(t,c)(x):c(x)}function c(x){return Q$(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function d(x){return t.attempt(Pge,p,p)(x)}function p(x){return ki(x)?Hi(t,m,"whitespace")(x):m(x)}function m(x){return x===null||Xn(x)?(t.exit("definition"),r.parser.defined.push(i),e(x)):n(x)}}function Oge(t,e,n){return r;function r(a){return Nc(a)?L_(t,i)(a):n(a)}function i(a){return eq(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return ki(a)?Hi(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Xn(a)?e(a):n(a)}}const Lge={name:"hardBreakEscape",tokenize:jge};function jge(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Xn(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const zge={name:"headingAtx",resolve:Fge,tokenize:Uge};function Fge(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},lh(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Uge(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||Nc(d)?(t.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||Xn(d)?(t.exit("atxHeading"),e(d)):ki(d)?Hi(t,a,"whitespace")(d):(t.enter("atxHeadingText"),c(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||Nc(d)?(t.exit("atxHeadingText"),a(d)):(t.consume(d),c)}}const Bge=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],XO=["pre","script","style","textarea"],Hge={concrete:!0,name:"htmlFlow",resolveTo:Wge,tokenize:$ge},Vge={partial:!0,tokenize:Xge},Gge={partial:!0,tokenize:qge};function Wge(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function $ge(t,e,n){const r=this;let i,s,o,a,l;return c;function c(j){return d(j)}function d(j){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(j),p}function p(j){return j===33?(t.consume(j),m):j===47?(t.consume(j),s=!0,_):j===63?(t.consume(j),i=3,r.interrupt?e:H):Xf(j)?(t.consume(j),o=String.fromCharCode(j),S):n(j)}function m(j){return j===45?(t.consume(j),i=2,x):j===91?(t.consume(j),i=5,a=0,b):Xf(j)?(t.consume(j),i=4,r.interrupt?e:H):n(j)}function x(j){return j===45?(t.consume(j),r.interrupt?e:H):n(j)}function b(j){const ie="CDATA[";return j===ie.charCodeAt(a++)?(t.consume(j),a===ie.length?r.interrupt?e:U:b):n(j)}function _(j){return Xf(j)?(t.consume(j),o=String.fromCharCode(j),S):n(j)}function S(j){if(j===null||j===47||j===62||Nc(j)){const ie=j===47,ce=o.toLowerCase();return!ie&&!s&&XO.includes(ce)?(i=1,r.interrupt?e(j):U(j)):Bge.includes(o.toLowerCase())?(i=6,ie?(t.consume(j),w):r.interrupt?e(j):U(j)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):s?C(j):A(j))}return j===45||Jc(j)?(t.consume(j),o+=String.fromCharCode(j),S):n(j)}function w(j){return j===62?(t.consume(j),r.interrupt?e:U):n(j)}function C(j){return ki(j)?(t.consume(j),C):V(j)}function A(j){return j===47?(t.consume(j),V):j===58||j===95||Xf(j)?(t.consume(j),N):ki(j)?(t.consume(j),A):V(j)}function N(j){return j===45||j===46||j===58||j===95||Jc(j)?(t.consume(j),N):D(j)}function D(j){return j===61?(t.consume(j),P):ki(j)?(t.consume(j),D):A(j)}function P(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),l=j,O):ki(j)?(t.consume(j),P):R(j)}function O(j){return j===l?(t.consume(j),l=null,L):j===null||Xn(j)?n(j):(t.consume(j),O)}function R(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Nc(j)?D(j):(t.consume(j),R)}function L(j){return j===47||j===62||ki(j)?A(j):n(j)}function V(j){return j===62?(t.consume(j),F):n(j)}function F(j){return j===null||Xn(j)?U(j):ki(j)?(t.consume(j),F):n(j)}function U(j){return j===45&&i===2?(t.consume(j),X):j===60&&i===1?(t.consume(j),Z):j===62&&i===4?(t.consume(j),B):j===63&&i===3?(t.consume(j),H):j===93&&i===5?(t.consume(j),ne):Xn(j)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Vge,G,W)(j)):j===null||Xn(j)?(t.exit("htmlFlowData"),W(j)):(t.consume(j),U)}function W(j){return t.check(Gge,Y,G)(j)}function Y(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),$}function $(j){return j===null||Xn(j)?W(j):(t.enter("htmlFlowData"),U(j))}function X(j){return j===45?(t.consume(j),H):U(j)}function Z(j){return j===47?(t.consume(j),o="",K):U(j)}function K(j){if(j===62){const ie=o.toLowerCase();return XO.includes(ie)?(t.consume(j),B):U(j)}return Xf(j)&&o.length<8?(t.consume(j),o+=String.fromCharCode(j),K):U(j)}function ne(j){return j===93?(t.consume(j),H):U(j)}function H(j){return j===62?(t.consume(j),B):j===45&&i===2?(t.consume(j),H):U(j)}function B(j){return j===null||Xn(j)?(t.exit("htmlFlowData"),G(j)):(t.consume(j),B)}function G(j){return t.exit("htmlFlow"),e(j)}}function qge(t,e,n){const r=this;return i;function i(o){return Xn(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Xge(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt($T,e,n)}}const Yge={name:"htmlText",tokenize:Kge};function Kge(t,e,n){const r=this;let i,s,o;return a;function a(H){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(H),l}function l(H){return H===33?(t.consume(H),c):H===47?(t.consume(H),D):H===63?(t.consume(H),A):Xf(H)?(t.consume(H),R):n(H)}function c(H){return H===45?(t.consume(H),d):H===91?(t.consume(H),s=0,b):Xf(H)?(t.consume(H),C):n(H)}function d(H){return H===45?(t.consume(H),x):n(H)}function p(H){return H===null?n(H):H===45?(t.consume(H),m):Xn(H)?(o=p,Z(H)):(t.consume(H),p)}function m(H){return H===45?(t.consume(H),x):p(H)}function x(H){return H===62?X(H):H===45?m(H):p(H)}function b(H){const B="CDATA[";return H===B.charCodeAt(s++)?(t.consume(H),s===B.length?_:b):n(H)}function _(H){return H===null?n(H):H===93?(t.consume(H),S):Xn(H)?(o=_,Z(H)):(t.consume(H),_)}function S(H){return H===93?(t.consume(H),w):_(H)}function w(H){return H===62?X(H):H===93?(t.consume(H),w):_(H)}function C(H){return H===null||H===62?X(H):Xn(H)?(o=C,Z(H)):(t.consume(H),C)}function A(H){return H===null?n(H):H===63?(t.consume(H),N):Xn(H)?(o=A,Z(H)):(t.consume(H),A)}function N(H){return H===62?X(H):A(H)}function D(H){return Xf(H)?(t.consume(H),P):n(H)}function P(H){return H===45||Jc(H)?(t.consume(H),P):O(H)}function O(H){return Xn(H)?(o=O,Z(H)):ki(H)?(t.consume(H),O):X(H)}function R(H){return H===45||Jc(H)?(t.consume(H),R):H===47||H===62||Nc(H)?L(H):n(H)}function L(H){return H===47?(t.consume(H),X):H===58||H===95||Xf(H)?(t.consume(H),V):Xn(H)?(o=L,Z(H)):ki(H)?(t.consume(H),L):X(H)}function V(H){return H===45||H===46||H===58||H===95||Jc(H)?(t.consume(H),V):F(H)}function F(H){return H===61?(t.consume(H),U):Xn(H)?(o=F,Z(H)):ki(H)?(t.consume(H),F):L(H)}function U(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),i=H,W):Xn(H)?(o=U,Z(H)):ki(H)?(t.consume(H),U):(t.consume(H),Y)}function W(H){return H===i?(t.consume(H),i=void 0,$):H===null?n(H):Xn(H)?(o=W,Z(H)):(t.consume(H),W)}function Y(H){return H===null||H===34||H===39||H===60||H===61||H===96?n(H):H===47||H===62||Nc(H)?L(H):(t.consume(H),Y)}function $(H){return H===47||H===62||Nc(H)?L(H):n(H)}function X(H){return H===62?(t.consume(H),t.exit("htmlTextData"),t.exit("htmlText"),e):n(H)}function Z(H){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),K}function K(H){return ki(H)?Hi(t,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):ne(H)}function ne(H){return t.enter("htmlTextData"),o(H)}}const v8={name:"labelEnd",resolveAll:exe,resolveTo:txe,tokenize:nxe},Zge={tokenize:rxe},Qge={tokenize:ixe},Jge={tokenize:sxe};function exe(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&lh(t,0,t.length,n),t}function txe(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=$u(a,t.slice(s+1,s+r+3)),a=$u(a,[["enter",d,e]]),a=$u(a,x8(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=$u(a,[["exit",d,e],t[o-2],t[o-1],["exit",c,e]]),a=$u(a,t.slice(o+1)),a=$u(a,[["exit",l,e]]),lh(t,s,t.length,a),t}function nxe(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(m){return s?s._inactive?p(m):(o=r.parser.defined.includes(T1(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):n(m)}function l(m){return m===40?t.attempt(Zge,d,o?d:p)(m):m===91?t.attempt(Qge,d,o?c:p)(m):o?d(m):p(m)}function c(m){return t.attempt(Jge,d,p)(m)}function d(m){return e(m)}function p(m){return s._balanced=!0,n(m)}}function rxe(t,e,n){return r;function r(p){return t.enter("resource"),t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),i}function i(p){return Nc(p)?L_(t,s)(p):s(p)}function s(p){return p===41?d(p):Q$(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Nc(p)?L_(t,l)(p):d(p)}function a(p){return n(p)}function l(p){return p===34||p===39||p===40?eq(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):d(p)}function c(p){return Nc(p)?L_(t,d)(p):d(p)}function d(p){return p===41?(t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),t.exit("resource"),e):n(p)}}function ixe(t,e,n){const r=this;return i;function i(a){return J$.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(T1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function sxe(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const oxe={name:"labelStartImage",resolveAll:v8.resolveAll,tokenize:axe};function axe(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const lxe={name:"labelStartLink",resolveAll:v8.resolveAll,tokenize:cxe};function cxe(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const SA={name:"lineEnding",tokenize:uxe};function uxe(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Hi(t,e,"linePrefix")}}const HM={name:"thematicBreak",tokenize:dxe};function dxe(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Xn(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),ki(c)?Hi(t,a,"whitespace")(c):a(c))}}const bc={continuation:{tokenize:mxe},exit:xxe,name:"list",tokenize:pxe},fxe={partial:!0,tokenize:vxe},hxe={partial:!0,tokenize:gxe};function pxe(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(x){const b=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:_R(x)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(HM,n,c)(x):c(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(x)}return n(x)}function l(x){return _R(x)&&++o<10?(t.consume(x),l):(!r.interrupt||o<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),c(x)):n(x)}function c(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check($T,r.interrupt?n:d,t.attempt(fxe,m,p))}function d(x){return r.containerState.initialBlankLine=!0,s++,m(x)}function p(x){return ki(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),m):n(x)}function m(x){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function mxe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check($T,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Hi(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!ki(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(hxe,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Hi(t,t.attempt(bc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gxe(t,e,n){const r=this;return Hi(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function xxe(t){t.exit(this.containerState.type)}function vxe(t,e,n){const r=this;return Hi(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ki(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const YO={name:"setextUnderline",resolveTo:yxe,tokenize:bxe};function yxe(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function bxe(t,e,n){const r=this;let i;return s;function s(c){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),ki(c)?Hi(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Xn(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const _xe={tokenize:Sxe};function Sxe(t){const e=this,n=t.attempt($T,r,t.attempt(this.parser.constructs.flowInitial,i,Hi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Ege,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const wxe={resolveAll:nq()},Mxe=tq("string"),Txe=tq("text");function tq(t){return{resolveAll:nq(t==="text"?Cxe:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(d){return c(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const p=i[d];let m=-1;if(p)for(;++m<p.length;){const x=p[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function nq(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function Cxe(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const Exe={42:bc,43:bc,45:bc,48:bc,49:bc,50:bc,51:bc,52:bc,53:bc,54:bc,55:bc,56:bc,57:bc,62:X$},Axe={91:Dge},Nxe={[-2]:_A,[-1]:_A,32:_A},Rxe={35:zge,42:HM,45:[YO,HM],60:Hge,61:YO,95:HM,96:qO,126:qO},kxe={38:K$,92:Y$},Dxe={[-5]:SA,[-4]:SA,[-3]:SA,33:oxe,38:K$,42:SR,60:[lge,Yge],91:lxe,92:[Lge,Y$],93:v8,95:SR,96:_ge},Pxe={null:[SR,wxe]},Ixe={null:[42,95]},Oxe={null:[]},Lxe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ixe,contentInitial:Axe,disable:Oxe,document:Exe,flow:Rxe,flowInitial:Nxe,insideSpan:Pxe,string:kxe,text:Dxe},Symbol.toStringTag,{value:"Module"}));function jxe(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:O(D),check:O(P),consume:C,enter:A,exit:N,interrupt:O(P,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:b,parser:t,previous:null,sliceSerialize:m,sliceStream:x,write:p};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function p(F){return o=$u(o,F),S(),o[o.length-1]!==null?[]:(R(e,0),c.events=x8(s,c.events,c),c.events)}function m(F,U){return Fxe(x(F),U)}function x(F){return zxe(o,F)}function b(){const{_bufferIndex:F,_index:U,line:W,column:Y,offset:$}=r;return{_bufferIndex:F,_index:U,line:W,column:Y,offset:$}}function _(F){i[F.line]=F.column,V()}function S(){let F;for(;r._index<o.length;){const U=o[r._index];if(typeof U=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<U.length;)w(U.charCodeAt(r._bufferIndex));else w(U)}}function w(F){d=d(F)}function C(F){Xn(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,V()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function A(F,U){const W=U||{};return W.type=F,W.start=b(),c.events.push(["enter",W,c]),a.push(W),W}function N(F){const U=a.pop();return U.end=b(),c.events.push(["exit",U,c]),U}function D(F,U){R(F,U.from)}function P(F,U){U.restore()}function O(F,U){return W;function W(Y,$,X){let Z,K,ne,H;return Array.isArray(Y)?G(Y):"tokenize"in Y?G([Y]):B(Y);function B(te){return se;function se(le){const re=le!==null&&te[le],pe=le!==null&&te.null,be=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return G(be)(le)}}function G(te){return Z=te,K=0,te.length===0?X:j(te[K])}function j(te){return se;function se(le){return H=L(),ne=te,te.partial||(c.currentConstruct=te),te.name&&c.parser.constructs.disable.null.includes(te.name)?ce():te.tokenize.call(U?Object.assign(Object.create(c),U):c,l,ie,ce)(le)}}function ie(te){return F(ne,H),$}function ce(te){return H.restore(),++K<Z.length?j(Z[K]):X}}}function R(F,U){F.resolveAll&&!s.includes(F)&&s.push(F),F.resolve&&lh(c.events,U,c.events.length-U,F.resolve(c.events.slice(U),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function L(){const F=b(),U=c.previous,W=c.currentConstruct,Y=c.events.length,$=Array.from(a);return{from:Y,restore:X};function X(){r=F,c.previous=U,c.currentConstruct=W,c.events.length=Y,a=$,V()}}function V(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function zxe(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Fxe(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=e?" ":"	";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function Uxe(t){const r={constructs:qme([Lxe,...(t||{}).extensions||[]]),content:i(tge),defined:[],document:i(rge),flow:i(_xe),lazy:{},string:i(Mxe),text:i(Txe)};return r;function i(s){return o;function o(a){return jxe(r,s,a)}}}function Bxe(t){for(;!Z$(t););return t}const KO=/[\0\t\n\r]/g;function Hxe(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,d,p,m,x;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),p=0,e="",n&&(s.charCodeAt(0)===65279&&p++,n=void 0);p<s.length;){if(KO.lastIndex=p,c=KO.exec(s),m=c&&c.index!==void 0?c.index:s.length,x=s.charCodeAt(m),!c){e=s.slice(p);break}if(x===10&&p===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),p<m&&(l.push(s.slice(p,m)),t+=m-p),x){case 0:{l.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,l.push(-2);t++<d;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}p=m+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const Vxe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Gxe(t){return t.replace(Vxe,Wxe)}function Wxe(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return q$(n.slice(s?2:1),s?16:10)}return g8(n)||t}const rq={}.hasOwnProperty;function $xe(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),qxe(n)(Bxe(Uxe(n).document().write(Hxe()(t,e,!0))))}function qxe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(_e),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(ke),blockQuote:s(pe),characterEscape:L,characterReference:L,codeFenced:s(be),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(be,o),codeText:s(xe,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(Pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(me),hardBreakEscape:s(we),hardBreakTrailing:s(we),htmlFlow:s(Te,o),htmlFlowData:L,htmlText:s(Te,o),htmlTextData:L,image:s(oe),label:o,link:s(_e),listItem:s(Ue),listItemValue:m,listOrdered:s(Fe,p),listUnordered:s(Fe),paragraph:s(Oe),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(ke),strong:s(ue),thematicBreak:s(fe)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:re,autolinkProtocol:le,blockQuote:l(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:te,characterReference:se,codeFenced:l(S),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:b,codeFlowValue:V,codeIndented:l(w),codeText:l($),codeTextData:V,data:V,definition:l(),definitionDestinationString:N,definitionLabelString:C,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(U),hardBreakTrailing:l(U),htmlFlow:l(W),htmlFlowData:V,htmlText:l(Y),htmlTextData:V,image:l(Z),label:ne,labelText:K,lineEnding:F,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ie,resourceDestinationString:H,resourceTitleString:B,resource:G,setextHeading:l(R),setextHeadingLineSequence:O,setextHeadingText:P,strong:l(),thematicBreak:l()}};iq(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(Se){let Ae={type:"root",children:[]};const ve={stack:[Ae],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:d,data:n},qe=[];let Ee=-1;for(;++Ee<Se.length;)if(Se[Ee][1].type==="listOrdered"||Se[Ee][1].type==="listUnordered")if(Se[Ee][0]==="enter")qe.push(Ee);else{const Ce=qe.pop();Ee=i(Se,Ce,Ee)}for(Ee=-1;++Ee<Se.length;){const Ce=e[Se[Ee][0]];rq.call(Ce,Se[Ee][1].type)&&Ce[Se[Ee][1].type].call(Object.assign({sliceSerialize:Se[Ee][2].sliceSerialize},ve),Se[Ee][1])}if(ve.tokenStack.length>0){const Ce=ve.tokenStack[ve.tokenStack.length-1];(Ce[1]||ZO).call(ve,void 0,Ce[0])}for(Ae.position={start:x0(Se.length>0?Se[0][1].start:{line:1,column:1,offset:0}),end:x0(Se.length>0?Se[Se.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<e.transforms.length;)Ae=e.transforms[Ee](Ae)||Ae;return Ae}function i(Se,Ae,ve){let qe=Ae-1,Ee=-1,Ce=!1,Ye,Ze,it,ut;for(;++qe<=ve;){const De=Se[qe];switch(De[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{De[0]==="enter"?Ee++:Ee--,ut=void 0;break}case"lineEndingBlank":{De[0]==="enter"&&(Ye&&!ut&&!Ee&&!it&&(it=qe),ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ut=void 0}if(!Ee&&De[0]==="enter"&&De[1].type==="listItemPrefix"||Ee===-1&&De[0]==="exit"&&(De[1].type==="listUnordered"||De[1].type==="listOrdered")){if(Ye){let Ve=qe;for(Ze=void 0;Ve--;){const lt=Se[Ve];if(lt[1].type==="lineEnding"||lt[1].type==="lineEndingBlank"){if(lt[0]==="exit")continue;Ze&&(Se[Ze][1].type="lineEndingBlank",Ce=!0),lt[1].type="lineEnding",Ze=Ve}else if(!(lt[1].type==="linePrefix"||lt[1].type==="blockQuotePrefix"||lt[1].type==="blockQuotePrefixWhitespace"||lt[1].type==="blockQuoteMarker"||lt[1].type==="listItemIndent"))break}it&&(!Ze||it<Ze)&&(Ye._spread=!0),Ye.end=Object.assign({},Ze?Se[Ze][1].start:De[1].end),Se.splice(Ze||qe,0,["exit",Ye,De[2]]),qe++,ve++}if(De[1].type==="listItemPrefix"){const Ve={type:"listItem",_spread:!1,start:Object.assign({},De[1].start),end:void 0};Ye=Ve,Se.splice(qe,0,["enter",Ve,De[2]]),qe++,ve++,it=void 0,ut=!0}}}return Se[Ae][1]._spread=Ce,ve}function s(Se,Ae){return ve;function ve(qe){a.call(this,Se(qe),qe),Ae&&Ae.call(this,qe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(Se,Ae,ve){this.stack[this.stack.length-1].children.push(Se),this.stack.push(Se),this.tokenStack.push([Ae,ve||void 0]),Se.position={start:x0(Ae.start),end:void 0}}function l(Se){return Ae;function Ae(ve){Se&&Se.call(this,ve),c.call(this,ve)}}function c(Se,Ae){const ve=this.stack.pop(),qe=this.tokenStack.pop();if(qe)qe[0].type!==Se.type&&(Ae?Ae.call(this,Se,qe[0]):(qe[1]||ZO).call(this,Se,qe[0]));else throw new Error("Cannot close `"+Se.type+"` ("+O_({start:Se.start,end:Se.end})+"): it’s not open");ve.position.end=x0(Se.end)}function d(){return Wme(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(Se){if(this.data.expectingFirstListItemValue){const Ae=this.stack[this.stack.length-2];Ae.start=Number.parseInt(this.sliceSerialize(Se),10),this.data.expectingFirstListItemValue=void 0}}function x(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.lang=Se}function b(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.meta=Se}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=Se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=Se.replace(/(\r?\n|\r)$/g,"")}function C(Se){const Ae=this.resume(),ve=this.stack[this.stack.length-1];ve.label=Ae,ve.identifier=T1(this.sliceSerialize(Se)).toLowerCase()}function A(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=Se}function N(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=Se}function D(Se){const Ae=this.stack[this.stack.length-1];if(!Ae.depth){const ve=this.sliceSerialize(Se).length;Ae.depth=ve}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function O(Se){const Ae=this.stack[this.stack.length-1];Ae.depth=this.sliceSerialize(Se).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function L(Se){const ve=this.stack[this.stack.length-1].children;let qe=ve[ve.length-1];(!qe||qe.type!=="text")&&(qe=Q(),qe.position={start:x0(Se.start),end:void 0},ve.push(qe)),this.stack.push(qe)}function V(Se){const Ae=this.stack.pop();Ae.value+=this.sliceSerialize(Se),Ae.position.end=x0(Se.end)}function F(Se){const Ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=Ae.children[Ae.children.length-1];ve.position.end=x0(Se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ae.type)&&(L.call(this,Se),V.call(this,Se))}function U(){this.data.atHardBreak=!0}function W(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=Se}function Y(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=Se}function $(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=Se}function X(){const Se=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";Se.type+="Reference",Se.referenceType=Ae,delete Se.url,delete Se.title}else delete Se.identifier,delete Se.label;this.data.referenceType=void 0}function Z(){const Se=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";Se.type+="Reference",Se.referenceType=Ae,delete Se.url,delete Se.title}else delete Se.identifier,delete Se.label;this.data.referenceType=void 0}function K(Se){const Ae=this.sliceSerialize(Se),ve=this.stack[this.stack.length-2];ve.label=Gxe(Ae),ve.identifier=T1(Ae).toLowerCase()}function ne(){const Se=this.stack[this.stack.length-1],Ae=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const qe=Se.children;ve.children=qe}else ve.alt=Ae}function H(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=Se}function B(){const Se=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=Se}function G(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function ie(Se){const Ae=this.resume(),ve=this.stack[this.stack.length-1];ve.label=Ae,ve.identifier=T1(this.sliceSerialize(Se)).toLowerCase(),this.data.referenceType="full"}function ce(Se){this.data.characterReferenceType=Se.type}function te(Se){const Ae=this.sliceSerialize(Se),ve=this.data.characterReferenceType;let qe;ve?(qe=q$(Ae,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):qe=g8(Ae);const Ee=this.stack[this.stack.length-1];Ee.value+=qe}function se(Se){const Ae=this.stack.pop();Ae.position.end=x0(Se.end)}function le(Se){V.call(this,Se);const Ae=this.stack[this.stack.length-1];Ae.url=this.sliceSerialize(Se)}function re(Se){V.call(this,Se);const Ae=this.stack[this.stack.length-1];Ae.url="mailto:"+this.sliceSerialize(Se)}function pe(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function Pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function ke(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function Te(){return{type:"html",value:""}}function oe(){return{type:"image",title:null,url:"",alt:null}}function _e(){return{type:"link",title:null,url:"",children:[]}}function Fe(Se){return{type:"list",ordered:Se.type==="listOrdered",start:null,spread:Se._spread,children:[]}}function Ue(Se){return{type:"listItem",spread:Se._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function ue(){return{type:"strong",children:[]}}function Q(){return{type:"text",value:""}}function fe(){return{type:"thematicBreak"}}}function x0(t){return{line:t.line,column:t.column,offset:t.offset}}function iq(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?iq(t,r):Xxe(t,r)}}function Xxe(t,e){let n;for(n in e)if(rq.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function ZO(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+O_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+O_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+O_({start:e.start,end:e.end})+") is still open")}function Yxe(t){const e=this;e.parser=n;function n(r){return $xe(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Kxe(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function Zxe(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Qxe(t,e){const n=e.value?e.value+`
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Jxe(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function eve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function tve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Iy(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function nve(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function rve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function sq(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function ive(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return sq(t,e);const i={src:Iy(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function sve(t,e){const n={src:Iy(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function ove(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function ave(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return sq(t,e);const i={href:Iy(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function lve(t,e){const n={href:Iy(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function cve(t,e,n){const r=t.all(e),i=n?uve(n):oq(e),s={},o=[];if(typeof e.checked=="boolean"){const d=r[0];let p;d&&d.type==="element"&&d.tagName==="p"?p=d:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(i||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function uve(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=oq(n[r])}return e}function oq(t){const e=t.spread;return e??t.children.length>1}function dve(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function fve(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function hve(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function pve(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function mve(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=f8(e.children[1]),l=U$(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function gve(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const p=e.children[l],m={},x=o?o[l]:void 0;x&&(m.align=x);let b={type:"element",tagName:s,properties:m,children:[]};p&&(b.children=t.all(p),t.patch(p,b),b=t.applyData(p,b)),c.push(b)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,d),t.applyData(e,d)}function xve(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const QO=9,JO=32;function vve(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(eL(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(eL(e.slice(i),i>0,!1)),s.join("")}function eL(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===QO||s===JO;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===QO||s===JO;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function yve(t,e){const n={type:"text",value:vve(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function bve(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const _ve={blockquote:Kxe,break:Zxe,code:Qxe,delete:Jxe,emphasis:eve,footnoteReference:tve,heading:nve,html:rve,imageReference:ive,image:sve,inlineCode:ove,linkReference:ave,link:lve,listItem:cve,list:dve,paragraph:fve,root:hve,strong:pve,table:mve,tableCell:xve,tableRow:gve,text:yve,thematicBreak:bve,toml:x4,yaml:x4,definition:x4,footnoteDefinition:x4};function x4(){}const aq=-1,qT=0,j_=1,F2=2,y8=3,b8=4,_8=5,S8=6,lq=7,cq=8,tL=typeof self=="object"?self:globalThis,Sve=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case qT:case aq:return n(o,i);case j_:{const a=n([],i);for(const l of o)a.push(r(l));return a}case F2:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case y8:return n(new Date(o),i);case b8:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case _8:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case S8:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case lq:{const{name:a,message:l}=o;return n(new tL[a](l),i)}case cq:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new tL[s](o),i)};return r},nL=t=>Sve(new Map,t)(0),Pv="",{toString:wve}={},{keys:Mve}=Object,n_=t=>{const e=typeof t;if(e!=="object"||!t)return[qT,e];const n=wve.call(t).slice(8,-1);switch(n){case"Array":return[j_,Pv];case"Object":return[F2,Pv];case"Date":return[y8,Pv];case"RegExp":return[b8,Pv];case"Map":return[_8,Pv];case"Set":return[S8,Pv];case"DataView":return[j_,n]}return n.includes("Array")?[j_,n]:n.includes("Error")?[lq,n]:[F2,n]},v4=([t,e])=>t===qT&&(e==="function"||e==="symbol"),Tve=(t,e,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=n_(o);switch(a){case qT:{let d=o;switch(l){case"bigint":a=cq,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([aq],o)}return i([a,d],o)}case j_:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),i([l,[...m]],o)}const d=[],p=i([a,d],o);for(const m of o)d.push(s(m));return p}case F2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const d=[],p=i([a,d],o);for(const m of Mve(o))(t||!v4(n_(o[m])))&&d.push([s(m),s(o[m])]);return p}case y8:return i([a,o.toISOString()],o);case b8:{const{source:d,flags:p}=o;return i([a,{source:d,flags:p}],o)}case _8:{const d=[],p=i([a,d],o);for(const[m,x]of o)(t||!(v4(n_(m))||v4(n_(x))))&&d.push([s(m),s(x)]);return p}case S8:{const d=[],p=i([a,d],o);for(const m of o)(t||!v4(n_(m)))&&d.push(s(m));return p}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},rL=(t,{json:e,lossy:n}={})=>{const r=[];return Tve(!(e||n),!!e,new Map,r)(t),r},U2=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?nL(rL(t,e)):structuredClone(t):(t,e)=>nL(rL(t,e));function Cve(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Eve(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Ave(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Cve,r=t.options.footnoteBackLabel||Eve,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const d=t.all(c),p=String(c.identifier).toUpperCase(),m=Iy(p.toLowerCase());let x=0;const b=[],_=t.footnoteCounts.get(p);for(;_!==void 0&&++x<=_;){b.length>0&&b.push({type:"text",value:" "});let C=typeof n=="string"?n:n(l,x);typeof C=="string"&&(C={type:"text",value:C}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,x),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const S=d[d.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const C=S.children[S.children.length-1];C&&C.type==="text"?C.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...b)}else d.push(...b);const w={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(d,!0)};t.patch(c,w),a.push(w)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...U2(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
`}]}}const w8=(function(t){if(t==null)return Dve;if(typeof t=="function")return XT(t);if(typeof t=="object")return Array.isArray(t)?Nve(t):Rve(t);if(typeof t=="string")return kve(t);throw new Error("Expected function, string, or object as test")});function Nve(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=w8(t[n]);return XT(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Rve(t){const e=t;return XT(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function kve(t){return XT(e);function e(n){return n&&n.type===t}}function XT(t){return e;function e(n,r,i){return!!(Pve(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Dve(){return!0}function Pve(t){return t!==null&&typeof t=="object"&&"type"in t}const uq=[],Ive=!0,iL=!1,dq="skip";function fq(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=w8(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,d){const p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){const x=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(x?"<"+x+">":""))+")"})}return m;function m(){let x=uq,b,_,S;if((!e||s(l,c,d[d.length-1]||void 0))&&(x=Ove(n(l,d)),x[0]===iL))return x;if("children"in l&&l.children){const w=l;if(w.children&&x[0]!==dq)for(_=(r?w.children.length:-1)+o,S=d.concat(w);_>-1&&_<w.children.length;){const C=w.children[_];if(b=a(C,_,S)(),b[0]===iL)return b;_=typeof b[1]=="number"?b[1]:_+o}}return x}}}function Ove(t){return Array.isArray(t)?t:typeof t=="number"?[Ive,t]:t==null?uq:[t]}function hq(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),fq(t,s,a,i);function a(l,c){const d=c[c.length-1],p=d?d.children.indexOf(l):void 0;return o(l,p,d)}}const wR={}.hasOwnProperty,Lve={};function jve(t,e){const n=e||Lve,r=new Map,i=new Map,s=new Map,o={..._ve,...n.handlers},a={all:c,applyData:Fve,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:zve,wrap:Bve};return hq(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const p=d.type==="definition"?r:i,m=String(d.identifier).toUpperCase();p.has(m)||p.set(m,d)}}),a;function l(d,p){const m=d.type,x=a.handlers[m];if(wR.call(a.handlers,m)&&x)return x(a,d,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in d){const{children:_,...S}=d,w=U2(S);return w.children=a.all(d),w}return U2(d)}return(a.options.unknownHandler||Uve)(a,d,p)}function c(d){const p=[];if("children"in d){const m=d.children;let x=-1;for(;++x<m.length;){const b=a.one(m[x],d);if(b){if(x&&m[x-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=sL(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=sL(_.value))}Array.isArray(b)?p.push(...b):p.push(b)}}}return p}}function zve(t,e){t.position&&(e.position=wme(t))}function Fve(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,U2(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Uve(t,e){const n=e.data||{},r="value"in e&&!(wR.call(n,"hProperties")||wR.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Bve(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
`});++r<t.length;)r&&n.push({type:"text",value:`
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
`}),n}function sL(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function oL(t,e){const n=jve(t,e),r=n.one(t,void 0),i=Ave(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function Hve(t,e){return t&&"run"in t?async function(n,r){const i=oL(n,{file:r,...e});await t.run(i,r)}:function(n,r){return oL(n,{file:r,...t||e})}}function aL(t){if(t)throw t}var wA,lL;function Vve(){if(lL)return wA;lL=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var d=t.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!p)return!1;var m;for(m in c);return typeof m>"u"||t.call(c,m)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},a=function(c,d){if(d==="__proto__")if(t.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return wA=function l(){var c,d,p,m,x,b,_=arguments[0],S=1,w=arguments.length,C=!1;for(typeof _=="boolean"&&(C=_,_=arguments[1]||{},S=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});S<w;++S)if(c=arguments[S],c!=null)for(d in c)p=a(_,d),m=a(c,d),_!==m&&(C&&m&&(s(m)||(x=i(m)))?(x?(x=!1,b=p&&i(p)?p:[]):b=p&&s(p)?p:{},o(_,{name:d,newValue:l(C,b,m)})):typeof m<"u"&&o(_,{name:d,newValue:m}));return _},wA}var Gve=Vve();const MA=xy(Gve);function MR(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Wve(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const d=t[++s];let p=-1;if(l){o(l);return}for(;++p<i.length;)(c[p]===null||c[p]===void 0)&&(c[p]=i[p]);i=c,d?$ve(d,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function $ve(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return i(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const Bf={basename:qve,dirname:Xve,extname:Yve,join:Kve,sep:"/"};function qve(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');xw(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function Xve(t){if(xw(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Yve(t){xw(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function Kve(...t){let e=-1,n;for(;++e<t.length;)xw(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Zve(n)}function Zve(t){xw(t);const e=t.codePointAt(0)===47;let n=Qve(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Qve(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function xw(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Jve={cwd:e1e};function e1e(){return"/"}function TR(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function t1e(t){if(typeof t=="string")t=new URL(t);else if(!TR(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return n1e(t)}function n1e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const TA=["history","path","basename","stem","extname","dirname"];class pq{constructor(e){let n;e?TR(e)?n={path:e}:typeof e=="string"||r1e(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Jve.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<TA.length;){const s=TA[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)TA.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Bf.basename(this.path):void 0}set basename(e){EA(e,"basename"),CA(e,"basename"),this.path=Bf.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Bf.dirname(this.path):void 0}set dirname(e){cL(this.basename,"dirname"),this.path=Bf.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Bf.extname(this.path):void 0}set extname(e){if(CA(e,"extname"),cL(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Bf.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){TR(e)&&(e=t1e(e)),EA(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Bf.basename(this.path,this.extname):void 0}set stem(e){EA(e,"stem"),CA(e,"stem"),this.path=Bf.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new yl(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function CA(t,e){if(t&&t.includes(Bf.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Bf.sep+"`")}function EA(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function cL(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function r1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const i1e=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),s1e={}.hasOwnProperty;class M8 extends i1e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Wve()}copy(){const e=new M8;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(MA(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(RA("data",this.frozen),this.namespace[e]=n,this):s1e.call(this.namespace,e)&&this.namespace[e]||void 0:e?(RA("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=y4(e),r=this.parser||this.Parser;return AA("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),AA("process",this.parser||this.Parser),NA("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=y4(e),l=r.parse(a);r.run(l,a,function(d,p,m){if(d||!p||!m)return c(d);const x=p,b=r.stringify(x,m);l1e(b)?m.value=b:m.result=b,c(d,m)});function c(d,p){d||!p?o(d):s?s(p):n(void 0,p)}}}processSync(e){let n=!1,r;return this.freeze(),AA("processSync",this.parser||this.Parser),NA("processSync",this.compiler||this.Compiler),this.process(e,i),dL("processSync","process",n),r;function i(s,o){n=!0,aL(s),r=o}}run(e,n,r){uL(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=y4(n);i.run(e,l,c);function c(d,p,m){const x=p||e;d?a(d):o?o(x):r(void 0,x,m)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),dL("runSync","run",r),i;function s(o,a){aL(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=y4(n),i=this.compiler||this.Compiler;return NA("stringify",i),uL(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(RA("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...p]=c;l(d,p)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=MA(!0,i.settings,c.settings))}function a(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const p=c[d];s(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===c){m=p;break}if(m===-1)r.push([c,...d]);else if(d.length>0){let[x,...b]=d;const _=r[m][1];MR(_)&&MR(x)&&(x=MA(!0,_,x)),r[m]=[c,x,...b]}}}}const o1e=new M8().freeze();function AA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function NA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function RA(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uL(t){if(!MR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function dL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function y4(t){return a1e(t)?t:new pq(t)}function a1e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function l1e(t){return typeof t=="string"||c1e(t)}function c1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const u1e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fL=[],hL={allowDangerousHtml:!0},d1e=/^(https?|ircs?|mailto|xmpp)$/i,f1e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function h1e(t){const e=p1e(t),n=m1e(t);return g1e(e.runSync(e.parse(n),n),t)}function p1e(t){const e=t.rehypePlugins||fL,n=t.remarkPlugins||fL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...hL}:hL;return o1e().use(Yxe).use(n).use(Hve,r).use(e)}function m1e(t){const e=t.children||"",n=new pq;return typeof e=="string"&&(n.value=e),n}function g1e(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||x1e;for(const d of f1e)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+u1e+d.id,void 0);return hq(t,c),Ame(t,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function c(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let x;for(x in bA)if(Object.hasOwn(bA,x)&&Object.hasOwn(d.properties,x)){const b=d.properties[x],_=bA[x];(_===null||_.includes(d.tagName))&&(d.properties[x]=l(String(b||""),x,d))}}if(d.type==="element"){let x=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!x&&r&&typeof p=="number"&&(x=!r(d,p,m)),x&&m&&typeof p=="number")return a&&d.children?m.children.splice(p,1,...d.children):m.children.splice(p,1),p}}}function x1e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||d1e.test(t.slice(0,e))?t:""}function v1e(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function y1e(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function t(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const p=d.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function b1e(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,o,a,l){const c=s.value||"",d=a.createTracker(l),p="$".repeat(Math.max(v1e(c,"$")+1,2)),m=a.enter("mathFlow");let x=d.move(p);if(s.meta){const b=a.enter("mathFlowMeta");x+=d.move(a.safe(s.meta,{after:`
`,before:x,encode:["$"],...d.current()})),b()}return x+=d.move(`
`),c&&(x+=d.move(c+`
`)),x+=d.move(p),m(),x}function r(s,o,a){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let p=-1;for(;++p<a.unsafe.length;){const m=a.unsafe[p];if(!m.atBreak)continue;const x=a.compilePattern(m);let b;for(;b=x.exec(l);){let _=b.index;l.codePointAt(_)===10&&l.codePointAt(_-1)===13&&_--,l=l.slice(0,_)+" "+l.slice(b.index+1)}}return d+l+d}function i(){return"$"}}const _1e={tokenize:S1e,concrete:!0,name:"mathFlow"},pL={tokenize:w1e,partial:!0};function S1e(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0;return a;function a(C){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(C)}function l(C){return C===36?(t.consume(C),o++,l):o<2?n(C):(t.exit("mathFlowFenceSequence"),Hi(t,c,"whitespace")(C))}function c(C){return C===null||Xn(C)?p(C):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(C))}function d(C){return C===null||Xn(C)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),p(C)):C===36?n(C):(t.consume(C),d)}function p(C){return t.exit("mathFlowFence"),r.interrupt?e(C):t.attempt(pL,m,S)(C)}function m(C){return t.attempt({tokenize:w,partial:!0},S,x)(C)}function x(C){return(s?Hi(t,b,"linePrefix",s+1):b)(C)}function b(C){return C===null?S(C):Xn(C)?t.attempt(pL,m,S)(C):(t.enter("mathFlowValue"),_(C))}function _(C){return C===null||Xn(C)?(t.exit("mathFlowValue"),b(C)):(t.consume(C),_)}function S(C){return t.exit("mathFlow"),e(C)}function w(C,A,N){let D=0;return Hi(C,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function P(L){return C.enter("mathFlowFence"),C.enter("mathFlowFenceSequence"),O(L)}function O(L){return L===36?(D++,C.consume(L),O):D<o?N(L):(C.exit("mathFlowFenceSequence"),Hi(C,R,"whitespace")(L))}function R(L){return L===null||Xn(L)?(C.exit("mathFlowFence"),A(L)):N(L)}}}function w1e(t,e,n){const r=this;return i;function i(o){return o===null?e(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function M1e(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:T1e,previous:C1e,name:"mathText"};function r(i,s,o){let a=0,l,c;return d;function d(_){return i.enter("mathText"),i.enter("mathTextSequence"),p(_)}function p(_){return _===36?(i.consume(_),a++,p):a<2&&!n?o(_):(i.exit("mathTextSequence"),m(_))}function m(_){return _===null?o(_):_===36?(c=i.enter("mathTextSequence"),l=0,b(_)):_===32?(i.enter("space"),i.consume(_),i.exit("space"),m):Xn(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),m):(i.enter("mathTextData"),x(_))}function x(_){return _===null||_===32||_===36||Xn(_)?(i.exit("mathTextData"),m(_)):(i.consume(_),x)}function b(_){return _===36?(i.consume(_),l++,b):l===a?(i.exit("mathTextSequence"),i.exit("mathText"),s(_)):(c.type="mathTextData",x(_))}}}function T1e(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="mathTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function C1e(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function E1e(t){return{flow:{36:_1e},text:{36:M1e(t)}}}class Tc{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new Tc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class su{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new su(n,Tc.range(this,e))}}class on{constructor(e,n){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,i,s,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+a.slice(i-15,i):c=a.slice(0,i);var d;s+15<a.length?d=a.slice(s,s+15)+"…":d=a.slice(s),r+=c+l+d}var p=new Error(r);return p.name="ParseError",p.__proto__=on.prototype,p.position=i,i!=null&&s!=null&&(p.length=s-i),p.rawMessage=e,p}}on.prototype.__proto__=Error.prototype;var A1e=/([A-Z])/g,T8=t=>t.replace(A1e,"-$1").toLowerCase(),N1e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},R1e=/[&><"']/g,gl=t=>String(t).replace(R1e,e=>N1e[e]),z_=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?z_(t.body[0]):t:t.type==="font"?z_(t.body):t,k1e=new Set(["mathord","textord","atom"]),Tp=t=>k1e.has(z_(t).type),D1e=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},VM={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function P1e(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C8{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in VM)if(VM.hasOwnProperty(n)){var r=VM[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:P1e(r)}}reportNonstrict(e,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new on("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var i=this.strict;if(typeof i=="function")try{i=i(e,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=D1e(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class v0{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Wf[I1e[this.id]]}sub(){return Wf[O1e[this.id]]}fracNum(){return Wf[L1e[this.id]]}fracDen(){return Wf[j1e[this.id]]}cramp(){return Wf[z1e[this.id]]}text(){return Wf[F1e[this.id]]}isTight(){return this.size>=2}}var E8=0,B2=1,C1=2,hp=3,yS=4,Yu=5,sy=6,Gl=7,Wf=[new v0(E8,0,!1),new v0(B2,0,!0),new v0(C1,1,!1),new v0(hp,1,!0),new v0(yS,2,!1),new v0(Yu,2,!0),new v0(sy,3,!1),new v0(Gl,3,!0)],I1e=[yS,Yu,yS,Yu,sy,Gl,sy,Gl],O1e=[Yu,Yu,Yu,Yu,Gl,Gl,Gl,Gl],L1e=[C1,hp,yS,Yu,sy,Gl,sy,Gl],j1e=[hp,hp,Yu,Yu,Gl,Gl,Gl,Gl],z1e=[B2,B2,hp,hp,Yu,Yu,Gl,Gl],F1e=[E8,B2,C1,hp,C1,hp,C1,hp],gr={DISPLAY:Wf[E8],TEXT:Wf[C1],SCRIPT:Wf[yS],SCRIPTSCRIPT:Wf[sy]},CR=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function U1e(t){for(var e=0;e<CR.length;e++)for(var n=CR[e],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(t>=i[0]&&t<=i[1])return n.name}return null}var GM=[];CR.forEach(t=>t.blocks.forEach(e=>GM.push(...e)));function mq(t){for(var e=0;e<GM.length;e+=2)if(t>=GM[e]&&t<=GM[e+1])return!0;return!1}var Iv=80,B1e=function(e,n){return"M95,"+(622+e+n)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+e/2.075+" -"+e+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},H1e=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+e/2.084+" -"+e+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},V1e=function(e,n){return"M983 "+(10+e+n)+`
l`+e/3.13+" -"+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},G1e=function(e,n){return"M424,"+(2398+e+n)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+e)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+`
h400000v`+(40+e)+"h-400000z"},W1e=function(e,n){return"M473,"+(2713+e+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},$1e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},q1e=function(e,n,r){var i=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+`
H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},X1e=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=B1e(n,Iv);break;case"sqrtSize1":i=H1e(n,Iv);break;case"sqrtSize2":i=V1e(n,Iv);break;case"sqrtSize3":i=G1e(n,Iv);break;case"sqrtSize4":i=W1e(n,Iv);break;case"sqrtTall":i=q1e(n,Iv,r)}return i},Y1e=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},mL={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},K1e=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};let vw=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){var e=n=>n.toText();return this.children.map(e).join("")}};var Qf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},b4={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},gL={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Z1e(t,e){Qf[t]=e}function A8(t,e,n){if(!Qf[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=Qf[e][r];if(!i&&t[0]in gL&&(r=gL[t[0]].charCodeAt(0),i=Qf[e][r]),!i&&n==="text"&&mq(r)&&(i=Qf[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var kA={};function Q1e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!kA[e]){var n=kA[e]={cssEmPerMu:b4.quad[e]/18};for(var r in b4)b4.hasOwnProperty(r)&&(n[r]=b4[r][e])}return kA[e]}var J1e=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],xL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],vL=function(e,n){return n.size<2?e:J1e[e-1][n.size-1]};class np{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||np.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=xL[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new np(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:vL(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:xL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=vL(np.BASESIZE,e);return this.size===n&&this.textSize===np.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==np.BASESIZE?["sizing","reset-size"+this.size,"size"+np.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Q1e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}np.BASESIZE=6;var ER={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},eye={ex:!0,em:!0,mu:!0},gq=function(e){return typeof e!="string"&&(e=e.unit),e in ER||e in eye||e==="ex"},Qs=function(e,n){var r;if(e.unit in ER)r=ER[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var i;if(n.style.isTight()?i=n.havingStyle(n.style.text()):i=n,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new on("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},mn=function(e){return+e.toFixed(4)+"em"},nm=function(e){return e.filter(n=>n).join(" ")},xq=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var i=n.getColor();i&&(this.style.color=i)}},vq=function(e){var n=document.createElement(e);n.className=nm(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&n.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n},tye=/[\s"'>/=\x00-\x1f]/,yq=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+gl(nm(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=T8(i)+":"+this.style[i]+";");r&&(n+=' style="'+gl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(tye.test(s))throw new on("Invalid attribute name '"+s+"'");n+=" "+s+'="'+gl(this.attributes[s])+'"'}n+=">";for(var o=0;o<this.children.length;o++)n+=this.children[o].toMarkup();return n+="</"+e+">",n};class yw{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,xq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return vq.call(this,"span")}toMarkup(){return yq.call(this,"span")}}class N8{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,xq.call(this,n,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return vq.call(this,"a")}toMarkup(){return yq.call(this,"a")}}class nye{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e='<img src="'+gl(this.src)+'"'+(' alt="'+gl(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=T8(r)+":"+this.style[r]+";");return n&&(e+=' style="'+gl(n)+'"'),e+="'/>",e}}var rye={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class nd{constructor(e,n,r,i,s,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=U1e(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=rye[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;this.italic>0&&(n=document.createElement("span"),n.style.marginRight=mn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=nm(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="<span";this.classes.length&&(e=!0,n+=' class="',n+=gl(nm(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=T8(i)+":"+this.style[i]+";");r&&(e=!0,n+=' style="'+gl(r)+'"');var s=gl(this.text);return e?(n+=">",n+=s,n+="</span>",n):s}}class vp{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+gl(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class rm{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",mL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+gl(this.alternate)+'"/>':'<path d="'+gl(mL[this.pathName])+'"/>'}}class AR{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e="<line";for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+gl(this.attributes[n])+'"');return e+="/>",e}}function yL(t){if(t instanceof nd)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function iye(t){if(t instanceof yw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var sye={bin:1,close:1,inner:1,open:1,punct:1,rel:1},oye={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},hs={math:{},text:{}};function J(t,e,n,r,i,s){hs[t][i]={font:e,group:n,replace:r},s&&r&&(hs[t][r]=hs[t][i])}var ae="math",Qt="text",ye="main",Je="ams",Us="accent-token",An="bin",ql="close",Oy="inner",Zn="mathord",$o="op-token",pu="open",YT="punct",tt="rel",Cp="spacing",xt="textord";J(ae,ye,tt,"≡","\\equiv",!0);J(ae,ye,tt,"≺","\\prec",!0);J(ae,ye,tt,"≻","\\succ",!0);J(ae,ye,tt,"∼","\\sim",!0);J(ae,ye,tt,"⊥","\\perp");J(ae,ye,tt,"⪯","\\preceq",!0);J(ae,ye,tt,"⪰","\\succeq",!0);J(ae,ye,tt,"≃","\\simeq",!0);J(ae,ye,tt,"∣","\\mid",!0);J(ae,ye,tt,"≪","\\ll",!0);J(ae,ye,tt,"≫","\\gg",!0);J(ae,ye,tt,"≍","\\asymp",!0);J(ae,ye,tt,"∥","\\parallel");J(ae,ye,tt,"⋈","\\bowtie",!0);J(ae,ye,tt,"⌣","\\smile",!0);J(ae,ye,tt,"⊑","\\sqsubseteq",!0);J(ae,ye,tt,"⊒","\\sqsupseteq",!0);J(ae,ye,tt,"≐","\\doteq",!0);J(ae,ye,tt,"⌢","\\frown",!0);J(ae,ye,tt,"∋","\\ni",!0);J(ae,ye,tt,"∝","\\propto",!0);J(ae,ye,tt,"⊢","\\vdash",!0);J(ae,ye,tt,"⊣","\\dashv",!0);J(ae,ye,tt,"∋","\\owns");J(ae,ye,YT,".","\\ldotp");J(ae,ye,YT,"⋅","\\cdotp");J(ae,ye,xt,"#","\\#");J(Qt,ye,xt,"#","\\#");J(ae,ye,xt,"&","\\&");J(Qt,ye,xt,"&","\\&");J(ae,ye,xt,"ℵ","\\aleph",!0);J(ae,ye,xt,"∀","\\forall",!0);J(ae,ye,xt,"ℏ","\\hbar",!0);J(ae,ye,xt,"∃","\\exists",!0);J(ae,ye,xt,"∇","\\nabla",!0);J(ae,ye,xt,"♭","\\flat",!0);J(ae,ye,xt,"ℓ","\\ell",!0);J(ae,ye,xt,"♮","\\natural",!0);J(ae,ye,xt,"♣","\\clubsuit",!0);J(ae,ye,xt,"℘","\\wp",!0);J(ae,ye,xt,"♯","\\sharp",!0);J(ae,ye,xt,"♢","\\diamondsuit",!0);J(ae,ye,xt,"ℜ","\\Re",!0);J(ae,ye,xt,"♡","\\heartsuit",!0);J(ae,ye,xt,"ℑ","\\Im",!0);J(ae,ye,xt,"♠","\\spadesuit",!0);J(ae,ye,xt,"§","\\S",!0);J(Qt,ye,xt,"§","\\S");J(ae,ye,xt,"¶","\\P",!0);J(Qt,ye,xt,"¶","\\P");J(ae,ye,xt,"†","\\dag");J(Qt,ye,xt,"†","\\dag");J(Qt,ye,xt,"†","\\textdagger");J(ae,ye,xt,"‡","\\ddag");J(Qt,ye,xt,"‡","\\ddag");J(Qt,ye,xt,"‡","\\textdaggerdbl");J(ae,ye,ql,"⎱","\\rmoustache",!0);J(ae,ye,pu,"⎰","\\lmoustache",!0);J(ae,ye,ql,"⟯","\\rgroup",!0);J(ae,ye,pu,"⟮","\\lgroup",!0);J(ae,ye,An,"∓","\\mp",!0);J(ae,ye,An,"⊖","\\ominus",!0);J(ae,ye,An,"⊎","\\uplus",!0);J(ae,ye,An,"⊓","\\sqcap",!0);J(ae,ye,An,"∗","\\ast");J(ae,ye,An,"⊔","\\sqcup",!0);J(ae,ye,An,"◯","\\bigcirc",!0);J(ae,ye,An,"∙","\\bullet",!0);J(ae,ye,An,"‡","\\ddagger");J(ae,ye,An,"≀","\\wr",!0);J(ae,ye,An,"⨿","\\amalg");J(ae,ye,An,"&","\\And");J(ae,ye,tt,"⟵","\\longleftarrow",!0);J(ae,ye,tt,"⇐","\\Leftarrow",!0);J(ae,ye,tt,"⟸","\\Longleftarrow",!0);J(ae,ye,tt,"⟶","\\longrightarrow",!0);J(ae,ye,tt,"⇒","\\Rightarrow",!0);J(ae,ye,tt,"⟹","\\Longrightarrow",!0);J(ae,ye,tt,"↔","\\leftrightarrow",!0);J(ae,ye,tt,"⟷","\\longleftrightarrow",!0);J(ae,ye,tt,"⇔","\\Leftrightarrow",!0);J(ae,ye,tt,"⟺","\\Longleftrightarrow",!0);J(ae,ye,tt,"↦","\\mapsto",!0);J(ae,ye,tt,"⟼","\\longmapsto",!0);J(ae,ye,tt,"↗","\\nearrow",!0);J(ae,ye,tt,"↩","\\hookleftarrow",!0);J(ae,ye,tt,"↪","\\hookrightarrow",!0);J(ae,ye,tt,"↘","\\searrow",!0);J(ae,ye,tt,"↼","\\leftharpoonup",!0);J(ae,ye,tt,"⇀","\\rightharpoonup",!0);J(ae,ye,tt,"↙","\\swarrow",!0);J(ae,ye,tt,"↽","\\leftharpoondown",!0);J(ae,ye,tt,"⇁","\\rightharpoondown",!0);J(ae,ye,tt,"↖","\\nwarrow",!0);J(ae,ye,tt,"⇌","\\rightleftharpoons",!0);J(ae,Je,tt,"≮","\\nless",!0);J(ae,Je,tt,"","\\@nleqslant");J(ae,Je,tt,"","\\@nleqq");J(ae,Je,tt,"⪇","\\lneq",!0);J(ae,Je,tt,"≨","\\lneqq",!0);J(ae,Je,tt,"","\\@lvertneqq");J(ae,Je,tt,"⋦","\\lnsim",!0);J(ae,Je,tt,"⪉","\\lnapprox",!0);J(ae,Je,tt,"⊀","\\nprec",!0);J(ae,Je,tt,"⋠","\\npreceq",!0);J(ae,Je,tt,"⋨","\\precnsim",!0);J(ae,Je,tt,"⪹","\\precnapprox",!0);J(ae,Je,tt,"≁","\\nsim",!0);J(ae,Je,tt,"","\\@nshortmid");J(ae,Je,tt,"∤","\\nmid",!0);J(ae,Je,tt,"⊬","\\nvdash",!0);J(ae,Je,tt,"⊭","\\nvDash",!0);J(ae,Je,tt,"⋪","\\ntriangleleft");J(ae,Je,tt,"⋬","\\ntrianglelefteq",!0);J(ae,Je,tt,"⊊","\\subsetneq",!0);J(ae,Je,tt,"","\\@varsubsetneq");J(ae,Je,tt,"⫋","\\subsetneqq",!0);J(ae,Je,tt,"","\\@varsubsetneqq");J(ae,Je,tt,"≯","\\ngtr",!0);J(ae,Je,tt,"","\\@ngeqslant");J(ae,Je,tt,"","\\@ngeqq");J(ae,Je,tt,"⪈","\\gneq",!0);J(ae,Je,tt,"≩","\\gneqq",!0);J(ae,Je,tt,"","\\@gvertneqq");J(ae,Je,tt,"⋧","\\gnsim",!0);J(ae,Je,tt,"⪊","\\gnapprox",!0);J(ae,Je,tt,"⊁","\\nsucc",!0);J(ae,Je,tt,"⋡","\\nsucceq",!0);J(ae,Je,tt,"⋩","\\succnsim",!0);J(ae,Je,tt,"⪺","\\succnapprox",!0);J(ae,Je,tt,"≆","\\ncong",!0);J(ae,Je,tt,"","\\@nshortparallel");J(ae,Je,tt,"∦","\\nparallel",!0);J(ae,Je,tt,"⊯","\\nVDash",!0);J(ae,Je,tt,"⋫","\\ntriangleright");J(ae,Je,tt,"⋭","\\ntrianglerighteq",!0);J(ae,Je,tt,"","\\@nsupseteqq");J(ae,Je,tt,"⊋","\\supsetneq",!0);J(ae,Je,tt,"","\\@varsupsetneq");J(ae,Je,tt,"⫌","\\supsetneqq",!0);J(ae,Je,tt,"","\\@varsupsetneqq");J(ae,Je,tt,"⊮","\\nVdash",!0);J(ae,Je,tt,"⪵","\\precneqq",!0);J(ae,Je,tt,"⪶","\\succneqq",!0);J(ae,Je,tt,"","\\@nsubseteqq");J(ae,Je,An,"⊴","\\unlhd");J(ae,Je,An,"⊵","\\unrhd");J(ae,Je,tt,"↚","\\nleftarrow",!0);J(ae,Je,tt,"↛","\\nrightarrow",!0);J(ae,Je,tt,"⇍","\\nLeftarrow",!0);J(ae,Je,tt,"⇏","\\nRightarrow",!0);J(ae,Je,tt,"↮","\\nleftrightarrow",!0);J(ae,Je,tt,"⇎","\\nLeftrightarrow",!0);J(ae,Je,tt,"△","\\vartriangle");J(ae,Je,xt,"ℏ","\\hslash");J(ae,Je,xt,"▽","\\triangledown");J(ae,Je,xt,"◊","\\lozenge");J(ae,Je,xt,"Ⓢ","\\circledS");J(ae,Je,xt,"®","\\circledR");J(Qt,Je,xt,"®","\\circledR");J(ae,Je,xt,"∡","\\measuredangle",!0);J(ae,Je,xt,"∄","\\nexists");J(ae,Je,xt,"℧","\\mho");J(ae,Je,xt,"Ⅎ","\\Finv",!0);J(ae,Je,xt,"⅁","\\Game",!0);J(ae,Je,xt,"‵","\\backprime");J(ae,Je,xt,"▲","\\blacktriangle");J(ae,Je,xt,"▼","\\blacktriangledown");J(ae,Je,xt,"■","\\blacksquare");J(ae,Je,xt,"⧫","\\blacklozenge");J(ae,Je,xt,"★","\\bigstar");J(ae,Je,xt,"∢","\\sphericalangle",!0);J(ae,Je,xt,"∁","\\complement",!0);J(ae,Je,xt,"ð","\\eth",!0);J(Qt,ye,xt,"ð","ð");J(ae,Je,xt,"╱","\\diagup");J(ae,Je,xt,"╲","\\diagdown");J(ae,Je,xt,"□","\\square");J(ae,Je,xt,"□","\\Box");J(ae,Je,xt,"◊","\\Diamond");J(ae,Je,xt,"¥","\\yen",!0);J(Qt,Je,xt,"¥","\\yen",!0);J(ae,Je,xt,"✓","\\checkmark",!0);J(Qt,Je,xt,"✓","\\checkmark");J(ae,Je,xt,"ℶ","\\beth",!0);J(ae,Je,xt,"ℸ","\\daleth",!0);J(ae,Je,xt,"ℷ","\\gimel",!0);J(ae,Je,xt,"ϝ","\\digamma",!0);J(ae,Je,xt,"ϰ","\\varkappa");J(ae,Je,pu,"┌","\\@ulcorner",!0);J(ae,Je,ql,"┐","\\@urcorner",!0);J(ae,Je,pu,"└","\\@llcorner",!0);J(ae,Je,ql,"┘","\\@lrcorner",!0);J(ae,Je,tt,"≦","\\leqq",!0);J(ae,Je,tt,"⩽","\\leqslant",!0);J(ae,Je,tt,"⪕","\\eqslantless",!0);J(ae,Je,tt,"≲","\\lesssim",!0);J(ae,Je,tt,"⪅","\\lessapprox",!0);J(ae,Je,tt,"≊","\\approxeq",!0);J(ae,Je,An,"⋖","\\lessdot");J(ae,Je,tt,"⋘","\\lll",!0);J(ae,Je,tt,"≶","\\lessgtr",!0);J(ae,Je,tt,"⋚","\\lesseqgtr",!0);J(ae,Je,tt,"⪋","\\lesseqqgtr",!0);J(ae,Je,tt,"≑","\\doteqdot");J(ae,Je,tt,"≓","\\risingdotseq",!0);J(ae,Je,tt,"≒","\\fallingdotseq",!0);J(ae,Je,tt,"∽","\\backsim",!0);J(ae,Je,tt,"⋍","\\backsimeq",!0);J(ae,Je,tt,"⫅","\\subseteqq",!0);J(ae,Je,tt,"⋐","\\Subset",!0);J(ae,Je,tt,"⊏","\\sqsubset",!0);J(ae,Je,tt,"≼","\\preccurlyeq",!0);J(ae,Je,tt,"⋞","\\curlyeqprec",!0);J(ae,Je,tt,"≾","\\precsim",!0);J(ae,Je,tt,"⪷","\\precapprox",!0);J(ae,Je,tt,"⊲","\\vartriangleleft");J(ae,Je,tt,"⊴","\\trianglelefteq");J(ae,Je,tt,"⊨","\\vDash",!0);J(ae,Je,tt,"⊪","\\Vvdash",!0);J(ae,Je,tt,"⌣","\\smallsmile");J(ae,Je,tt,"⌢","\\smallfrown");J(ae,Je,tt,"≏","\\bumpeq",!0);J(ae,Je,tt,"≎","\\Bumpeq",!0);J(ae,Je,tt,"≧","\\geqq",!0);J(ae,Je,tt,"⩾","\\geqslant",!0);J(ae,Je,tt,"⪖","\\eqslantgtr",!0);J(ae,Je,tt,"≳","\\gtrsim",!0);J(ae,Je,tt,"⪆","\\gtrapprox",!0);J(ae,Je,An,"⋗","\\gtrdot");J(ae,Je,tt,"⋙","\\ggg",!0);J(ae,Je,tt,"≷","\\gtrless",!0);J(ae,Je,tt,"⋛","\\gtreqless",!0);J(ae,Je,tt,"⪌","\\gtreqqless",!0);J(ae,Je,tt,"≖","\\eqcirc",!0);J(ae,Je,tt,"≗","\\circeq",!0);J(ae,Je,tt,"≜","\\triangleq",!0);J(ae,Je,tt,"∼","\\thicksim");J(ae,Je,tt,"≈","\\thickapprox");J(ae,Je,tt,"⫆","\\supseteqq",!0);J(ae,Je,tt,"⋑","\\Supset",!0);J(ae,Je,tt,"⊐","\\sqsupset",!0);J(ae,Je,tt,"≽","\\succcurlyeq",!0);J(ae,Je,tt,"⋟","\\curlyeqsucc",!0);J(ae,Je,tt,"≿","\\succsim",!0);J(ae,Je,tt,"⪸","\\succapprox",!0);J(ae,Je,tt,"⊳","\\vartriangleright");J(ae,Je,tt,"⊵","\\trianglerighteq");J(ae,Je,tt,"⊩","\\Vdash",!0);J(ae,Je,tt,"∣","\\shortmid");J(ae,Je,tt,"∥","\\shortparallel");J(ae,Je,tt,"≬","\\between",!0);J(ae,Je,tt,"⋔","\\pitchfork",!0);J(ae,Je,tt,"∝","\\varpropto");J(ae,Je,tt,"◀","\\blacktriangleleft");J(ae,Je,tt,"∴","\\therefore",!0);J(ae,Je,tt,"∍","\\backepsilon");J(ae,Je,tt,"▶","\\blacktriangleright");J(ae,Je,tt,"∵","\\because",!0);J(ae,Je,tt,"⋘","\\llless");J(ae,Je,tt,"⋙","\\gggtr");J(ae,Je,An,"⊲","\\lhd");J(ae,Je,An,"⊳","\\rhd");J(ae,Je,tt,"≂","\\eqsim",!0);J(ae,ye,tt,"⋈","\\Join");J(ae,Je,tt,"≑","\\Doteq",!0);J(ae,Je,An,"∔","\\dotplus",!0);J(ae,Je,An,"∖","\\smallsetminus");J(ae,Je,An,"⋒","\\Cap",!0);J(ae,Je,An,"⋓","\\Cup",!0);J(ae,Je,An,"⩞","\\doublebarwedge",!0);J(ae,Je,An,"⊟","\\boxminus",!0);J(ae,Je,An,"⊞","\\boxplus",!0);J(ae,Je,An,"⋇","\\divideontimes",!0);J(ae,Je,An,"⋉","\\ltimes",!0);J(ae,Je,An,"⋊","\\rtimes",!0);J(ae,Je,An,"⋋","\\leftthreetimes",!0);J(ae,Je,An,"⋌","\\rightthreetimes",!0);J(ae,Je,An,"⋏","\\curlywedge",!0);J(ae,Je,An,"⋎","\\curlyvee",!0);J(ae,Je,An,"⊝","\\circleddash",!0);J(ae,Je,An,"⊛","\\circledast",!0);J(ae,Je,An,"⋅","\\centerdot");J(ae,Je,An,"⊺","\\intercal",!0);J(ae,Je,An,"⋒","\\doublecap");J(ae,Je,An,"⋓","\\doublecup");J(ae,Je,An,"⊠","\\boxtimes",!0);J(ae,Je,tt,"⇢","\\dashrightarrow",!0);J(ae,Je,tt,"⇠","\\dashleftarrow",!0);J(ae,Je,tt,"⇇","\\leftleftarrows",!0);J(ae,Je,tt,"⇆","\\leftrightarrows",!0);J(ae,Je,tt,"⇚","\\Lleftarrow",!0);J(ae,Je,tt,"↞","\\twoheadleftarrow",!0);J(ae,Je,tt,"↢","\\leftarrowtail",!0);J(ae,Je,tt,"↫","\\looparrowleft",!0);J(ae,Je,tt,"⇋","\\leftrightharpoons",!0);J(ae,Je,tt,"↶","\\curvearrowleft",!0);J(ae,Je,tt,"↺","\\circlearrowleft",!0);J(ae,Je,tt,"↰","\\Lsh",!0);J(ae,Je,tt,"⇈","\\upuparrows",!0);J(ae,Je,tt,"↿","\\upharpoonleft",!0);J(ae,Je,tt,"⇃","\\downharpoonleft",!0);J(ae,ye,tt,"⊶","\\origof",!0);J(ae,ye,tt,"⊷","\\imageof",!0);J(ae,Je,tt,"⊸","\\multimap",!0);J(ae,Je,tt,"↭","\\leftrightsquigarrow",!0);J(ae,Je,tt,"⇉","\\rightrightarrows",!0);J(ae,Je,tt,"⇄","\\rightleftarrows",!0);J(ae,Je,tt,"↠","\\twoheadrightarrow",!0);J(ae,Je,tt,"↣","\\rightarrowtail",!0);J(ae,Je,tt,"↬","\\looparrowright",!0);J(ae,Je,tt,"↷","\\curvearrowright",!0);J(ae,Je,tt,"↻","\\circlearrowright",!0);J(ae,Je,tt,"↱","\\Rsh",!0);J(ae,Je,tt,"⇊","\\downdownarrows",!0);J(ae,Je,tt,"↾","\\upharpoonright",!0);J(ae,Je,tt,"⇂","\\downharpoonright",!0);J(ae,Je,tt,"⇝","\\rightsquigarrow",!0);J(ae,Je,tt,"⇝","\\leadsto");J(ae,Je,tt,"⇛","\\Rrightarrow",!0);J(ae,Je,tt,"↾","\\restriction");J(ae,ye,xt,"‘","`");J(ae,ye,xt,"$","\\$");J(Qt,ye,xt,"$","\\$");J(Qt,ye,xt,"$","\\textdollar");J(ae,ye,xt,"%","\\%");J(Qt,ye,xt,"%","\\%");J(ae,ye,xt,"_","\\_");J(Qt,ye,xt,"_","\\_");J(Qt,ye,xt,"_","\\textunderscore");J(ae,ye,xt,"∠","\\angle",!0);J(ae,ye,xt,"∞","\\infty",!0);J(ae,ye,xt,"′","\\prime");J(ae,ye,xt,"△","\\triangle");J(ae,ye,xt,"Γ","\\Gamma",!0);J(ae,ye,xt,"Δ","\\Delta",!0);J(ae,ye,xt,"Θ","\\Theta",!0);J(ae,ye,xt,"Λ","\\Lambda",!0);J(ae,ye,xt,"Ξ","\\Xi",!0);J(ae,ye,xt,"Π","\\Pi",!0);J(ae,ye,xt,"Σ","\\Sigma",!0);J(ae,ye,xt,"Υ","\\Upsilon",!0);J(ae,ye,xt,"Φ","\\Phi",!0);J(ae,ye,xt,"Ψ","\\Psi",!0);J(ae,ye,xt,"Ω","\\Omega",!0);J(ae,ye,xt,"A","Α");J(ae,ye,xt,"B","Β");J(ae,ye,xt,"E","Ε");J(ae,ye,xt,"Z","Ζ");J(ae,ye,xt,"H","Η");J(ae,ye,xt,"I","Ι");J(ae,ye,xt,"K","Κ");J(ae,ye,xt,"M","Μ");J(ae,ye,xt,"N","Ν");J(ae,ye,xt,"O","Ο");J(ae,ye,xt,"P","Ρ");J(ae,ye,xt,"T","Τ");J(ae,ye,xt,"X","Χ");J(ae,ye,xt,"¬","\\neg",!0);J(ae,ye,xt,"¬","\\lnot");J(ae,ye,xt,"⊤","\\top");J(ae,ye,xt,"⊥","\\bot");J(ae,ye,xt,"∅","\\emptyset");J(ae,Je,xt,"∅","\\varnothing");J(ae,ye,Zn,"α","\\alpha",!0);J(ae,ye,Zn,"β","\\beta",!0);J(ae,ye,Zn,"γ","\\gamma",!0);J(ae,ye,Zn,"δ","\\delta",!0);J(ae,ye,Zn,"ϵ","\\epsilon",!0);J(ae,ye,Zn,"ζ","\\zeta",!0);J(ae,ye,Zn,"η","\\eta",!0);J(ae,ye,Zn,"θ","\\theta",!0);J(ae,ye,Zn,"ι","\\iota",!0);J(ae,ye,Zn,"κ","\\kappa",!0);J(ae,ye,Zn,"λ","\\lambda",!0);J(ae,ye,Zn,"μ","\\mu",!0);J(ae,ye,Zn,"ν","\\nu",!0);J(ae,ye,Zn,"ξ","\\xi",!0);J(ae,ye,Zn,"ο","\\omicron",!0);J(ae,ye,Zn,"π","\\pi",!0);J(ae,ye,Zn,"ρ","\\rho",!0);J(ae,ye,Zn,"σ","\\sigma",!0);J(ae,ye,Zn,"τ","\\tau",!0);J(ae,ye,Zn,"υ","\\upsilon",!0);J(ae,ye,Zn,"ϕ","\\phi",!0);J(ae,ye,Zn,"χ","\\chi",!0);J(ae,ye,Zn,"ψ","\\psi",!0);J(ae,ye,Zn,"ω","\\omega",!0);J(ae,ye,Zn,"ε","\\varepsilon",!0);J(ae,ye,Zn,"ϑ","\\vartheta",!0);J(ae,ye,Zn,"ϖ","\\varpi",!0);J(ae,ye,Zn,"ϱ","\\varrho",!0);J(ae,ye,Zn,"ς","\\varsigma",!0);J(ae,ye,Zn,"φ","\\varphi",!0);J(ae,ye,An,"∗","*",!0);J(ae,ye,An,"+","+");J(ae,ye,An,"−","-",!0);J(ae,ye,An,"⋅","\\cdot",!0);J(ae,ye,An,"∘","\\circ",!0);J(ae,ye,An,"÷","\\div",!0);J(ae,ye,An,"±","\\pm",!0);J(ae,ye,An,"×","\\times",!0);J(ae,ye,An,"∩","\\cap",!0);J(ae,ye,An,"∪","\\cup",!0);J(ae,ye,An,"∖","\\setminus",!0);J(ae,ye,An,"∧","\\land");J(ae,ye,An,"∨","\\lor");J(ae,ye,An,"∧","\\wedge",!0);J(ae,ye,An,"∨","\\vee",!0);J(ae,ye,xt,"√","\\surd");J(ae,ye,pu,"⟨","\\langle",!0);J(ae,ye,pu,"∣","\\lvert");J(ae,ye,pu,"∥","\\lVert");J(ae,ye,ql,"?","?");J(ae,ye,ql,"!","!");J(ae,ye,ql,"⟩","\\rangle",!0);J(ae,ye,ql,"∣","\\rvert");J(ae,ye,ql,"∥","\\rVert");J(ae,ye,tt,"=","=");J(ae,ye,tt,":",":");J(ae,ye,tt,"≈","\\approx",!0);J(ae,ye,tt,"≅","\\cong",!0);J(ae,ye,tt,"≥","\\ge");J(ae,ye,tt,"≥","\\geq",!0);J(ae,ye,tt,"←","\\gets");J(ae,ye,tt,">","\\gt",!0);J(ae,ye,tt,"∈","\\in",!0);J(ae,ye,tt,"","\\@not");J(ae,ye,tt,"⊂","\\subset",!0);J(ae,ye,tt,"⊃","\\supset",!0);J(ae,ye,tt,"⊆","\\subseteq",!0);J(ae,ye,tt,"⊇","\\supseteq",!0);J(ae,Je,tt,"⊈","\\nsubseteq",!0);J(ae,Je,tt,"⊉","\\nsupseteq",!0);J(ae,ye,tt,"⊨","\\models");J(ae,ye,tt,"←","\\leftarrow",!0);J(ae,ye,tt,"≤","\\le");J(ae,ye,tt,"≤","\\leq",!0);J(ae,ye,tt,"<","\\lt",!0);J(ae,ye,tt,"→","\\rightarrow",!0);J(ae,ye,tt,"→","\\to");J(ae,Je,tt,"≱","\\ngeq",!0);J(ae,Je,tt,"≰","\\nleq",!0);J(ae,ye,Cp," ","\\ ");J(ae,ye,Cp," ","\\space");J(ae,ye,Cp," ","\\nobreakspace");J(Qt,ye,Cp," ","\\ ");J(Qt,ye,Cp," "," ");J(Qt,ye,Cp," ","\\space");J(Qt,ye,Cp," ","\\nobreakspace");J(ae,ye,Cp,null,"\\nobreak");J(ae,ye,Cp,null,"\\allowbreak");J(ae,ye,YT,",",",");J(ae,ye,YT,";",";");J(ae,Je,An,"⊼","\\barwedge",!0);J(ae,Je,An,"⊻","\\veebar",!0);J(ae,ye,An,"⊙","\\odot",!0);J(ae,ye,An,"⊕","\\oplus",!0);J(ae,ye,An,"⊗","\\otimes",!0);J(ae,ye,xt,"∂","\\partial",!0);J(ae,ye,An,"⊘","\\oslash",!0);J(ae,Je,An,"⊚","\\circledcirc",!0);J(ae,Je,An,"⊡","\\boxdot",!0);J(ae,ye,An,"△","\\bigtriangleup");J(ae,ye,An,"▽","\\bigtriangledown");J(ae,ye,An,"†","\\dagger");J(ae,ye,An,"⋄","\\diamond");J(ae,ye,An,"⋆","\\star");J(ae,ye,An,"◃","\\triangleleft");J(ae,ye,An,"▹","\\triangleright");J(ae,ye,pu,"{","\\{");J(Qt,ye,xt,"{","\\{");J(Qt,ye,xt,"{","\\textbraceleft");J(ae,ye,ql,"}","\\}");J(Qt,ye,xt,"}","\\}");J(Qt,ye,xt,"}","\\textbraceright");J(ae,ye,pu,"{","\\lbrace");J(ae,ye,ql,"}","\\rbrace");J(ae,ye,pu,"[","\\lbrack",!0);J(Qt,ye,xt,"[","\\lbrack",!0);J(ae,ye,ql,"]","\\rbrack",!0);J(Qt,ye,xt,"]","\\rbrack",!0);J(ae,ye,pu,"(","\\lparen",!0);J(ae,ye,ql,")","\\rparen",!0);J(Qt,ye,xt,"<","\\textless",!0);J(Qt,ye,xt,">","\\textgreater",!0);J(ae,ye,pu,"⌊","\\lfloor",!0);J(ae,ye,ql,"⌋","\\rfloor",!0);J(ae,ye,pu,"⌈","\\lceil",!0);J(ae,ye,ql,"⌉","\\rceil",!0);J(ae,ye,xt,"\\","\\backslash");J(ae,ye,xt,"∣","|");J(ae,ye,xt,"∣","\\vert");J(Qt,ye,xt,"|","\\textbar",!0);J(ae,ye,xt,"∥","\\|");J(ae,ye,xt,"∥","\\Vert");J(Qt,ye,xt,"∥","\\textbardbl");J(Qt,ye,xt,"~","\\textasciitilde");J(Qt,ye,xt,"\\","\\textbackslash");J(Qt,ye,xt,"^","\\textasciicircum");J(ae,ye,tt,"↑","\\uparrow",!0);J(ae,ye,tt,"⇑","\\Uparrow",!0);J(ae,ye,tt,"↓","\\downarrow",!0);J(ae,ye,tt,"⇓","\\Downarrow",!0);J(ae,ye,tt,"↕","\\updownarrow",!0);J(ae,ye,tt,"⇕","\\Updownarrow",!0);J(ae,ye,$o,"∐","\\coprod");J(ae,ye,$o,"⋁","\\bigvee");J(ae,ye,$o,"⋀","\\bigwedge");J(ae,ye,$o,"⨄","\\biguplus");J(ae,ye,$o,"⋂","\\bigcap");J(ae,ye,$o,"⋃","\\bigcup");J(ae,ye,$o,"∫","\\int");J(ae,ye,$o,"∫","\\intop");J(ae,ye,$o,"∬","\\iint");J(ae,ye,$o,"∭","\\iiint");J(ae,ye,$o,"∏","\\prod");J(ae,ye,$o,"∑","\\sum");J(ae,ye,$o,"⨂","\\bigotimes");J(ae,ye,$o,"⨁","\\bigoplus");J(ae,ye,$o,"⨀","\\bigodot");J(ae,ye,$o,"∮","\\oint");J(ae,ye,$o,"∯","\\oiint");J(ae,ye,$o,"∰","\\oiiint");J(ae,ye,$o,"⨆","\\bigsqcup");J(ae,ye,$o,"∫","\\smallint");J(Qt,ye,Oy,"…","\\textellipsis");J(ae,ye,Oy,"…","\\mathellipsis");J(Qt,ye,Oy,"…","\\ldots",!0);J(ae,ye,Oy,"…","\\ldots",!0);J(ae,ye,Oy,"⋯","\\@cdots",!0);J(ae,ye,Oy,"⋱","\\ddots",!0);J(ae,ye,xt,"⋮","\\varvdots");J(Qt,ye,xt,"⋮","\\varvdots");J(ae,ye,Us,"ˊ","\\acute");J(ae,ye,Us,"ˋ","\\grave");J(ae,ye,Us,"¨","\\ddot");J(ae,ye,Us,"~","\\tilde");J(ae,ye,Us,"ˉ","\\bar");J(ae,ye,Us,"˘","\\breve");J(ae,ye,Us,"ˇ","\\check");J(ae,ye,Us,"^","\\hat");J(ae,ye,Us,"⃗","\\vec");J(ae,ye,Us,"˙","\\dot");J(ae,ye,Us,"˚","\\mathring");J(ae,ye,Zn,"","\\@imath");J(ae,ye,Zn,"","\\@jmath");J(ae,ye,xt,"ı","ı");J(ae,ye,xt,"ȷ","ȷ");J(Qt,ye,xt,"ı","\\i",!0);J(Qt,ye,xt,"ȷ","\\j",!0);J(Qt,ye,xt,"ß","\\ss",!0);J(Qt,ye,xt,"æ","\\ae",!0);J(Qt,ye,xt,"œ","\\oe",!0);J(Qt,ye,xt,"ø","\\o",!0);J(Qt,ye,xt,"Æ","\\AE",!0);J(Qt,ye,xt,"Œ","\\OE",!0);J(Qt,ye,xt,"Ø","\\O",!0);J(Qt,ye,Us,"ˊ","\\'");J(Qt,ye,Us,"ˋ","\\`");J(Qt,ye,Us,"ˆ","\\^");J(Qt,ye,Us,"˜","\\~");J(Qt,ye,Us,"ˉ","\\=");J(Qt,ye,Us,"˘","\\u");J(Qt,ye,Us,"˙","\\.");J(Qt,ye,Us,"¸","\\c");J(Qt,ye,Us,"˚","\\r");J(Qt,ye,Us,"ˇ","\\v");J(Qt,ye,Us,"¨",'\\"');J(Qt,ye,Us,"˝","\\H");J(Qt,ye,Us,"◯","\\textcircled");var bq={"--":!0,"---":!0,"``":!0,"''":!0};J(Qt,ye,xt,"–","--",!0);J(Qt,ye,xt,"–","\\textendash");J(Qt,ye,xt,"—","---",!0);J(Qt,ye,xt,"—","\\textemdash");J(Qt,ye,xt,"‘","`",!0);J(Qt,ye,xt,"‘","\\textquoteleft");J(Qt,ye,xt,"’","'",!0);J(Qt,ye,xt,"’","\\textquoteright");J(Qt,ye,xt,"“","``",!0);J(Qt,ye,xt,"“","\\textquotedblleft");J(Qt,ye,xt,"”","''",!0);J(Qt,ye,xt,"”","\\textquotedblright");J(ae,ye,xt,"°","\\degree",!0);J(Qt,ye,xt,"°","\\degree");J(Qt,ye,xt,"°","\\textdegree",!0);J(ae,ye,xt,"£","\\pounds");J(ae,ye,xt,"£","\\mathsterling",!0);J(Qt,ye,xt,"£","\\pounds");J(Qt,ye,xt,"£","\\textsterling",!0);J(ae,Je,xt,"✠","\\maltese");J(Qt,Je,xt,"✠","\\maltese");var bL='0123456789/@."';for(var DA=0;DA<bL.length;DA++){var _L=bL.charAt(DA);J(ae,ye,xt,_L,_L)}var SL='0123456789!@*()-=+";:?/.,';for(var PA=0;PA<SL.length;PA++){var wL=SL.charAt(PA);J(Qt,ye,xt,wL,wL)}var H2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var IA=0;IA<H2.length;IA++){var _4=H2.charAt(IA);J(ae,ye,Zn,_4,_4),J(Qt,ye,xt,_4,_4)}J(ae,Je,xt,"C","ℂ");J(Qt,Je,xt,"C","ℂ");J(ae,Je,xt,"H","ℍ");J(Qt,Je,xt,"H","ℍ");J(ae,Je,xt,"N","ℕ");J(Qt,Je,xt,"N","ℕ");J(ae,Je,xt,"P","ℙ");J(Qt,Je,xt,"P","ℙ");J(ae,Je,xt,"Q","ℚ");J(Qt,Je,xt,"Q","ℚ");J(ae,Je,xt,"R","ℝ");J(Qt,Je,xt,"R","ℝ");J(ae,Je,xt,"Z","ℤ");J(Qt,Je,xt,"Z","ℤ");J(ae,ye,Zn,"h","ℎ");J(Qt,ye,Zn,"h","ℎ");var dr="";for(var Il=0;Il<H2.length;Il++){var fo=H2.charAt(Il);dr=String.fromCharCode(55349,56320+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56372+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56424+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56580+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56684+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56736+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56788+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56840+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56944+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),Il<26&&(dr=String.fromCharCode(55349,56632+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr),dr=String.fromCharCode(55349,56476+Il),J(ae,ye,Zn,fo,dr),J(Qt,ye,xt,fo,dr))}dr="𝕜";J(ae,ye,Zn,"k",dr);J(Qt,ye,xt,"k",dr);for(var dg=0;dg<10;dg++){var y0=dg.toString();dr=String.fromCharCode(55349,57294+dg),J(ae,ye,Zn,y0,dr),J(Qt,ye,xt,y0,dr),dr=String.fromCharCode(55349,57314+dg),J(ae,ye,Zn,y0,dr),J(Qt,ye,xt,y0,dr),dr=String.fromCharCode(55349,57324+dg),J(ae,ye,Zn,y0,dr),J(Qt,ye,xt,y0,dr),dr=String.fromCharCode(55349,57334+dg),J(ae,ye,Zn,y0,dr),J(Qt,ye,xt,y0,dr)}var NR="ÐÞþ";for(var OA=0;OA<NR.length;OA++){var S4=NR.charAt(OA);J(ae,ye,Zn,S4,S4),J(Qt,ye,xt,S4,S4)}var w4=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],ML=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],aye=function(e,n){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,o=n==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[w4[a][2],w4[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[ML[l][2],ML[l][o]]}else{if(s===120485||s===120486)return[w4[0][2],w4[0][o]];if(120486<s&&s<120782)return["",""];throw new on("Unsupported character: "+e)}},KT=function(e,n,r){return hs[r][e]&&hs[r][e].replace&&(e=hs[r][e].replace),{value:e,metrics:A8(e,n,r)}},Fl=function(e,n,r,i,s){var o=KT(e,n,r),a=o.metrics;e=o.value;var l;if(a){var c=a.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new nd(e,a.height,a.depth,c,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new nd(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var d=i.getColor();d&&(l.style.color=d)}return l},R8=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&KT(e,"Main-Bold",n).metrics?Fl(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||hs[n][e].font==="main"?Fl(e,"Main-Regular",n,r,i):Fl(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},lye=function(e,n,r,i,s){return s!=="textord"&&KT(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},ZT=function(e,n,r){var i=e.mode,s=e.text,o=["mord"],a=i==="math"||i==="text"&&n.font,l=a?n.font:n.fontFamily,c="",d="";if(s.charCodeAt(0)===55349&&([c,d]=aye(s,i)),c.length>0)return Fl(s,c,i,n,o.concat(d));if(l){var p,m;if(l==="boldsymbol"){var x=lye(s,i,n,o,r);p=x.fontName,m=[x.fontClass]}else a?(p=RR[l].fontName,m=[l]):(p=M4(l,n.fontWeight,n.fontShape),m=[l,n.fontWeight,n.fontShape]);if(KT(s,p,i).metrics)return Fl(s,p,i,n,o.concat(m));if(bq.hasOwnProperty(s)&&p.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Fl(s[_],p,i,n,o.concat(m)));return Ep(b)}}if(r==="mathord")return Fl(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var S=hs[i][s]&&hs[i][s].font;if(S==="ams"){var w=M4("amsrm",n.fontWeight,n.fontShape);return Fl(s,w,i,n,o.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var C=M4("textrm",n.fontWeight,n.fontShape);return Fl(s,C,i,n,o.concat(n.fontWeight,n.fontShape))}else{var A=M4(S,n.fontWeight,n.fontShape);return Fl(s,A,i,n,o.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},cye=(t,e)=>{if(nm(t.classes)!==nm(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&t.style[i]!==e.style[i])return!1;return!0},_q=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof nd&&r instanceof nd&&cye(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,t.splice(e+1,1),e--)}return t},k8=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},tn=function(e,n,r,i){var s=new yw(e,n,r,i);return k8(s),s},im=(t,e,n,r)=>new yw(t,e,n,r),oy=function(e,n,r){var i=tn([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=mn(i.height),i.maxFontSize=1,i},uye=function(e,n,r,i){var s=new N8(e,n,r,i);return k8(s),s},Ep=function(e){var n=new vw(e);return k8(n),n},ay=function(e,n){return e instanceof vw?tn([],[e],n):e},dye=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,o=1;o<n.length;o++){var a=-n[o].shift-s-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);s=s+a,r.push({type:"kern",size:l}),r.push(n[o])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var d=e.positionData,p=0;p<e.children.length;p++){var m=e.children[p];d-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}c=d}else if(e.positionType==="bottom")c=-e.positionData;else{var x=e.children[0];if(x.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-x.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-x.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Ci=function(e,n){for(var{children:r,depth:i}=dye(e),s=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=tn(["pstrut"],[]);c.style.height=mn(s);for(var d=[],p=i,m=i,x=i,b=0;b<r.length;b++){var _=r[b];if(_.type==="kern")x+=_.size;else{var S=_.elem,w=_.wrapperClasses||[],C=_.wrapperStyle||{},A=tn(w,[c,S],void 0,C);A.style.top=mn(-s-x-S.depth),_.marginLeft&&(A.style.marginLeft=_.marginLeft),_.marginRight&&(A.style.marginRight=_.marginRight),d.push(A),x+=S.height+S.depth}p=Math.min(p,x),m=Math.max(m,x)}var N=tn(["vlist"],d);N.style.height=mn(m);var D;if(p<0){var P=tn([],[]),O=tn(["vlist"],[P]);O.style.height=mn(-p);var R=tn(["vlist-s"],[new nd("​")]);D=[tn(["vlist-r"],[N,R]),tn(["vlist-r"],[O])]}else D=[tn(["vlist-r"],[N])];var L=tn(["vlist-t"],D);return D.length===2&&L.classes.push("vlist-t2"),L.height=m,L.depth=-p,L},Sq=(t,e)=>{var n=tn(["mspace"],[],e),r=Qs(t,e);return n.style.marginRight=mn(r),n},M4=function(e,n,r){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return n==="textbf"&&r==="textit"?s="BoldItalic":n==="textbf"?s="Bold":n==="textit"?s="Italic":s="Regular",i+"-"+s},RR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},wq={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Mq=function(e,n){var[r,i,s]=wq[e],o=new rm(r),a=new vp([o],{width:mn(i),height:mn(s),style:"width:"+mn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=im(["overlay"],[a],n);return l.height=s,l.style.height=mn(s),l.style.width=mn(i),l},Ks={number:3,unit:"mu"},fg={number:4,unit:"mu"},qh={number:5,unit:"mu"},fye={mord:{mop:Ks,mbin:fg,mrel:qh,minner:Ks},mop:{mord:Ks,mop:Ks,mrel:qh,minner:Ks},mbin:{mord:fg,mop:fg,mopen:fg,minner:fg},mrel:{mord:qh,mop:qh,mopen:qh,minner:qh},mopen:{},mclose:{mop:Ks,mbin:fg,mrel:qh,minner:Ks},mpunct:{mord:Ks,mop:Ks,mrel:qh,mopen:Ks,mclose:Ks,mpunct:Ks,minner:Ks},minner:{mord:Ks,mop:Ks,mbin:fg,mrel:qh,mopen:Ks,mpunct:Ks,minner:Ks}},hye={mord:{mop:Ks},mop:{mord:Ks,mop:Ks},mbin:{},mrel:{},mopen:{},mclose:{mop:Ks},mpunct:{},minner:{mop:Ks}},Tq={},V2={},G2={};function Tn(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},l=0;l<n.length;++l)Tq[n[l]]=a;e&&(s&&(V2[e]=s),o&&(G2[e]=o))}function Rx(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;Tn({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var W2=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},To=function(e){return e.type==="ordgroup"?e.body:[e]},pye=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),mye=new Set(["rightmost","mrel","mclose","mpunct"]),gye={display:gr.DISPLAY,text:gr.TEXT,script:gr.SCRIPT,scriptscript:gr.SCRIPTSCRIPT},xye={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},fa=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=bi(e[o],n);if(a instanceof vw){var l=a.children;s.push(...l)}else s.push(a)}if(_q(s),!r)return s;var c=n;if(e.length===1){var d=e[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(gye[d.style]))}var p=tn([i[0]||"leftmost"],[],n),m=tn([i[1]||"rightmost"],[],n),x=r==="root";return TL(s,(b,_)=>{var S=_.classes[0],w=b.classes[0];S==="mbin"&&mye.has(w)?_.classes[0]="mord":w==="mbin"&&pye.has(S)&&(b.classes[0]="mord")},{node:p},m,x),TL(s,(b,_)=>{var S=kR(_),w=kR(b),C=S&&w?b.hasClass("mtight")?hye[S][w]:fye[S][w]:null;if(C)return Sq(C,c)},{node:p},m,x),s},TL=function t(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Cq(a);if(l){t(l.children,n,r,null,s);continue}var c=!a.hasClass("mspace");if(c){var d=n(a,r.node);d&&(r.insertAfter?r.insertAfter(d):(e.unshift(d),o++))}c?r.node=a:s&&a.hasClass("newline")&&(r.node=tn(["leftmost"])),r.insertAfter=(p=>m=>{e.splice(p+1,0,m),o++})(o)}i&&e.pop()},Cq=function(e){return e instanceof vw||e instanceof N8||e instanceof yw&&e.hasClass("enclosing")?e:null},vye=function t(e,n){var r=Cq(e);if(r){var i=r.children;if(i.length){if(n==="right")return t(i[i.length-1],"right");if(n==="left")return t(i[0],"left")}}return e},kR=function(e,n){return e?(n&&(e=vye(e,n)),xye[e.classes[0]]||null):null},bS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return tn(n.concat(r))},bi=function(e,n,r){if(!e)return tn();if(V2[e.type]){var i=V2[e.type](e,n);if(r&&n.size!==r.size){i=tn(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new on("Got group of unknown type: '"+e.type+"'")};function T4(t,e){var n=tn(["base"],t,e),r=tn(["strut"]);return r.style.height=mn(n.height+n.depth),n.depth&&(r.style.verticalAlign=mn(-n.depth)),n.children.unshift(r),n}function DR(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=fa(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(s.push(T4(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(T4(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(T4(o,e));var c;n?(c=T4(fa(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var d=tn(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),c){var p=c.children[0];p.style.height=mn(d.height+d.depth),d.depth&&(p.style.verticalAlign=mn(-d.depth))}return d}function Eq(t){return new vw(t)}class an{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=nm(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Go&&this.children[r+1]instanceof Go){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Go;)i+=this.children[++r].toText();e.appendChild(new Go(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=gl(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+gl(nm(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Go{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return gl(this.toText())}toText(){return this.text}}class Aq{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",mn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+mn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var yye=new Set(["\\imath","\\jmath"]),bye=new Set(["mrow","mtable"]),rd=function(e,n,r){return hs[n][e]&&hs[n][e].replace&&e.charCodeAt(0)!==55349&&!(bq.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=hs[n][e].replace),new Go(e)},D8=function(e){return e.length===1?e[0]:new an("mrow",e)},P8=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var i=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var s=e.text;if(yye.has(s))return null;hs[i][s]&&hs[i][s].replace&&(s=hs[i][s].replace);var o=RR[r].fontName;return A8(s,o,i)?RR[r].variant:null};function LA(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Go&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof Go&&n.text===","}else return!1}var Dc=function(e,n,r){if(e.length===1){var i=is(e[0],n);return r&&i instanceof an&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=is(e[a],n);if(l instanceof an&&o instanceof an){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(LA(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&LA(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||LA(o))){var c=l.children[0];c instanceof an&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Go&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var p=l.children[0];p instanceof Go&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),s.pop())}}}s.push(l),o=l}return s},sm=function(e,n,r){return D8(Dc(e,n,r))},is=function(e,n){if(!e)return new an("mrow");if(G2[e.type]){var r=G2[e.type](e,n);return r}else throw new on("Got group of unknown type: '"+e.type+"'")};function CL(t,e,n,r,i){var s=Dc(t,n),o;s.length===1&&s[0]instanceof an&&bye.has(s[0].type)?o=s[0]:o=new an("mrow",s);var a=new an("annotation",[new Go(e)]);a.setAttribute("encoding","application/x-tex");var l=new an("semantics",[o,a]),c=new an("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var d=i?"katex":"katex-mathml";return tn([d],[c])}var Nq=function(e){return new np({style:e.displayMode?gr.DISPLAY:gr.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Rq=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=tn(r,[e])}return e},_ye=function(e,n,r){var i=Nq(r),s;if(r.output==="mathml")return CL(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=DR(e,i);s=tn(["katex"],[o])}else{var a=CL(e,n,i,r.displayMode,!1),l=DR(e,i);s=tn(["katex"],[a,l])}return Rq(s,r)},Sye=function(e,n,r){var i=Nq(r),s=DR(e,i),o=tn(["katex"],[s]);return Rq(o,r)},wye={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},QT=function(e){var n=new an("mo",[new Go(wye[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Mye={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Tye=new Set(["widehat","widecheck","widetilde","utilde"]),JT=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if(Tye.has(l)){var c=e,d=c.base.type==="ordgroup"?c.base.body.length:1,p,m,x;if(d>5)l==="widehat"||l==="widecheck"?(p=420,a=2364,x=.42,m=l+"4"):(p=312,a=2340,x=.34,m="tilde4");else{var b=[1,1,2,2,3,3][d];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],x=[0,.24,.3,.3,.36,.42][b],m=l+b):(a=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],x=[0,.26,.286,.3,.306,.34][b],m="tilde"+b)}var _=new rm(m),S=new vp([_],{width:"100%",height:mn(x),viewBox:"0 0 "+a+" "+p,preserveAspectRatio:"none"});return{span:im([],[S],n),minWidth:0,height:x}}else{var w=[],C=Mye[l],[A,N,D]=C,P=D/1e3,O=A.length,R,L;if(O===1){var V=C[3];R=["hide-tail"],L=[V]}else if(O===2)R=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(O===3)R=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+O+" children.");for(var F=0;F<O;F++){var U=new rm(A[F]),W=new vp([U],{width:"400em",height:mn(P),viewBox:"0 0 "+a+" "+D,preserveAspectRatio:L[F]+" slice"}),Y=im([R[F]],[W],n);if(O===1)return{span:Y,minWidth:N,height:P};Y.style.height=mn(P),w.push(Y)}return{span:tn(["stretchy"],w,n),minWidth:N,height:P}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=mn(o),s>0&&(i.style.minWidth=mn(s)),i},Cye=function(e,n,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(o=tn(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new AR({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new AR({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new vp(c,{width:"100%",height:mn(a)});o=im([],[d],s)}return o.height=a,o.style.height=mn(a),o};function Or(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function I8(t){var e=eC(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function eC(t){return t&&(t.type==="atom"||oye.hasOwnProperty(t.type))?t:null}var O8=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Or(t.base,"accent"),n=r.base,t.base=n,i=iye(bi(t,e)),t.base=r):(r=Or(t,"accent"),n=r.base);var s=bi(n,e.havingCrampedStyle()),o=r.isShifty&&Tp(n),a=0;if(o){var l=z_(n),c=bi(l,e.havingCrampedStyle());a=yL(c).skew}var d=r.label==="\\c",p=d?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),m;if(r.isStretchy)m=JT(r,e),m=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+mn(2*a)+")",marginLeft:mn(2*a)}:void 0}]});else{var x,b;r.label==="\\vec"?(x=Mq("vec",e),b=wq.vec[1]):(x=ZT({mode:r.mode,text:r.label},e,"textord"),x=yL(x),x.italic=0,b=x.width,d&&(p+=x.depth)),m=tn(["accent-body"],[x]);var _=r.label==="\\textcircled";_&&(m.classes.push("accent-full"),p=s.height);var S=a;_||(S-=b/2),m.style.left=mn(S),r.label==="\\textcircled"&&(m.style.top=".2em"),m=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-p},{type:"elem",elem:m}]})}var w=tn(["mord","accent"],[m],e);return i?(i.children[0]=w,i.height=Math.max(w.height,i.height),i.classes[0]="mord",i):w},kq=(t,e)=>{var n=t.isStretchy?QT(t.label):new an("mo",[rd(t.label,t.mode)]),r=new an("mover",[is(t.base,e),n]);return r.setAttribute("accent","true"),r},Eye=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Tn({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=W2(e[0]),r=!Eye.test(t.funcName),i=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:O8,mathmlBuilder:kq});Tn({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:O8,mathmlBuilder:kq});Tn({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(t,e)=>{var n=bi(t.base,e),r=JT(t,e),i=t.label==="\\utilde"?.12:0,s=Ci({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return tn(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=QT(t.label),r=new an("munder",[is(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var C4=t=>{var e=new an("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Tn({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:i}=t;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),i=ay(bi(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;t.below&&(r=e.havingStyle(n.sub()),o=ay(bi(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=JT(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var d;if(o){var p=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=Ci({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:p}]})}else d=Ci({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]});return d.children[0].children[0].children[1].classes.push("svg-align"),tn(["mrel","x-arrow"],[d],e)},mathmlBuilder(t,e){var n=QT(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=C4(is(t.body,e));if(t.below){var s=C4(is(t.below,e));r=new an("munderover",[n,s,i])}else r=new an("mover",[n,i])}else if(t.below){var o=C4(is(t.below,e));r=new an("munder",[n,o])}else r=C4(),r=new an("mover",[n,r]);return r}});function Dq(t,e){var n=fa(t.body,e,!0);return tn([t.mclass],n,e)}function Pq(t,e){var n,r=Dc(t.body,e);return t.mclass==="minner"?n=new an("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new an("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new an("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Tn({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:To(i),isCharacterBox:Tp(i)}},htmlBuilder:Dq,mathmlBuilder:Pq});var tC=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Tn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:tC(e[0]),body:To(e[1]),isCharacterBox:Tp(e[1])}}});Tn({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,i=e[1],s=e[0],o;r!=="\\stackrel"?o=tC(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:To(i)},l={type:"supsub",mode:s.mode,base:a,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:Tp(l)}},htmlBuilder:Dq,mathmlBuilder:Pq});Tn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:tC(e[0]),body:To(e[0])}},htmlBuilder(t,e){var n=fa(t.body,e,!0),r=tn([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Dc(t.body,e),r=new an("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Aye={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},EL=()=>({type:"styling",body:[],mode:"math",style:"display"}),AL=t=>t.type==="textord"&&t.text==="@",Nye=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Rye(t,e,n){var r=Aye[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=n.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[s],[]),a=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function kye(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new on("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=EL(),l=0;l<o.length;l++)if(!AL(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=I8(o[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var p=0;p<2;p++){for(var m=!0,x=l+1;x<o.length;x++){if(Nye(o[x],c)){m=!1,l=x;break}if(AL(o[x]))throw new on("Missing a "+c+" character to complete a CD arrow.",o[x]);d[p].body.push(o[x])}if(m)throw new on("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new on('Expected one of "<>AV=|." after @',o[l]);var b=Rye(c,d,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),a=EL()}s%2===0?r.push(a):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Tn({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ay(bi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=mn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new an("mrow",[is(t.label,e)]);return n=new an("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new an("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Tn({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ay(bi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new an("mrow",[is(t.fragment,e)])}});Tn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Or(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var a=Or(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new on("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new on("\\@char with invalid code point "+s);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var Iq=(t,e)=>{var n=fa(t.body,e.withColor(t.color),!1);return Ep(n)},Oq=(t,e)=>{var n=Dc(t.body,e.withColor(t.color)),r=new an("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Tn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Or(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:To(i)}},htmlBuilder:Iq,mathmlBuilder:Oq});Tn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Or(e[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var s=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:s}},htmlBuilder:Iq,mathmlBuilder:Oq});Tn({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&Or(i,"size").value}},htmlBuilder(t,e){var n=tn(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=mn(Qs(t.size,e)))),n},mathmlBuilder(t,e){var n=new an("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",mn(Qs(t.size,e)))),n}});var PR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Lq=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new on("Expected a control sequence",t);return e},Dye=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},jq=(t,e,n,r)=>{var i=t.gullet.macros.get(n.text);i==null&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,i,r)};Tn({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(PR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=PR[r.text]),Or(e.parseFunction(),"internal");throw new on("Invalid token after macro prefix",r)}});Tn({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new on("Expected a control sequence",r);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new on('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new on('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new on("Expected a macro definition");a[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},n===PR[n]),{type:"internal",mode:e.mode}}});Tn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=Lq(e.gullet.popToken());e.gullet.consumeSpaces();var i=Dye(e);return jq(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Tn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=Lq(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return jq(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var M_=function(e,n,r){var i=hs.math[e]&&hs.math[e].replace,s=A8(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},L8=function(e,n,r,i){var s=r.havingBaseStyle(n),o=tn(i.concat(s.sizingClasses(r)),[e],r),a=s.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},zq=function(e,n,r){var i=n.havingBaseStyle(r),s=(1-n.sizeMultiplier/i.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=mn(s),e.height-=s,e.depth+=s},Pye=function(e,n,r,i,s,o){var a=Fl(e,"Main-Regular",s,i),l=L8(a,n,i,o);return zq(l,i,n),l},Iye=function(e,n,r,i){return Fl(e,"Size"+n+"-Regular",r,i)},Fq=function(e,n,r,i,s,o){var a=Iye(e,n,s,i),l=L8(tn(["delimsizing","size"+n],[a],i),gr.TEXT,i,o);return r&&zq(l,i,gr.TEXT),l},jA=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=tn(["delimsizinginner",i],[tn([],[Fl(e,n,r)])]);return{type:"elem",elem:s}},zA=function(e,n,r){var i=Qf["Size4-Regular"][e.charCodeAt(0)]?Qf["Size4-Regular"][e.charCodeAt(0)][4]:Qf["Size1-Regular"][e.charCodeAt(0)][4],s=new rm("inner",Y1e(e,Math.round(1e3*n))),o=new vp([s],{width:mn(i),height:mn(n),style:"width:"+mn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=im([],[o],r);return a.height=n,a.style.height=mn(n),a.style.width=mn(i),{type:"elem",elem:a}},IR=.008,E4={type:"kern",size:-1*IR},Oye=new Set(["|","\\lvert","\\rvert","\\vert"]),Lye=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Uq=function(e,n,r,i,s,o){var a,l,c,d,p="",m=0;a=c=d=e,l=null;var x="Size1-Regular";e==="\\uparrow"?c=d="⏐":e==="\\Uparrow"?c=d="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",d="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",d="\\Downarrow"):Oye.has(e)?(c="∣",p="vert",m=333):Lye.has(e)?(c="∥",p="doublevert",m=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",d="⎣",x="Size4-Regular",p="lbrack",m=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",d="⎦",x="Size4-Regular",p="rbrack",m=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",d="⎣",x="Size4-Regular",p="lfloor",m=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=d="⎢",x="Size4-Regular",p="lceil",m=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",d="⎦",x="Size4-Regular",p="rfloor",m=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=d="⎥",x="Size4-Regular",p="rceil",m=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",d="⎝",x="Size4-Regular",p="lparen",m=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",d="⎠",x="Size4-Regular",p="rparen",m=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",d="⎩",c="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",d="⎭",c="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",d="⎩",c="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",d="⎭",c="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",d="⎭",c="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",d="⎩",c="⎪",x="Size4-Regular");var b=M_(a,x,s),_=b.height+b.depth,S=M_(c,x,s),w=S.height+S.depth,C=M_(d,x,s),A=C.height+C.depth,N=0,D=1;if(l!==null){var P=M_(l,x,s);N=P.height+P.depth,D=2}var O=_+A+N,R=Math.max(0,Math.ceil((n-O)/(D*w))),L=O+R*D*w,V=i.fontMetrics().axisHeight;r&&(V*=i.sizeMultiplier);var F=L/2-V,U=[];if(p.length>0){var W=L-_-A,Y=Math.round(L*1e3),$=K1e(p,Math.round(W*1e3)),X=new rm(p,$),Z=(m/1e3).toFixed(3)+"em",K=(Y/1e3).toFixed(3)+"em",ne=new vp([X],{width:Z,height:K,viewBox:"0 0 "+m+" "+Y}),H=im([],[ne],i);H.height=Y/1e3,H.style.width=Z,H.style.height=K,U.push({type:"elem",elem:H})}else{if(U.push(jA(d,x,s)),U.push(E4),l===null){var B=L-_-A+2*IR;U.push(zA(c,B,i))}else{var G=(L-_-A-N)/2+2*IR;U.push(zA(c,G,i)),U.push(E4),U.push(jA(l,x,s)),U.push(E4),U.push(zA(c,G,i))}U.push(E4),U.push(jA(a,x,s))}var j=i.havingBaseStyle(gr.TEXT),ie=Ci({positionType:"bottom",positionData:F,children:U});return L8(tn(["delimsizing","mult"],[ie],j),gr.TEXT,i,o)},FA=80,UA=.08,BA=function(e,n,r,i,s){var o=X1e(e,i,r),a=new rm(e,o),l=new vp([a],{width:"400em",height:mn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return im(["hide-tail"],[l],s)},jye=function(e,n){var r=n.havingBaseSizing(),i=Wq("\\surd",e*r.sizeMultiplier,Gq,r),s=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l=0,c=0,d=0,p;return i.type==="small"?(d=1e3+1e3*o+FA,e<1?s=1:e<1.4&&(s=.7),l=(1+o+UA)/s,c=(1+o)/s,a=BA("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",p=.833/s):i.type==="large"?(d=(1e3+FA)*F_[i.size],c=(F_[i.size]+o)/s,l=(F_[i.size]+o+UA)/s,a=BA("sqrtSize"+i.size,l,d,o,n),a.style.minWidth="1.02em",p=1/s):(l=e+o+UA,c=e+o,d=Math.floor(1e3*e+o)+FA,a=BA("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",p=1.056),a.height=c,a.style.height=mn(l),{span:a,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},Bq=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),zye=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Hq=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),F_=[0,1.2,1.8,2.4,3],Vq=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Bq.has(e)||Hq.has(e))return Fq(e,n,!1,r,i,s);if(zye.has(e))return Uq(e,F_[n],!1,r,i,s);throw new on("Illegal delimiter: '"+e+"'")},Fye=[{type:"small",style:gr.SCRIPTSCRIPT},{type:"small",style:gr.SCRIPT},{type:"small",style:gr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Uye=[{type:"small",style:gr.SCRIPTSCRIPT},{type:"small",style:gr.SCRIPT},{type:"small",style:gr.TEXT},{type:"stack"}],Gq=[{type:"small",style:gr.SCRIPTSCRIPT},{type:"small",style:gr.SCRIPT},{type:"small",style:gr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Bye=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},Wq=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),o=s;o<r.length&&r[o].type!=="stack";o++){var a=M_(e,Bye(r[o]),"math"),l=a.height+a.depth;if(r[o].type==="small"){var c=i.havingBaseStyle(r[o].style);l*=c.sizeMultiplier}if(l>n)return r[o]}return r[r.length-1]},OR=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;Hq.has(e)?a=Fye:Bq.has(e)?a=Gq:a=Uye;var l=Wq(e,n,a,i);return l.type==="small"?Pye(e,l.style,r,i,s,o):l.type==="large"?Fq(e,l.size,r,i,s,o):Uq(e,n,r,i,s,o)},HA=function(e,n,r,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,d=Math.max(n-a,r+a),p=Math.max(d/500*l,2*d-c);return OR(e,p,!0,i,s,o)},NL={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Hye=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function nC(t,e){var n=eC(t);if(n&&Hye.has(n.text))return n;throw n?new on("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new on("Invalid delimiter type '"+t.type+"'",t)}Tn({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=nC(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:NL[t.funcName].size,mclass:NL[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?tn([t.mclass]):Vq(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(rd(t.delim,t.mode));var n=new an("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=mn(F_[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function RL(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Tn({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new on("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:nC(e[0],t).text,color:n}}});Tn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=nC(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Or(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{RL(t);for(var n=fa(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,o=0;o<n.length;o++)n[o].isMiddle?s=!0:(r=Math.max(n[o].height,r),i=Math.max(n[o].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(t.left==="."?a=bS(e,["mopen"]):a=HA(t.left,r,i,e,t.mode,["mopen"]),n.unshift(a),s)for(var l=1;l<n.length;l++){var c=n[l],d=c.isMiddle;d&&(n[l]=HA(d.delim,r,i,d.options,t.mode,[]))}var p;if(t.right===".")p=bS(e,["mclose"]);else{var m=t.rightColor?e.withColor(t.rightColor):e;p=HA(t.right,r,i,m,t.mode,["mclose"])}return n.push(p),tn(["minner"],n,e)},mathmlBuilder:(t,e)=>{RL(t);var n=Dc(t.body,e);if(t.left!=="."){var r=new an("mo",[rd(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new an("mo",[rd(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return D8(n)}});Tn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=nC(e[0],t);if(!t.parser.leftrightDepth)throw new on("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=bS(e,[]);else{n=Vq(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?rd("|","text"):rd(t.delim,t.mode),r=new an("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var j8=(t,e)=>{var n=ay(bi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o=0,a=Tp(t.body);if(r==="sout")s=tn(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=Qs({number:.6,unit:"pt"},e),c=Qs({number:.35,unit:"ex"},e),d=e.havingBaseSizing();i=i/d.sizeMultiplier;var p=n.height+n.depth+l+c;n.style.paddingLeft=mn(p/2+l);var m=Math.floor(1e3*p*i),x=$1e(m),b=new vp([new rm("phase",x)],{width:"400em",height:mn(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});s=im(["hide-tail"],[b],e),s.style.height=mn(p),o=n.depth+l+c}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var _=0,S=0,w=0;/box/.test(r)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),_=e.fontMetrics().fboxsep+(r==="colorbox"?0:w),S=_):r==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),_=4*w,S=Math.max(0,.25-n.depth)):(_=a?.2:0,S=_),s=Cye(n,r,_,S,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=mn(w)):r==="angl"&&w!==.049&&(s.style.borderTopWidth=mn(w),s.style.borderRightWidth=mn(w)),o=n.depth+S,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var C;if(t.backgroundColor)C=Ci({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:n,shift:0}]});else{var A=/cancel|phase/.test(r)?["svg-align"]:[];C=Ci({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:A}]})}return/cancel/.test(r)&&(C.height=n.height,C.depth=n.depth),/cancel/.test(r)&&!a?tn(["mord","cancel-lap"],[C],e):tn(["mord"],[C],e)},z8=(t,e)=>{var n=0,r=new an(t.label.includes("colorbox")?"mpadded":"menclose",[is(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Tn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Or(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:j8,mathmlBuilder:z8});Tn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Or(e[0],"color-token").color,o=Or(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:j8,mathmlBuilder:z8});Tn({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Tn({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:j8,mathmlBuilder:z8});Tn({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var $q={};function gh(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)$q[n[l]]=a;s&&(V2[e]=s),o&&(G2[e]=o)}var qq={};function ze(t,e){qq[t]=e}function kL(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var rC=t=>{var e=t.parser.settings;if(!e.displayMode)throw new on("{"+t.envName+"} can be used only in display mode.")},Vye=new Set(["gather","gather*"]);function F8(t){if(!t.includes("ed"))return!t.includes("*")}function Sm(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:p,leqno:m}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!o){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)o=1;else if(o=parseFloat(x),!o||o<0)throw new on("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var b=[],_=[b],S=[],w=[],C=l!=null?[]:void 0;function A(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function N(){C&&(t.gullet.macros.get("\\df@tag")?(C.push(t.subparse([new su("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),w.push(kL(t));;){var D=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var P=t.fetch().text;if(P==="&"){if(p&&b.length===p){if(c||a)throw new on("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(P==="\\end"){N(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(_.length>1||!d)&&_.pop(),w.length<_.length+1&&w.push([]);break}else if(P==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),S.push(O?O.value:null),N(),w.push(kL(t)),b=[],_.push(b),A()}else throw new on("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:o,body:_,cols:s,rowGaps:S,hskipBeforeAndAfter:r,hLinesBeforeRow:w,colSeparationType:a,tags:C,leqno:m}}function U8(t){return t.slice(0,1)==="d"?"display":"text"}var xh=function(e,n){var r,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),p=1/n.fontMetrics().ptPerEm,m=5*p;if(e.colSeparationType&&e.colSeparationType==="small"){var x=n.havingStyle(gr.SCRIPT).sizeMultiplier;m=.2778*(x/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?Qs({number:3,unit:"ex"},n):12*p,_=3*p,S=e.arraystretch*b,w=.7*S,C=.3*S,A=0;function N(Fe){for(var Ue=0;Ue<Fe.length;++Ue)Ue>0&&(A+=.25),c.push({pos:A,isDashed:Fe[Ue]})}for(N(o[0]),r=0;r<e.body.length;++r){var D=e.body[r],P=w,O=C;a<D.length&&(a=D.length);var R=new Array(D.length);for(i=0;i<D.length;++i){var L=bi(D[i],n);O<L.depth&&(O=L.depth),P<L.height&&(P=L.height),R[i]=L}var V=e.rowGaps[r],F=0;V&&(F=Qs(V,n),F>0&&(F+=C,O<F&&(O=F),F=0)),e.addJot&&(O+=_),R.height=P,R.depth=O,A+=P,R.pos=A,A+=O+F,l[r]=R,N(o[r+1])}var U=A/2+n.fontMetrics().axisHeight,W=e.cols||[],Y=[],$,X,Z=[];if(e.tags&&e.tags.some(Fe=>Fe))for(r=0;r<s;++r){var K=l[r],ne=K.pos-U,H=e.tags[r],B=void 0;H===!0?B=tn(["eqn-num"],[],n):H===!1?B=tn([],[],n):B=tn([],fa(H,n,!0),n),B.depth=K.depth,B.height=K.height,Z.push({type:"elem",elem:B,shift:ne})}for(i=0,X=0;i<a||X<W.length;++i,++X){for(var G=W[X]||{},j=!0;G.type==="separator";){if(j||($=tn(["arraycolsep"],[]),$.style.width=mn(n.fontMetrics().doubleRuleSep),Y.push($)),G.separator==="|"||G.separator===":"){var ie=G.separator==="|"?"solid":"dashed",ce=tn(["vertical-separator"],[],n);ce.style.height=mn(A),ce.style.borderRightWidth=mn(d),ce.style.borderRightStyle=ie,ce.style.margin="0 "+mn(-d/2);var te=A-U;te&&(ce.style.verticalAlign=mn(-te)),Y.push(ce)}else throw new on("Invalid separator type: "+G.separator);X++,G=W[X]||{},j=!1}if(!(i>=a)){var se=void 0;if(i>0||e.hskipBeforeAndAfter){var le;se=(le=G.pregap)!=null?le:m,se!==0&&($=tn(["arraycolsep"],[]),$.style.width=mn(se),Y.push($))}var re=[];for(r=0;r<s;++r){var pe=l[r],be=pe[i];if(be){var xe=pe.pos-U;be.depth=pe.depth,be.height=pe.height,re.push({type:"elem",elem:be,shift:xe})}}if(re=Ci({positionType:"individualShift",children:re}),re=tn(["col-align-"+(G.align||"c")],[re]),Y.push(re),i<a-1||e.hskipBeforeAndAfter){var Pe;se=(Pe=G.postgap)!=null?Pe:m,se!==0&&($=tn(["arraycolsep"],[]),$.style.width=mn(se),Y.push($))}}}if(l=tn(["mtable"],Y),c.length>0){for(var me=oy("hline",n,d),ke=oy("hdashline",n,d),we=[{type:"elem",elem:l,shift:0}];c.length>0;){var Te=c.pop(),oe=Te.pos-U;Te.isDashed?we.push({type:"elem",elem:ke,shift:oe}):we.push({type:"elem",elem:me,shift:oe})}l=Ci({positionType:"individualShift",children:we})}if(Z.length===0)return tn(["mord"],[l],n);var _e=Ci({positionType:"individualShift",children:Z});return _e=tn(["tag"],[_e],n),Ep([l,_e])},Gye={c:"center ",l:"left ",r:"right "},vh=function(e,n){for(var r=[],i=new an("mtd",[],["mtr-glue"]),s=new an("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],c=0;c<a.length;c++)l.push(new an("mtd",[is(a[c],n)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new an("mtr",l))}var d=new an("mtable",r),p=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);d.setAttribute("rowspacing",mn(p));var m="",x="";if(e.cols&&e.cols.length>0){var b=e.cols,_="",S=!1,w=0,C=b.length;b[0].type==="separator"&&(m+="top ",w=1),b[b.length-1].type==="separator"&&(m+="bottom ",C-=1);for(var A=w;A<C;A++)b[A].type==="align"?(x+=Gye[b[A].align],S&&(_+="none "),S=!0):b[A].type==="separator"&&S&&(_+=b[A].separator==="|"?"solid ":"dashed ",S=!1);d.setAttribute("columnalign",x.trim()),/[sd]/.test(_)&&d.setAttribute("columnlines",_.trim())}if(e.colSeparationType==="align"){for(var N=e.cols||[],D="",P=1;P<N.length;P++)D+=P%2?"0em ":"1em ";d.setAttribute("columnspacing",D.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var O="",R=e.hLinesBeforeRow;m+=R[0].length>0?"left ":"",m+=R[R.length-1].length>0?"right ":"";for(var L=1;L<R.length-1;L++)O+=R[L].length===0?"none ":R[L][0]?"dashed ":"solid ";return/[sd]/.test(O)&&d.setAttribute("rowlines",O.trim()),m!==""&&(d=new an("menclose",[d]),d.setAttribute("notation",m.trim())),e.arraystretch&&e.arraystretch<1&&(d=new an("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},Xq=function(e,n){e.envName.includes("ed")||rC(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=Sm(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:F8(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",p=0;p<n[0].body.length;p++){var m=Or(n[0].body[p],"textord");d+=m.text}a=Number(d),l=a*2}var x=!l;o.body.forEach(function(w){for(var C=1;C<w.length;C+=2){var A=Or(w[C],"styling"),N=Or(A.body[0],"ordgroup");N.body.unshift(c)}if(x)l<w.length&&(l=w.length);else{var D=w.length/2;if(a<D)throw new on("Too many math in a row: "+("expected "+a+", but got "+D),w[0])}});for(var b=0;b<l;++b){var _="r",S=0;b%2===1?_="l":b>0&&x&&(S=1),r[b]={type:"align",align:_,pregap:S,postgap:0}}return o.colSeparationType=x?"align":"alignat",o};gh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=eC(e[0]),r=n?[e[0]]:Or(e[0],"ordgroup").body,i=r.map(function(o){var a=I8(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new on("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Sm(t.parser,s,U8(t.envName))},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var i=t.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!"lcr".includes(n))throw new on("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=Sm(t.parser,r,U8(t.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Sm(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=eC(e[0]),r=n?[e[0]]:Or(e[0],"ordgroup").body,i=r.map(function(o){var a=I8(o),l=a.text;if("lc".includes(l))return{type:"align",align:l};throw new on("Unknown column alignment: "+l,o)});if(i.length>1)throw new on("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Sm(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new on("{subarray} can contain only one column");return s},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Sm(t.parser,e,U8(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Xq,htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){Vye.has(t.envName)&&rC(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:F8(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Sm(t.parser,e,"display")},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Xq,htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){rC(t);var e={autoTag:F8(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Sm(t.parser,e,"display")},htmlBuilder:xh,mathmlBuilder:vh});gh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return rC(t),kye(t.parser)},htmlBuilder:xh,mathmlBuilder:vh});ze("\\nonumber","\\gdef\\@eqnsw{0}");ze("\\notag","\\nonumber");Tn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new on(t.funcName+" valid only within array environment")}});var DL=$q;Tn({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];if(i.type!=="ordgroup")throw new on("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Or(i.body[o],"textord").text;if(r==="\\begin"){if(!DL.hasOwnProperty(s))throw new on("No such environment: "+s,i);var a=DL[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",a),d={mode:n.mode,envName:s,parser:n},p=a.handler(d,l,c);n.expect("\\end",!1);var m=n.nextToken,x=Or(n.parseFunction(),"environment");if(x.name!==s)throw new on("Mismatch: \\begin{"+s+"} matched by \\end{"+x.name+"}",m);return p}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var Yq=(t,e)=>{var n=t.font,r=e.withFont(n);return bi(t.body,r)},Kq=(t,e)=>{var n=t.font,r=e.withFont(n);return is(t.body,r)},PL={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Tn({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=W2(e[0]),s=r;return s in PL&&(s=PL[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:Yq,mathmlBuilder:Kq});Tn({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"mclass",mode:n.mode,mclass:tC(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Tp(r)}}});Tn({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:i}=t,{mode:s}=n,o=n.parseExpression(!0,i),a="math"+r.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:Yq,mathmlBuilder:Kq});var Wye=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var o=bi(t.numer,s,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var c=bi(t.denom,s,e),d,p,m;t.hasBarLine?(t.barSize?(p=Qs(t.barSize,e),d=oy("frac-line",e,p)):d=oy("frac-line",e),p=d.height,m=d.height):(d=null,p=0,m=e.fontMetrics().defaultRuleThickness);var x,b,_;n.size===gr.DISPLAY.size?(x=e.fontMetrics().num1,p>0?b=3*m:b=7*m,_=e.fontMetrics().denom1):(p>0?(x=e.fontMetrics().num2,b=m):(x=e.fontMetrics().num3,b=3*m),_=e.fontMetrics().denom2);var S;if(d){var C=e.fontMetrics().axisHeight;x-o.depth-(C+.5*p)<b&&(x+=b-(x-o.depth-(C+.5*p))),C-.5*p-(c.height-_)<b&&(_+=b-(C-.5*p-(c.height-_)));var A=-(C-.5*p);S=Ci({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:d,shift:A},{type:"elem",elem:o,shift:-x}]})}else{var w=x-o.depth-(c.height-_);w<b&&(x+=.5*(b-w),_+=.5*(b-w)),S=Ci({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:o,shift:-x}]})}s=e.havingStyle(n),S.height*=s.sizeMultiplier/e.sizeMultiplier,S.depth*=s.sizeMultiplier/e.sizeMultiplier;var N;n.size===gr.DISPLAY.size?N=e.fontMetrics().delim1:n.size===gr.SCRIPTSCRIPT.size?N=e.havingStyle(gr.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var D,P;return t.leftDelim==null?D=bS(e,["mopen"]):D=OR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?P=tn([]):t.rightDelim==null?P=bS(e,["mclose"]):P=OR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),tn(["mord"].concat(s.sizingClasses(e)),[D,tn(["mfrac"],[S]),P],e)},$ye=(t,e)=>{var n=new an("mfrac",[is(t.numer,e),is(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Qs(t.barSize,e);n.setAttribute("linethickness",mn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new an("mo",[new Go(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new an("mo",[new Go(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return D8(i)}return n},Zq=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};Tn({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=e[1],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",d=null;return c||r.startsWith("\\d")?d="display":r.startsWith("\\t")&&(d="text"),Zq({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:Wye,mathmlBuilder:$ye});Tn({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,i;switch(n){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var IL=["display","text","script","scriptscript"],OL=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Tn({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],i=e[5],s=W2(e[0]),o=s.type==="atom"&&s.family==="open"?OL(s.text):null,a=W2(e[1]),l=a.type==="atom"&&a.family==="close"?OL(a.text):null,c=Or(e[2],"size"),d,p=null;c.isBlank?d=!0:(p=c.value,d=p.number>0);var m=null,x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var b=Or(x.body[0],"textord");m=IL[Number(b.text)]}}else x=Or(x,"textord"),m=IL[Number(x.text)];return Zq({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:d,barSize:p,leftDelim:o,rightDelim:l},m)}});Tn({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:i}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Or(e[0],"size").value,token:i}}});Tn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Or(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var o=e[2],a=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null}}});var Qq=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?bi(t.sup,e.havingStyle(n.sup()),e):bi(t.sub,e.havingStyle(n.sub()),e),i=Or(t.base,"horizBrace")):i=Or(t,"horizBrace");var s=bi(i.base,e.havingBaseStyle(gr.DISPLAY)),o=JT(i,e),a;if(i.isOver?(a=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]}),a.children[0].children[0].children[1].classes.push("svg-align")):(a=Ci({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]}),a.children[0].children[0].children[0].classes.push("svg-align")),r){var l=tn(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ci({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return tn(["mord",i.isOver?"mover":"munder"],[a],e)},qye=(t,e)=>{var n=QT(t.label);return new an(t.isOver?"mover":"munder",[is(t.base,e),n])};Tn({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:Qq,mathmlBuilder:qye});Tn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Or(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:To(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=fa(t.body,e,!1);return uye(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=sm(t.body,e);return n instanceof an||(n=new an("mrow",[n])),n.setAttribute("href",t.href),n}});Tn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Or(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var o=r[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:To(a)}}});Tn({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:To(e[0])}},htmlBuilder(t,e){var n=fa(t.body,e,!1);return Ep(n)},mathmlBuilder(t,e){return new an("mrow",Dc(t.body,e))}});Tn({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:i}=t,s=Or(e[0],"raw").string,o=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(r){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),d=0;d<c.length;d++){var p=c[d],m=p.indexOf("=");if(m<0)throw new on("\\htmlData key/value '"+p+"' missing equals sign");var x=p.slice(0,m),b=p.slice(m+1);l["data-"+x.trim()]=b}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:To(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=fa(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=tn(r,n,e);for(var s in t.attributes)s!=="class"&&t.attributes.hasOwnProperty(s)&&i.setAttribute(s,t.attributes[s]);return i},mathmlBuilder:(t,e)=>sm(t.body,e)});Tn({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:To(e[0]),mathml:To(e[1])}},htmlBuilder:(t,e)=>{var n=fa(t.html,e,!1);return Ep(n)},mathmlBuilder:(t,e)=>sm(t.mathml,e)});var VA=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new on("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!gq(r))throw new on("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Tn({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=Or(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var p=c[d].split("=");if(p.length===2){var m=p[1].trim();switch(p[0].trim()){case"alt":a=m;break;case"width":i=VA(m);break;case"height":s=VA(m);break;case"totalheight":o=VA(m);break;default:throw new on("Invalid key: '"+p[0]+"' in \\includegraphics.")}}}var x=Or(e[0],"url").url;return a===""&&(a=x,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:x})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:s,totalheight:o,src:x}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Qs(t.height,e),r=0;t.totalheight.number>0&&(r=Qs(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=Qs(t.width,e));var s={height:mn(n+r)};i>0&&(s.width=mn(i)),r>0&&(s.verticalAlign=mn(-r));var o=new nye(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new an("mglyph",[]);n.setAttribute("alt",t.alt);var r=Qs(t.height,e),i=0;if(t.totalheight.number>0&&(i=Qs(t.totalheight,e)-r,n.setAttribute("valign",mn(-i))),n.setAttribute("height",mn(r+i)),t.width.number>0){var s=Qs(t.width,e);n.setAttribute("width",mn(s))}return n.setAttribute("src",t.src),n}});Tn({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=Or(e[0],"size");if(n.settings.strict){var s=r[1]==="m",o=i.value.unit==="mu";s?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder(t,e){return Sq(t.dimension,e)},mathmlBuilder(t,e){var n=Qs(t.dimension,e);return new Aq(n)}});Tn({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=tn([],[bi(t.body,e)]),n=tn(["inner"],[n],e)):n=tn(["inner"],[bi(t.body,e)]);var r=tn(["fix"],[]),i=tn([t.alignment],[n,r],e),s=tn(["strut"]);return s.style.height=mn(i.height+i.depth),i.depth&&(s.style.verticalAlign=mn(-i.depth)),i.children.unshift(s),i=tn(["thinbox"],[i],e),tn(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new an("mpadded",[is(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Tn({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,i=r.mode;r.switchMode("math");var s=n==="\\("?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:o}}});Tn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new on("Mismatched "+t.funcName)}});var LL=(t,e)=>{switch(e.style.size){case gr.DISPLAY.size:return t.display;case gr.TEXT.size:return t.text;case gr.SCRIPT.size:return t.script;case gr.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Tn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:To(e[0]),text:To(e[1]),script:To(e[2]),scriptscript:To(e[3])}},htmlBuilder:(t,e)=>{var n=LL(t,e),r=fa(n,e,!1);return Ep(r)},mathmlBuilder:(t,e)=>{var n=LL(t,e);return sm(n,e)}});var Jq=(t,e,n,r,i,s,o)=>{t=tn([],[t]);var a=n&&Tp(n),l,c;if(e){var d=bi(e,r.havingStyle(i.sup()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var p=bi(n,r.havingStyle(i.sub()),r);l={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var m;if(c&&l){var x=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+o;m=Ci({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:mn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:mn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-o;m=Ci({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:mn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+o;m=Ci({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:mn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var S=[m];if(l&&s!==0&&!a){var w=tn(["mspace"],[],r);w.style.marginRight=mn(s),S.unshift(w)}return tn(["mop","op-limits"],S,r)},eX=new Set(["\\smallint"]),Ly=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Or(t.base,"op"),i=!0):s=Or(t,"op");var o=e.style,a=!1;o.size===gr.DISPLAY.size&&s.symbol&&!eX.has(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=Fl(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),d.length>0){var p=l.italic,m=Mq(d+"Size"+(a?"2":"1"),e);l=Ci({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=p}}else if(s.body){var x=fa(s.body,e,!0);x.length===1&&x[0]instanceof nd?(l=x[0],l.classes[0]="mop"):l=tn(["mop"],x,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(R8(s.name[_],s.mode,e));l=tn(["mop"],b,e)}var S=0,w=0;return(l instanceof nd||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(S=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=l.italic),i?Jq(l,n,r,e,o,w,S):(S&&(l.style.position="relative",l.style.top=mn(S)),l)},bw=(t,e)=>{var n;if(t.symbol)n=new an("mo",[rd(t.name,t.mode)]),eX.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new an("mo",Dc(t.body,e));else{n=new an("mi",[new Go(t.name.slice(1))]);var r=new an("mo",[rd("⁡","text")]);t.parentIsSupSub?n=new an("mrow",[n,r]):n=Eq([n,r])}return n},Xye={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Tn({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=r;return i.length===1&&(i=Xye[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ly,mathmlBuilder:bw});Tn({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:To(r)}},htmlBuilder:Ly,mathmlBuilder:bw});var Yye={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Tn({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Ly,mathmlBuilder:bw});Tn({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Ly,mathmlBuilder:bw});Tn({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=Yye[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Ly,mathmlBuilder:bw});var tX=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Or(t.base,"operatorname"),i=!0):s=Or(t,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(p=>{var m=p.text;return typeof m=="string"?{type:"textord",mode:p.mode,text:m}:p}),l=fa(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof nd&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=tn(["mop"],l,e)}else o=tn(["mop"],[],e);return i?Jq(o,n,r,e,e.style,0,0):o},Kye=(t,e)=>{for(var n=Dc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof Aq))if(s instanceof an)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof Go?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(d=>d.toText()).join("");n=[new Go(a)]}var l=new an("mi",n);l.setAttribute("mathvariant","normal");var c=new an("mo",[rd("⁡","text")]);return t.parentIsSupSub?new an("mrow",[l,c]):Eq([l,c])};Tn({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"operatorname",mode:n.mode,body:To(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:tX,mathmlBuilder:Kye});ze("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rx({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Ep(fa(t.body,e,!1)):tn(["mord"],fa(t.body,e,!0),e)},mathmlBuilder(t,e){return sm(t.body,e,!0)}});Tn({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=bi(t.body,e.havingCrampedStyle()),r=oy("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return tn(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new an("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new an("mover",[is(t.body,e),n]);return r.setAttribute("accent","true"),r}});Tn({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:To(r)}},htmlBuilder:(t,e)=>{var n=fa(t.body,e.withPhantom(),!1);return Ep(n)},mathmlBuilder:(t,e)=>{var n=Dc(t.body,e);return new an("mphantom",n)}});Tn({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=tn([],[bi(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),tn(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Dc(To(t.body),e),r=new an("mphantom",n),i=new an("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});Tn({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=tn(["inner"],[bi(t.body,e.withPhantom())]),r=tn(["fix"],[]);return tn(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Dc(To(t.body),e),r=new an("mphantom",n),i=new an("mpadded",[r]);return i.setAttribute("width","0px"),i}});Tn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Or(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=bi(t.body,e),r=Qs(t.dy,e);return Ci({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new an("mpadded",[is(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Tn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Tn({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,i=n[0],s=Or(e[0],"size"),o=Or(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Or(i,"size").value,width:s.value,height:o.value}},htmlBuilder(t,e){var n=tn(["mord","rule"],[],e),r=Qs(t.width,e),i=Qs(t.height,e),s=t.shift?Qs(t.shift,e):0;return n.style.borderRightWidth=mn(r),n.style.borderTopWidth=mn(i),n.style.bottom=mn(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Qs(t.width,e),r=Qs(t.height,e),i=t.shift?Qs(t.shift,e):0,s=e.color&&e.getColor()||"black",o=new an("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",mn(n)),o.setAttribute("height",mn(r));var a=new an("mpadded",[o]);return i>=0?a.setAttribute("height",mn(i)):(a.setAttribute("height",mn(i)),a.setAttribute("depth",mn(-i))),a.setAttribute("voffset",mn(i)),a}});function nX(t,e,n){for(var r=fa(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[o+1]==="reset-size"+e.size&&(r[s].classes[o+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return Ep(r)}var jL=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Zye=(t,e)=>{var n=e.havingSize(t.size);return nX(t.body,n,e)};Tn({type:"sizing",names:jL,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:jL.indexOf(r)+1,body:s}},htmlBuilder:Zye,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Dc(t.body,n),i=new an("mstyle",r);return i.setAttribute("mathsize",mn(n.sizeMultiplier)),i}});Tn({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,i=!1,s=!1,o=n[0]&&Or(n[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var c=o.body[l];if(a=c.text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var d=e[0];return{type:"smash",mode:r.mode,body:d,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=tn([],[bi(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(t.smashDepth&&(n.depth=0,n.children))for(var i=0;i<n.children.length;i++)n.children[i].depth=0;var s=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return tn(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new an("mpadded",[is(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Tn({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,i=n[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(t,e){var n=bi(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ay(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<gr.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:d}=jye(a,e),p=l.height-c;p>n.height+n.depth+o&&(o=(o+p-n.height-n.depth)/2);var m=l.height-n.height-o-c;n.style.paddingLeft=mn(d);var x=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var b=e.havingStyle(gr.SCRIPTSCRIPT),_=bi(t.index,b,e),S=.6*(x.height-x.depth),w=Ci({positionType:"shift",positionData:-S,children:[{type:"elem",elem:_}]}),C=tn(["root"],[w]);return tn(["mord","sqrt"],[C,x],e)}else return tn(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new an("mroot",[is(n,e),is(r,e)]):new an("msqrt",[is(n,e)])}});var zL={display:gr.DISPLAY,text:gr.TEXT,script:gr.SCRIPT,scriptscript:gr.SCRIPTSCRIPT};Tn({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!0,n),o=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(t,e){var n=zL[t.style],r=e.havingStyle(n).withFont("");return nX(t.body,r,e)},mathmlBuilder(t,e){var n=zL[t.style],r=e.havingStyle(n),i=Dc(t.body,r),s=new an("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[t.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var Qye=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===gr.DISPLAY.size||r.alwaysHandleSupSub);return i?Ly:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===gr.DISPLAY.size||r.limits);return s?tX:null}else{if(r.type==="accent")return Tp(r.base)?O8:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?Qq:null}else return null}else return null};Rx({type:"supsub",htmlBuilder(t,e){var n=Qye(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,o=bi(r,e),a,l,c=e.fontMetrics(),d=0,p=0,m=r&&Tp(r);if(i){var x=e.havingStyle(e.style.sup());a=bi(i,x,e),m||(d=o.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(s){var b=e.havingStyle(e.style.sub());l=bi(s,b,e),m||(p=o.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var _;e.style===gr.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var S=e.sizeMultiplier,w=mn(.5/c.ptPerEm/S),C=null;if(l){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(o instanceof nd||A)&&(C=mn(-o.italic))}var N;if(a&&l){d=Math.max(d,_,a.depth+.25*c.xHeight),p=Math.max(p,c.sub2);var D=c.defaultRuleThickness,P=4*D;if(d-a.depth-(l.height-p)<P){p=P-(d-a.depth)+l.height;var O=.8*c.xHeight-(d-a.depth);O>0&&(d+=O,p-=O)}var R=[{type:"elem",elem:l,shift:p,marginRight:w,marginLeft:C},{type:"elem",elem:a,shift:-d,marginRight:w}];N=Ci({positionType:"individualShift",children:R})}else if(l){p=Math.max(p,c.sub1,l.height-.8*c.xHeight);var L=[{type:"elem",elem:l,marginLeft:C,marginRight:w}];N=Ci({positionType:"shift",positionData:p,children:L})}else if(a)d=Math.max(d,_,a.depth+.25*c.xHeight),N=Ci({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:w}]});else throw new Error("supsub must have either sup or sub.");var V=kR(o,"right")||"mord";return tn([V],[o,tn(["msupsub"],[N])],e)},mathmlBuilder(t,e){var n=!1,r,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var s=[is(t.base,e)];t.sub&&s.push(is(t.sub,e)),t.sup&&s.push(is(t.sup,e));var o;if(n)o=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===gr.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===gr.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===gr.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===gr.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===gr.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===gr.DISPLAY)?o="mover":o="msup"}return new an(o,s)}});Rx({type:"atom",htmlBuilder(t,e){return R8(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new an("mo",[rd(t.text,t.mode)]);if(t.family==="bin"){var r=P8(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var rX={mi:"italic",mn:"normal",mtext:"normal"};Rx({type:"mathord",htmlBuilder(t,e){return ZT(t,e,"mathord")},mathmlBuilder(t,e){var n=new an("mi",[rd(t.text,t.mode,e)]),r=P8(t,e)||"italic";return r!==rX[n.type]&&n.setAttribute("mathvariant",r),n}});Rx({type:"textord",htmlBuilder(t,e){return ZT(t,e,"textord")},mathmlBuilder(t,e){var n=rd(t.text,t.mode,e),r=P8(t,e)||"normal",i;return t.mode==="text"?i=new an("mtext",[n]):/[0-9]/.test(t.text)?i=new an("mn",[n]):t.text==="\\prime"?i=new an("mo",[n]):i=new an("mi",[n]),r!==rX[i.type]&&i.setAttribute("mathvariant",r),i}});var GA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},WA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rx({type:"spacing",htmlBuilder(t,e){if(WA.hasOwnProperty(t.text)){var n=WA[t.text].className||"";if(t.mode==="text"){var r=ZT(t,e,"textord");return r.classes.push(n),r}else return tn(["mspace",n],[R8(t.text,t.mode,e)],e)}else{if(GA.hasOwnProperty(t.text))return tn(["mspace",GA[t.text]],[],e);throw new on('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(WA.hasOwnProperty(t.text))n=new an("mtext",[new Go(" ")]);else{if(GA.hasOwnProperty(t.text))return new an("mspace");throw new on('Unknown type of space "'+t.text+'"')}return n}});var FL=()=>{var t=new an("mtd",[]);return t.setAttribute("width","50%"),t};Rx({type:"tag",mathmlBuilder(t,e){var n=new an("mtable",[new an("mtr",[FL(),new an("mtd",[sm(t.body,e)]),FL(),new an("mtd",[sm(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var UL={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},BL={"\\textbf":"textbf","\\textmd":"textmd"},Jye={"\\textit":"textit","\\textup":"textup"},HL=(t,e)=>{var n=t.font;if(n){if(UL[n])return e.withTextFontFamily(UL[n]);if(BL[n])return e.withTextFontWeight(BL[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Jye[n])};Tn({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"text",mode:n.mode,body:To(i),font:r}},htmlBuilder(t,e){var n=HL(t,e),r=fa(t.body,n,!0);return tn(["mord","text"],r,n)},mathmlBuilder(t,e){var n=HL(t,e);return sm(t.body,n)}});Tn({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=bi(t.body,e),r=oy("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ci({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return tn(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new an("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new an("munder",[is(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Tn({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=bi(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return Ci({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new an("mpadded",[is(t.body,e)],["vcenter"])}});Tn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new on("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=VL(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(Fl(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return tn(["mord","text"].concat(i.sizingClasses(e)),_q(r),i)},mathmlBuilder(t,e){var n=new Go(VL(t)),r=new an("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var VL=t=>t.body.replace(/ /g,t.star?"␣":" "),G0=Tq,iX=`[ \r
	]`,ebe="\\\\[a-zA-Z@]+",tbe="\\\\[^\uD800-\uDFFF]",nbe="("+ebe+")"+iX+"*",rbe=`\\\\(
|[ \r	]+
?)[ \r	]*`,LR="[̀-ͯ]",ibe=new RegExp(LR+"+$"),sbe="("+iX+"+)|"+(rbe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(LR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(LR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+nbe)+("|"+tbe+")");class GL{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(sbe,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new su("EOF",new Tc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new on("Unexpected character: '"+e[n]+"'",new su(e[n],new Tc(this,n,n+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new su(i,new Tc(this,n,this.tokenRegex.lastIndex))}}class obe{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new on("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var abe=qq;ze("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});ze("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});ze("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});ze("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});ze("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});ze("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");ze("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var WL={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};ze("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new on("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=WL[e.text],r==null||r>=n)throw new on("Invalid base-"+n+" digit "+e.text);for(var i;(i=WL[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var B8=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new on("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new on("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new on("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=t.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new on("Invalid number of arguments: "+l);a=parseInt(l),i=t.consumeArg().tokens}return o&&r||t.macros.set(s,{tokens:i,numArgs:a}),""};ze("\\newcommand",t=>B8(t,!1,!0,!1));ze("\\renewcommand",t=>B8(t,!0,!1,!1));ze("\\providecommand",t=>B8(t,!0,!0,!0));ze("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});ze("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});ze("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),G0[n],hs.math[n],hs.text[n]),""});ze("\\bgroup","{");ze("\\egroup","}");ze("~","\\nobreakspace");ze("\\lq","`");ze("\\rq","'");ze("\\aa","\\r a");ze("\\AA","\\r A");ze("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");ze("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");ze("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");ze("ℬ","\\mathscr{B}");ze("ℰ","\\mathscr{E}");ze("ℱ","\\mathscr{F}");ze("ℋ","\\mathscr{H}");ze("ℐ","\\mathscr{I}");ze("ℒ","\\mathscr{L}");ze("ℳ","\\mathscr{M}");ze("ℛ","\\mathscr{R}");ze("ℭ","\\mathfrak{C}");ze("ℌ","\\mathfrak{H}");ze("ℨ","\\mathfrak{Z}");ze("\\Bbbk","\\Bbb{k}");ze("·","\\cdotp");ze("\\llap","\\mathllap{\\textrm{#1}}");ze("\\rlap","\\mathrlap{\\textrm{#1}}");ze("\\clap","\\mathclap{\\textrm{#1}}");ze("\\mathstrut","\\vphantom{(}");ze("\\underbar","\\underline{\\text{#1}}");ze("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');ze("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");ze("\\ne","\\neq");ze("≠","\\neq");ze("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");ze("∉","\\notin");ze("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");ze("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");ze("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");ze("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");ze("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");ze("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");ze("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");ze("⟂","\\perp");ze("‼","\\mathclose{!\\mkern-0.8mu!}");ze("∌","\\notni");ze("⌜","\\ulcorner");ze("⌝","\\urcorner");ze("⌞","\\llcorner");ze("⌟","\\lrcorner");ze("©","\\copyright");ze("®","\\textregistered");ze("️","\\textregistered");ze("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');ze("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');ze("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');ze("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');ze("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");ze("⋮","\\vdots");ze("\\varGamma","\\mathit{\\Gamma}");ze("\\varDelta","\\mathit{\\Delta}");ze("\\varTheta","\\mathit{\\Theta}");ze("\\varLambda","\\mathit{\\Lambda}");ze("\\varXi","\\mathit{\\Xi}");ze("\\varPi","\\mathit{\\Pi}");ze("\\varSigma","\\mathit{\\Sigma}");ze("\\varUpsilon","\\mathit{\\Upsilon}");ze("\\varPhi","\\mathit{\\Phi}");ze("\\varPsi","\\mathit{\\Psi}");ze("\\varOmega","\\mathit{\\Omega}");ze("\\substack","\\begin{subarray}{c}#1\\end{subarray}");ze("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");ze("\\boxed","\\fbox{$\\displaystyle{#1}$}");ze("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");ze("\\implies","\\DOTSB\\;\\Longrightarrow\\;");ze("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");ze("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");ze("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var $L={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},lbe=new Set(["bin","rel"]);ze("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in $L?e=$L[n]:(n.slice(0,4)==="\\not"||n in hs.math&&lbe.has(hs.math[n].group))&&(e="\\dotsb"),e});var H8={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};ze("\\dotso",function(t){var e=t.future().text;return e in H8?"\\ldots\\,":"\\ldots"});ze("\\dotsc",function(t){var e=t.future().text;return e in H8&&e!==","?"\\ldots\\,":"\\ldots"});ze("\\cdots",function(t){var e=t.future().text;return e in H8?"\\@cdots\\,":"\\@cdots"});ze("\\dotsb","\\cdots");ze("\\dotsm","\\cdots");ze("\\dotsi","\\!\\cdots");ze("\\dotsx","\\ldots\\,");ze("\\DOTSI","\\relax");ze("\\DOTSB","\\relax");ze("\\DOTSX","\\relax");ze("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");ze("\\,","\\tmspace+{3mu}{.1667em}");ze("\\thinspace","\\,");ze("\\>","\\mskip{4mu}");ze("\\:","\\tmspace+{4mu}{.2222em}");ze("\\medspace","\\:");ze("\\;","\\tmspace+{5mu}{.2777em}");ze("\\thickspace","\\;");ze("\\!","\\tmspace-{3mu}{.1667em}");ze("\\negthinspace","\\!");ze("\\negmedspace","\\tmspace-{4mu}{.2222em}");ze("\\negthickspace","\\tmspace-{5mu}{.277em}");ze("\\enspace","\\kern.5em ");ze("\\enskip","\\hskip.5em\\relax");ze("\\quad","\\hskip1em\\relax");ze("\\qquad","\\hskip2em\\relax");ze("\\tag","\\@ifstar\\tag@literal\\tag@paren");ze("\\tag@paren","\\tag@literal{({#1})}");ze("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new on("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});ze("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");ze("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");ze("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");ze("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");ze("\\newline","\\\\\\relax");ze("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var sX=mn(Qf["Main-Regular"][84][1]-.7*Qf["Main-Regular"][65][1]);ze("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+sX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");ze("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+sX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");ze("\\hspace","\\@ifstar\\@hspacer\\@hspace");ze("\\@hspace","\\hskip #1\\relax");ze("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");ze("\\ordinarycolon",":");ze("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");ze("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');ze("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');ze("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');ze("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');ze("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');ze("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');ze("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');ze("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');ze("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');ze("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');ze("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');ze("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');ze("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');ze("∷","\\dblcolon");ze("∹","\\eqcolon");ze("≔","\\coloneqq");ze("≕","\\eqqcolon");ze("⩴","\\Coloneqq");ze("\\ratio","\\vcentcolon");ze("\\coloncolon","\\dblcolon");ze("\\colonequals","\\coloneqq");ze("\\coloncolonequals","\\Coloneqq");ze("\\equalscolon","\\eqqcolon");ze("\\equalscoloncolon","\\Eqqcolon");ze("\\colonminus","\\coloneq");ze("\\coloncolonminus","\\Coloneq");ze("\\minuscolon","\\eqcolon");ze("\\minuscoloncolon","\\Eqcolon");ze("\\coloncolonapprox","\\Colonapprox");ze("\\coloncolonsim","\\Colonsim");ze("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ze("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");ze("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ze("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");ze("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");ze("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");ze("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");ze("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");ze("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");ze("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");ze("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");ze("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");ze("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");ze("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");ze("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");ze("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");ze("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");ze("\\nleqq","\\html@mathml{\\@nleqq}{≰}");ze("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");ze("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");ze("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");ze("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");ze("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");ze("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");ze("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");ze("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");ze("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");ze("\\imath","\\html@mathml{\\@imath}{ı}");ze("\\jmath","\\html@mathml{\\@jmath}{ȷ}");ze("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");ze("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");ze("⟦","\\llbracket");ze("⟧","\\rrbracket");ze("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");ze("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");ze("⦃","\\lBrace");ze("⦄","\\rBrace");ze("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");ze("⦵","\\minuso");ze("\\darr","\\downarrow");ze("\\dArr","\\Downarrow");ze("\\Darr","\\Downarrow");ze("\\lang","\\langle");ze("\\rang","\\rangle");ze("\\uarr","\\uparrow");ze("\\uArr","\\Uparrow");ze("\\Uarr","\\Uparrow");ze("\\N","\\mathbb{N}");ze("\\R","\\mathbb{R}");ze("\\Z","\\mathbb{Z}");ze("\\alef","\\aleph");ze("\\alefsym","\\aleph");ze("\\Alpha","\\mathrm{A}");ze("\\Beta","\\mathrm{B}");ze("\\bull","\\bullet");ze("\\Chi","\\mathrm{X}");ze("\\clubs","\\clubsuit");ze("\\cnums","\\mathbb{C}");ze("\\Complex","\\mathbb{C}");ze("\\Dagger","\\ddagger");ze("\\diamonds","\\diamondsuit");ze("\\empty","\\emptyset");ze("\\Epsilon","\\mathrm{E}");ze("\\Eta","\\mathrm{H}");ze("\\exist","\\exists");ze("\\harr","\\leftrightarrow");ze("\\hArr","\\Leftrightarrow");ze("\\Harr","\\Leftrightarrow");ze("\\hearts","\\heartsuit");ze("\\image","\\Im");ze("\\infin","\\infty");ze("\\Iota","\\mathrm{I}");ze("\\isin","\\in");ze("\\Kappa","\\mathrm{K}");ze("\\larr","\\leftarrow");ze("\\lArr","\\Leftarrow");ze("\\Larr","\\Leftarrow");ze("\\lrarr","\\leftrightarrow");ze("\\lrArr","\\Leftrightarrow");ze("\\Lrarr","\\Leftrightarrow");ze("\\Mu","\\mathrm{M}");ze("\\natnums","\\mathbb{N}");ze("\\Nu","\\mathrm{N}");ze("\\Omicron","\\mathrm{O}");ze("\\plusmn","\\pm");ze("\\rarr","\\rightarrow");ze("\\rArr","\\Rightarrow");ze("\\Rarr","\\Rightarrow");ze("\\real","\\Re");ze("\\reals","\\mathbb{R}");ze("\\Reals","\\mathbb{R}");ze("\\Rho","\\mathrm{P}");ze("\\sdot","\\cdot");ze("\\sect","\\S");ze("\\spades","\\spadesuit");ze("\\sub","\\subset");ze("\\sube","\\subseteq");ze("\\supe","\\supseteq");ze("\\Tau","\\mathrm{T}");ze("\\thetasym","\\vartheta");ze("\\weierp","\\wp");ze("\\Zeta","\\mathrm{Z}");ze("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");ze("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");ze("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");ze("\\bra","\\mathinner{\\langle{#1}|}");ze("\\ket","\\mathinner{|{#1}\\rangle}");ze("\\braket","\\mathinner{\\langle{#1}\\rangle}");ze("\\Bra","\\left\\langle#1\\right|");ze("\\Ket","\\left|#1\\right\\rangle");var oX=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=p=>m=>{t&&(m.macros.set("|",o),i.length&&m.macros.set("\\|",a));var x=p;if(!p&&i.length){var b=m.future();b.text==="|"&&(m.popToken(),x=!0)}return{tokens:x?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,d=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};ze("\\bra@ket",oX(!1));ze("\\bra@set",oX(!0));ze("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");ze("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");ze("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");ze("\\angln","{\\angl n}");ze("\\blue","\\textcolor{##6495ed}{#1}");ze("\\orange","\\textcolor{##ffa500}{#1}");ze("\\pink","\\textcolor{##ff00af}{#1}");ze("\\red","\\textcolor{##df0030}{#1}");ze("\\green","\\textcolor{##28ae7b}{#1}");ze("\\gray","\\textcolor{gray}{#1}");ze("\\purple","\\textcolor{##9d38bd}{#1}");ze("\\blueA","\\textcolor{##ccfaff}{#1}");ze("\\blueB","\\textcolor{##80f6ff}{#1}");ze("\\blueC","\\textcolor{##63d9ea}{#1}");ze("\\blueD","\\textcolor{##11accd}{#1}");ze("\\blueE","\\textcolor{##0c7f99}{#1}");ze("\\tealA","\\textcolor{##94fff5}{#1}");ze("\\tealB","\\textcolor{##26edd5}{#1}");ze("\\tealC","\\textcolor{##01d1c1}{#1}");ze("\\tealD","\\textcolor{##01a995}{#1}");ze("\\tealE","\\textcolor{##208170}{#1}");ze("\\greenA","\\textcolor{##b6ffb0}{#1}");ze("\\greenB","\\textcolor{##8af281}{#1}");ze("\\greenC","\\textcolor{##74cf70}{#1}");ze("\\greenD","\\textcolor{##1fab54}{#1}");ze("\\greenE","\\textcolor{##0d923f}{#1}");ze("\\goldA","\\textcolor{##ffd0a9}{#1}");ze("\\goldB","\\textcolor{##ffbb71}{#1}");ze("\\goldC","\\textcolor{##ff9c39}{#1}");ze("\\goldD","\\textcolor{##e07d10}{#1}");ze("\\goldE","\\textcolor{##a75a05}{#1}");ze("\\redA","\\textcolor{##fca9a9}{#1}");ze("\\redB","\\textcolor{##ff8482}{#1}");ze("\\redC","\\textcolor{##f9685d}{#1}");ze("\\redD","\\textcolor{##e84d39}{#1}");ze("\\redE","\\textcolor{##bc2612}{#1}");ze("\\maroonA","\\textcolor{##ffbde0}{#1}");ze("\\maroonB","\\textcolor{##ff92c6}{#1}");ze("\\maroonC","\\textcolor{##ed5fa6}{#1}");ze("\\maroonD","\\textcolor{##ca337c}{#1}");ze("\\maroonE","\\textcolor{##9e034e}{#1}");ze("\\purpleA","\\textcolor{##ddd7ff}{#1}");ze("\\purpleB","\\textcolor{##c6b9fc}{#1}");ze("\\purpleC","\\textcolor{##aa87ff}{#1}");ze("\\purpleD","\\textcolor{##7854ab}{#1}");ze("\\purpleE","\\textcolor{##543b78}{#1}");ze("\\mintA","\\textcolor{##f5f9e8}{#1}");ze("\\mintB","\\textcolor{##edf2df}{#1}");ze("\\mintC","\\textcolor{##e0e5cc}{#1}");ze("\\grayA","\\textcolor{##f6f7f7}{#1}");ze("\\grayB","\\textcolor{##f0f1f2}{#1}");ze("\\grayC","\\textcolor{##e3e5e6}{#1}");ze("\\grayD","\\textcolor{##d6d8da}{#1}");ze("\\grayE","\\textcolor{##babec2}{#1}");ze("\\grayF","\\textcolor{##888d93}{#1}");ze("\\grayG","\\textcolor{##626569}{#1}");ze("\\grayH","\\textcolor{##3b3e40}{#1}");ze("\\grayI","\\textcolor{##21242c}{#1}");ze("\\kaBlue","\\textcolor{##314453}{#1}");ze("\\kaGreen","\\textcolor{##71B307}{#1}");var aX={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class cbe{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new obe(abe,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new GL(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:n,end:r}=this.consumeArg());return this.pushToken(new su("EOF",r.loc)),this.pushTokens(i),new su("",Tc.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new on("Extra }",s)}else if(s.text==="EOF")throw new on("Unexpected end of input in a macro argument, expected '"+(e&&r?e[a]:"}")+"'",s);if(e&&r)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){n.splice(-a,a);break}}else a=0}while(o!==0||r);return i.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:i,end:s}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new on("The length of delimiters doesn't match the number of args!");for(var r=n[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new on("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new on("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,i=n.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new on("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new on("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new on("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new su(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),n.push(i)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof n=="function"?n(this):n;if(typeof i=="string"){var s=0;if(i.includes("#"))for(var o=i.replace(/##/g,"");o.includes("#"+(s+1));)++s;for(var a=new GL(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var d={tokens:l,numArgs:s};return d}return i}isDefined(e){return this.macros.has(e)||G0.hasOwnProperty(e)||hs.math.hasOwnProperty(e)||hs.text.hasOwnProperty(e)||aX.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:G0.hasOwnProperty(e)&&!G0[e].primitive}}var qL=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,A4=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$A={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},XL={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class iC{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new cbe(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new on("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new su("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(iC.endOfExpression.has(i.text)||n&&i.text===n||e&&G0[i.text]&&G0[i.text].infix)break;var s=this.parseAtom(n);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,i=0;i<e.length;i++)if(e[i].type==="infix"){if(n!==-1)throw new on("only one infix operator per group",e[i].token);n=i,r=e[i].replaceWith}if(n!==-1&&r){var s,o,a=e.slice(0,n),l=e.slice(n+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[n],o],[]):c=this.callFunction(r,[s,o],[]),[c]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new on("Expected group after '"+r+"'",n);return i}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:n},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var n=this.parseGroup("atom",e);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(n&&n.type==="op"){var o=s.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new on("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new on("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new on("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new on("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(A4[s.text]){var c=qL.test(s.text),d=[];for(d.push(new su(A4[s.text])),this.consume();;){var p=this.fetch().text;if(!A4[p]||qL.test(p)!==c)break;d.unshift(new su(A4[p])),this.consume()}var m=this.subparse(d);c?i={type:"ordgroup",mode:"math",body:m}:r={type:"ordgroup",mode:"math",body:m}}else break}return r||i?{type:"supsub",mode:this.mode,base:n,sup:r,sub:i}:n}parseFunction(e,n){var r=this.fetch(),i=r.text,s=G0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new on("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new on("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new on("Can't use function '"+i+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,r,e)}callFunction(e,n,r,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=G0[e];if(a&&a.handler)return a.handler(o,n,r);throw new on("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<r;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;(n.primitive&&a==null||n.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new on("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new on("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new on("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new on("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,n){for(var r=this.fetch(),i=r,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new on("Invalid "+n+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new on("Invalid color: '"+n.text+"'",n);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!i)throw new on("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!gq(s))throw new on("Invalid unit: '"+s.unit+"'",n);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),o}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:Tc.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!aX.hasOwnProperty(i)){if(this.settings.throwOnError)throw new on("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var i=e[r],s=i.text;s==="-"&&e[r+1].text==="-"&&(r+1<n&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:Tc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Tc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:Tc.range(i,e[r+1]),text:s+s}),n-=1)}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new on(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}XL.hasOwnProperty(n[0])&&!hs[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=XL[n[0]]+n.slice(1));var s=ibe.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(hs[this.mode][n]){this.settings.strict&&this.mode==="math"&&NR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var a=hs[this.mode][n].group,l=Tc.range(e),c;if(sye.hasOwnProperty(a)){var d=a;c={type:"atom",mode:this.mode,family:d,loc:l,text:n}}else c={type:a,mode:this.mode,loc:l,text:n};o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(mq(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:Tc.range(e),text:n};else return null;if(this.consume(),s)for(var p=0;p<s[0].length;p++){var m=s[0][p];if(!$A[m])throw new on("Unknown accent ' "+m+"'",e);var x=$A[m][this.mode]||$A[m].text;if(!x)throw new on("Accent "+m+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Tc.range(e),label:x,isStretchy:!1,isShifty:!0,base:o}}return o}}iC.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var V8=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new iC(e,n);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new on("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new su("\\df@tag")])}]}return i},lX=function(e,n,r){n.textContent="";var i=G8(e,r).toNode();n.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),lX=function(){throw new on("KaTeX doesn't work in quirks mode.")});var ube=function(e,n){var r=G8(e,n).toMarkup();return r},dbe=function(e,n){var r=new C8(n);return V8(e,r)},cX=function(e,n,r){if(r.throwOnError||!(e instanceof on))throw e;var i=tn(["katex-error"],[new nd(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},G8=function(e,n){var r=new C8(n);try{var i=V8(e,r);return _ye(i,e,r)}catch(s){return cX(s,e,r)}},fbe=function(e,n){var r=new C8(n);try{var i=V8(e,r);return Sye(i,e,r)}catch(s){return cX(s,e,r)}},hbe="0.16.33",pbe={Span:yw,Anchor:N8,SymbolNode:nd,SvgNode:vp,PathNode:rm,LineNode:AR},jR={version:hbe,render:lX,renderToString:ube,ParseError:on,SETTINGS_SCHEMA:VM,__parse:dbe,__renderToDomTree:G8,__renderToHTMLTree:fbe,__setFontMetrics:Z1e,__defineSymbol:J,__defineFunction:Tn,__defineMacro:ze,__domTree:pbe};const mbe={};function gbe(t){const e=this,n=t||mbe,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(E1e(n)),s.push(y1e()),o.push(b1e(n))}const YL=/[#.]/g;function xbe(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){YL.lastIndex=i;const a=YL.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function uX(t,e,n){const r=n?_be(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=xbe(s,e);const c=l.tagName.toLowerCase(),d=r?r.get(c):void 0;if(l.tagName=d||c,vbe(o))a.unshift(o);else for(const[p,m]of Object.entries(o))ybe(t,l.properties,p,m)}for(const c of a)zR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function vbe(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function ybe(t,e,n,r){const i=z$(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=PO(r):i.commaSeparated?s=AO(r):i.commaOrSpaceSeparated?s=PO(AO(r).join(" ")):s=KL(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?bbe(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(KL(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function zR(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)zR(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?zR(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function KL(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||xS(n)===xS(e)))return!0}return n}function bbe(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function _be(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const Sbe=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],wbe=uX(F$,"div"),Mbe=uX(WT,"g",Sbe),qA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Tbe(t,e){return dX(t,{})||{type:"root",children:[]}}function dX(t,e){const n=Cbe(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Cbe(t,e){switch(t.nodeType){case 1:return Rbe(t,e);case 3:return Abe(t);case 8:return Nbe(t);case 9:return ZL(t,e);case 10:return Ebe();case 11:return ZL(t,e);default:return}}function ZL(t,e){return{type:"root",children:fX(t,e)}}function Ebe(){return{type:"doctype"}}function Abe(t){return{type:"text",value:t.nodeValue||""}}function Nbe(t){return{type:"comment",value:t.nodeValue||""}}function Rbe(t,e){const n=t.namespaceURI,r=n===qA.svg?Mbe:wbe,i=n===qA.html?t.tagName.toLowerCase():t.tagName,s=n===qA.html&&i==="template"?t.content:t,o=t.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=t.getAttribute(o[l])||"";return r(i,a,fX(s,e))}function fX(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=dX(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function kbe(t,e){const n=Dbe(t);return Tbe(n)}function Dbe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const QL=(function(t,e,n){const r=w8(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),kx=(function(t){if(t==null)return Obe;if(typeof t=="string")return Ibe(t);if(typeof t=="object")return Pbe(t);if(typeof t=="function")return W8(t);throw new Error("Expected function, string, or array as `test`")});function Pbe(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=kx(t[n]);return W8(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Ibe(t){return W8(e);function e(n){return n.tagName===t}}function W8(t){return e;function e(n,r,i){return!!(Lbe(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Obe(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Lbe(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const JL=/\n/g,ej=/[\t ]+/g,FR=kx("br"),tj=kx(Gbe),jbe=kx("p"),nj=kx("tr"),zbe=kx(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Vbe,Wbe]),hX=kx(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Fbe(t,e){const n=e||{},r="children"in t?t.children:[],i=hX(t),s=gX(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...mX(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...pX(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?FR(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function pX(t,e,n){return t.type==="element"?Ube(t,e,n):t.type==="text"?n.whitespace==="normal"?mX(t,n):Bbe(t):[]}function Ube(t,e,n){const r=gX(t,n),i=t.children||[];let s=-1,o=[];if(zbe(t))return o;let a,l;for(FR(t)||nj(t)&&QL(e,t,nj)?l=`
`:jbe(t)?(a=2,l=2):hX(t)&&(a=1,l=1);++s<i.length;)o=o.concat(pX(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?FR(i[s+1]):l}));return tj(t)&&QL(e,t,tj)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function mX(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){JL.lastIndex=s;const l=JL.exec(n),c=l&&"index"in l?l.index:n.length;r.push(Hbe(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),s=c+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function Bbe(t){return[String(t.value)]}function Hbe(t,e,n){const r=[];let i=0,s;for(;i<t.length;){ej.lastIndex=i;const o=ej.exec(t);s=o?o.index:t.length,!i&&!s&&o&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function gX(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function Vbe(t){return!!(t.properties||{}).hidden}function Gbe(t){return t.tagName==="td"||t.tagName==="th"}function Wbe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const $be={},qbe=[];function Xbe(t){const e=t||$be;return function(n,r){fq(n,"element",function(i,s){const o=Array.isArray(i.properties.className)?i.properties.className:qbe,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let d=l;if(!a&&!l&&!c)return;let p=s[s.length-1],m=i;if(i.tagName==="code"&&a&&p&&p.type==="element"&&p.tagName==="pre"&&(m=p,p=s[s.length-2],d=!0),!p)return;const x=Fbe(m,{whitespace:"pre"});let b;try{b=jR.renderToString(x,{...e,displayMode:d,throwOnError:!0})}catch(S){const w=S,C=w.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:w,place:i.position,ruleId:C,source:"rehype-katex"});try{b=jR.renderToString(x,{...e,displayMode:d,strict:"ignore",throwOnError:!1})}catch{b=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:x}]}]}}typeof b=="string"&&(b=kbe(b).children);const _=p.children.indexOf(m);return p.children.splice(_,1,...b),dq})}}function $8(t){let e=t;if(typeof e=="object"&&e!==null&&"value"in e&&(e=e.value),typeof e=="string")try{e=JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:e?[e]:[]}function _w(t){const e=new Map,n=$8(t);for(const r of n){const i=r;typeof(i==null?void 0:i.name)=="string"&&typeof(i==null?void 0:i.reward_min)=="number"&&typeof(i==null?void 0:i.reward_max)=="number"&&e.set(i.name,{min:i.reward_min,max:i.reward_max})}return e}function yp(t){const e=new Map,n=$8(t);for(const r of n){const i=r;if(typeof(i==null?void 0:i.name)!="string")continue;const s=i.metrics_ranges;if(s&&typeof s=="object"){const o=new Map;for(const[a,l]of Object.entries(s)){const c=l;if(typeof(c==null?void 0:c.min)=="number"&&typeof(c==null?void 0:c.max)=="number"){const d={min:c.min,max:c.max};c.invert===!0&&(d.invert=!0),o.set(a,d)}}o.size>0&&e.set(i.name,o)}}return e}function Sw(t){const e=new Map;if(!t)return e;for(const[n,r]of Object.entries(t)){const i=new Map;for(const[s,o]of Object.entries(r))if(typeof(o==null?void 0:o.min)=="number"&&typeof(o==null?void 0:o.max)=="number"){const a={min:o.min,max:o.max};o.invert===!0&&(a.invert=!0),i.set(s,a)}i.size>0&&e.set(n,i)}return e}function bp(t,e){const n=new Map;for(const[r,i]of e)n.set(r,new Map(i));for(const[r,i]of t){const s=n.get(r)??new Map;for(const[o,a]of i)s.set(o,a);n.set(r,s)}return n}function E1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:o,step:a,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:d="/rollouts",goToStepParam:p="step",filterGroupId:m=null,filterSampleIdx:x=null,lastValidSampleAtom:b=OG,collapseAllSignal:_=0,expandAllSignal:S=0,defaultSectionsOpen:w=!0,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:D=[],formatThinkBlocks:P=!0}){var le;const O=M.useMemo(()=>{if(!r)return new Map;const re=new Map;for(const pe of r){const be=re.get(pe.sample_idx)||[];be.push(pe),re.set(pe.sample_idx,be)}return re},[r]),R=M.useMemo(()=>{if(!r)return[];const re=new Set;for(const pe of r)re.add(pe.metric_name);return[...re].sort()},[r]),L=M.useMemo(()=>{if(!i)return new Map;const re=new Map;for(const pe of i){const be=re.get(pe.sample_idx)||[];be.push(pe),re.set(pe.sample_idx,be)}return re},[i]),V=M.useMemo(()=>{if(!s)return new Map;const re=new Map;for(const pe of s){const be=re.get(pe.sample_idx)||[];be.push(pe),re.set(pe.sample_idx,be)}return re},[s]),F=M.useMemo(()=>{if(!t)return new Map;const re=new Map;for(const pe of t)re.set(pe.group_id,pe);return re},[t]),U=M.useMemo(()=>{if(!n)return new Map;const re=new Map;for(const pe of n)re.set(pe.sample_idx,pe);return re},[n]),W=M.useMemo(()=>{if(!e)return[];const re=new Map,pe=new Map;for(const Pe of e){const me=re.get(Pe.sample_idx)||[];me.push(Pe),re.set(Pe.sample_idx,me),pe.set(Pe.sample_idx,Pe.group_id)}const be=[];for(const[Pe,me]of re){const ke=[...me].sort((_e,Fe)=>_e.turn_order-Fe.turn_order),we=pe.get(Pe)??-1,Te=F.get(we)??null,oe=U.get(Pe);be.push({sample_idx:Pe,group_id:we,prompt:Te,turns:ke,reward:(oe==null?void 0:oe.reward)??null,advantage:(oe==null?void 0:oe.advantage)??null,total_tokens:(oe==null?void 0:oe.total_tokens)??null,raw_string:(oe==null?void 0:oe.raw_string)??null})}let xe=be.sort((Pe,me)=>Pe.sample_idx-me.sample_idx);return m!==null&&(xe=xe.filter(Pe=>Pe.group_id===m)),x!==null&&(xe=xe.filter(Pe=>Pe.sample_idx===x)),xe},[e,F,U,m,x]),[Y,$]=dn(b),X=W[0],Z=(X==null?void 0:X.sample_idx)??null,K=M.useMemo(()=>Z!==null?O.get(Z)??[]:[],[O,Z]),ne=M.useMemo(()=>Z!==null?L.get(Z)??[]:[],[L,Z]),H=M.useMemo(()=>Z!==null?V.get(Z)??[]:[],[V,Z]);M.useEffect(()=>{!X||x===null||$({sample:X,rolloutMetrics:K,goldenAnswers:ne})},[X,K,ne,x,$]);const B=x!==null&&(Y==null?void 0:Y.sample.sample_idx)===x?Y:null,G=X||(B==null?void 0:B.sample),j=X?K:(B==null?void 0:B.rolloutMetrics)||[],ie=X?ne:(B==null?void 0:B.goldenAnswers)||[],ce=X?H:[],te=M.useRef(null);M.useEffect(()=>{if(l==null||te.current===l)return;const re=document.getElementById(`sample-${l}`);re&&(re.scrollIntoView({behavior:"smooth",block:"start"}),te.current=l)},[l,W]);const se=a!==void 0?a:(le=e==null?void 0:e[0])==null?void 0:le.step;return x===null?f.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:f.jsx("p",{children:"Select a sample from the sidebar to view"})}):!G&&!o?f.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:f.jsx("p",{children:"No rollouts data available"})}):G?f.jsx("div",{className:"space-y-4 min-w-0",children:f.jsx(Ybe,{sample:G,rolloutMetrics:j,goldenAnswers:ie,infoTurns:ce,availableMetricNames:R,showGoTo:c,goToStep:se,goToBasePath:d,goToStepParam:p,collapseAllSignal:_,expandAllSignal:S,defaultSectionsOpen:w,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:D,formatThinkBlocks:P},G.sample_idx)}):null}function Ybe({sample:t,rolloutMetrics:e,goldenAnswers:n,infoTurns:r,availableMetricNames:i,showGoTo:s,goToStep:o,goToBasePath:a="/rollouts",goToStepParam:l="step",collapseAllSignal:c=0,expandAllSignal:d=0,defaultSectionsOpen:p=!0,envRewardRanges:m,envMetricRanges:x,advantageRange:b,renderOptions:_=[],formatThinkBlocks:S=!0}){var xe,Pe;const[w,C]=dn(ice),A=w.length===0,N=w.length===1&&w[0]==="__none__",D=me=>A?!0:N?!1:w.includes(me),P=me=>{C(ke=>{if(ke.length===0)return i.filter(oe=>oe!==me);const we=ke.filter(oe=>oe!=="__none__");if(we.length===0)return[me];if(we.includes(me)){const oe=we.filter(_e=>_e!==me);return oe.length===0?["__none__"]:oe}const Te=[...we,me];return i.length>0&&Te.length>=i.length?[]:Te})},O=M.useMemo(()=>[...e].sort((me,ke)=>me.metric_name.localeCompare(ke.metric_name)),[e]),R=M.useMemo(()=>w.length===0?O:O.filter(me=>w.includes(me.metric_name)),[O,w]),L=M.useMemo(()=>n.filter(me=>me.value!=null&&me.value!==""),[n]),V=((xe=t.prompt)==null?void 0:xe.env)??null,F=X5(),U=()=>{o!=null&&F(`${a}?${l}=${o}&group=${t.group_id}&sample=${t.sample_idx}`)},W=M.useMemo(()=>{if(!r||r.length===0)return new Map;const me=new Map;for(const ke of r){const we=me.get(ke.turn_order)||[];we.push(ke),me.set(ke.turn_order,we)}return me},[r]),[Y,$]=M.useState(!1),[X,Z]=M.useState(!1),[K,ne]=M.useState(p),[H,B]=M.useState({}),[G,j]=M.useState(c),[ie,ce]=M.useState(d),te=t.turns.length;if(c!==G){j(c),$(!1),Z(!1),ne(!1);const me={};for(let ke=0;ke<te;ke++)me[ke]=!1;B(me)}if(d!==ie){ce(d),$(!0),Z(!0),ne(!0);const me={};for(let ke=0;ke<te;ke++)me[ke]=!0;B(me)}const se=me=>{B(ke=>({...ke,[me]:!ke[me]}))},le=V?m==null?void 0:m.get(V):void 0,re=[];V&&re.push({label:"Env",value:V});const pe=t.turns.filter(me=>me.turn_type==="model").length;if(pe>1&&re.push({label:"Turns",value:String(pe)}),t.reward!==null){const me=ZA(t.reward,(le==null?void 0:le.min)??null,(le==null?void 0:le.max)??null);re.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:me})}if(t.advantage!==null){const me=ZA(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);re.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:me})}const be=[];for(const me of R){const ke=me.env??V,we=o_e(x,ke,me.metric_name),Te=ZA(me.value,(we==null?void 0:we.min)??null,(we==null?void 0:we.max)??null,we==null?void 0:we.invert);be.push({label:N4(me.metric_name),value:s_e(me.value),highlight:Te?void 0:me.value===1?"positive":me.value===0?"negative":void 0,rangeColor:Te})}return f.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(re.length>0||be.length>0||s)&&f.jsxs("div",{className:"mb-2 space-y-0.5",children:[(re.length>0||s||i.length>0)&&f.jsxs("div",{className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[s&&f.jsx(Mn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:U,disabled:o==null,children:"Go to"}),re.map((me,ke)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[ke>0&&f.jsx("span",{className:"text-foreground/20",children:"·"}),f.jsx("span",{className:"text-muted-foreground",children:me.label}),f.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:me.rangeColor?{color:me.rangeColor}:void 0,children:me.value})]},me.label)),i.length>0&&f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline cursor-pointer",children:["Sample Metrics",f.jsx(Ir,{className:"h-3 w-3"})]})}),f.jsxs(ua,{align:"start",className:"w-max max-w-[400px]",children:[f.jsx(ra,{onSelect:me=>{me.preventDefault(),C([])},children:"Select All"}),f.jsx(ra,{onSelect:me=>{me.preventDefault(),C(["__none__"])},children:"Unselect All"}),f.jsx(aa,{}),i.map(me=>f.jsx(ti,{checked:D(me),onCheckedChange:()=>P(me),onSelect:ke=>ke.preventDefault(),children:N4(me)},me))]})]})]}),be.length>0&&f.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:be.map((me,ke)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[f.jsx("span",{className:"text-muted-foreground",children:me.label}),f.jsx("span",{className:Rt("font-medium tabular-nums",!me.rangeColor&&me.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!me.rangeColor&&me.highlight==="negative"&&"text-red-500 dark:text-red-400",!me.rangeColor&&!me.highlight&&"text-foreground/80"),style:me.rangeColor?{color:me.rangeColor}:void 0,children:me.value}),ke<be.length-1&&f.jsx("span",{className:"text-foreground/20",children:"·"})]},me.label))})]}),L.length>0&&f.jsxs(Fi,{open:Y,onOpenChange:$,className:"mb-2",children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-amber-500/[0.03] hover:bg-amber-500/[0.07] rounded transition-colors overflow-hidden",children:f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/70 font-medium text-[11px] uppercase tracking-wide shrink-0",children:"Golden"}),!Y&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:L.map(me=>`${N4(me.key)}: ${me.value}`).join(" · ")}),f.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!Y&&"-rotate-90")})})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"py-2 px-2 -mx-2 bg-amber-500/[0.03] rounded-b",children:f.jsx("div",{className:"flex items-baseline gap-2 text-xs min-w-0 flex-wrap",children:L.map((me,ke)=>f.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[ke>0&&f.jsx("span",{className:"text-foreground/20",children:"·"}),f.jsx("span",{className:"text-muted-foreground",children:N4(me.key)}),f.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&me.value?f.jsx($2,{content:me.value,renderOptions:_}):me.value})]},me.key))})})})]}),((Pe=t.prompt)==null?void 0:Pe.system_prompt)&&f.jsxs(Fi,{open:X,onOpenChange:Z,className:"mb-2",children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"System"}),!X&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:XA(t.prompt.system_prompt,60,S)}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_system_prompt!=null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_system_prompt.toLocaleString()," ","tokens"]}),f.jsx(KA,{text:t.prompt.system_prompt}),f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!X&&"-rotate-90")})]})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"py-2",children:f.jsx(YA,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&f.jsxs(Fi,{open:K,onOpenChange:ne,className:"mb-2",children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"User"}),!K&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:XA(t.prompt.prompt,60,S)}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_prompt!=null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_prompt.toLocaleString()," tokens"]}),f.jsx(KA,{text:t.prompt.prompt}),f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")})]})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"py-2",children:f.jsx(YA,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((me,ke)=>{const we=H[ke]??p,Te=me.turn_type==="model"?t.turns.slice(0,ke).filter(oe=>oe.turn_type==="model").length:null;return f.jsxs(Fi,{open:we,onOpenChange:()=>se(ke),className:"mb-2",children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:Zbe(me.turn_type)}),!we&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:XA(me.content,60,me.turn_type==="model"&&S)}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[me.tokens!=null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[me.tokens.toLocaleString()," tokens"]}),Te!==null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Te]}),f.jsx(KA,{text:me.content}),f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!we&&"-rotate-90")})]})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"py-2",children:[f.jsx(YA,{content:me.content,renderOptions:_,enableThinkBlocks:me.turn_type==="model"&&S}),(()=>{const oe=W.get(me.turn_order);return!oe||oe.length===0?null:f.jsx("div",{className:"mt-2 space-y-1",children:oe.map((_e,Fe)=>f.jsx(Kbe,{info:_e,renderOptions:_},`${_e.info_key}-${Fe}`))})})()]})})]},`${me.sample_idx}-${me.turn_order}`)})]})}function Kbe({info:t,renderOptions:e=[]}){const[n,r]=M.useState(!1);return f.jsxs(Fi,{open:n,onOpenChange:r,children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"py-1 px-2 -mx-2 cursor-pointer bg-accent/40 hover:bg-accent/60 rounded transition-colors flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-3 w-3 text-muted-foreground transition-transform shrink-0",!n&&"-rotate-90")}),f.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t.info_key}),!n&&t.info_value&&f.jsxs("span",{className:"text-xs text-muted-foreground/50 truncate min-w-0",children:[t.info_value.slice(0,80),t.info_value.length>80?"…":""]})]})}),f.jsx(Bi,{children:f.jsx("div",{className:"py-1.5 px-2 text-xs bg-accent/20 rounded mt-0.5",children:e.length>0&&t.info_value?f.jsx($2,{content:t.info_value,renderOptions:e}):f.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function Zbe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qbe(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function XA(t,e=60,n=!0){if(!t)return"";const i=(n?Qbe(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function Jbe(t){const e=[],n=/<think>([\s\S]*?)<\/think>/g;let r=0,i;for(;(i=n.exec(t))!==null;)i.index>r&&e.push({type:"text",value:t.slice(r,i.index)}),e.push({type:"think",value:i[1].replace(/^\n/,"")}),r=n.lastIndex;return r<t.length&&e.push({type:"text",value:t.slice(r)}),e}function e_e(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function rj({content:t}){const[e,n]=M.useState(!0);return f.jsxs("span",{className:"block",children:[f.jsxs("span",{className:"cursor-pointer select-none inline-flex items-center gap-0.5 text-foreground/40 hover:text-foreground/60 transition-colors",onClick:()=>n(r=>!r),children:["<think>",!e&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-foreground/40 italic text-xs ml-1",children:e_e(t)}),f.jsx("span",{children:"</think>"}),f.jsx(Zg,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&f.jsx(Ir,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&f.jsxs("span",{className:"block text-foreground/70",children:[t,f.jsx("span",{className:"cursor-pointer select-none inline-flex items-center gap-0.5 text-foreground/40 hover:text-foreground/60 transition-colors",onClick:()=>n(!1),children:"</think>"})]})]})}function t_e(t){const e=[],n=/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\$(?!\$)(?:[^$\\]|\\.)+?\$|\\\((?:[^\\]|\\.)*?\\\))/g;let r=0,i;for(;(i=n.exec(t))!==null;){i.index>r&&e.push({type:"text",value:t.slice(r,i.index)});const s=i[1];s.startsWith("$$")?e.push({type:"display",value:s.slice(2,-2)}):s.startsWith("\\[")?e.push({type:"display",value:s.slice(2,-2)}):s.startsWith("\\(")?e.push({type:"inline",value:s.slice(2,-2)}):e.push({type:"inline",value:s.slice(1,-1)}),r=n.lastIndex}return r<t.length&&e.push({type:"text",value:t.slice(r)}),e}function n_e(t){const e=[],n=/^```(\w*)\n([\s\S]*?)^```\s*$/gm;let r=0,i;for(;(i=n.exec(t))!==null;)i.index>r&&e.push({type:"text",value:t.slice(r,i.index)}),e.push({type:"code",value:i[2].replace(/\n$/,""),language:i[1]||void 0}),r=n.lastIndex;return r<t.length&&e.push({type:"text",value:t.slice(r)}),e.length===0&&e.push({type:"text",value:t}),e}function r_e({code:t,language:e}){const[n,r]=M.useState(!1),i=async s=>{s.stopPropagation(),await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return f.jsxs("div",{className:"my-2 rounded-md border bg-muted/50 overflow-hidden",children:[e&&f.jsxs("div",{className:"flex items-center justify-between px-3 py-1 text-xs text-muted-foreground border-b bg-muted/30",children:[f.jsx("span",{children:e}),f.jsx("button",{onClick:i,className:"hover:text-foreground transition-colors",title:"Copy code",children:n?f.jsx(vm,{className:"h-3 w-3"}):f.jsx(TT,{className:"h-3 w-3"})})]}),f.jsx("pre",{className:"p-3 text-sm font-sans whitespace-pre-wrap break-words overflow-x-auto",children:f.jsx("code",{children:t})})]})}function i_e({content:t}){const e="katex-scroll",n=t_e(t);return f.jsx("div",{className:Rt("whitespace-pre-wrap break-words [&_.katex]:text-sm",e),children:n.map((r,i)=>{if(r.type==="text")return f.jsx("span",{children:r.value},i);try{const s=jR.renderToString(r.value,{displayMode:r.type==="display",throwOnError:!1});return f.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)}catch{return f.jsx("span",{children:r.type==="display"?`$$${r.value}$$`:`$${r.value}$`},i)}})})}function ij({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(gbe),s.push(Xbe)),f.jsx("div",{className:Rt("prose prose-sm dark:prose-invert max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*+*]:mt-[0.75em]",n&&r),children:f.jsx(h1e,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?f.jsx(i_e,{content:t}):f.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function $2({content:t,renderOptions:e=[]}){const n=e.includes("markdown"),r=e.includes("latex"),i=e.includes("code");if(!n&&!r&&!i)return f.jsx(f.Fragment,{children:t});if(i){const s=n_e(t);if(s.some(o=>o.type==="code"))return f.jsx(f.Fragment,{children:s.map((o,a)=>o.type==="code"?f.jsx(r_e,{code:o.value,language:o.language},a):f.jsx(ij,{content:o.value,renderMarkdown:n,renderLatex:r},a))})}return f.jsx(ij,{content:t,renderMarkdown:n,renderLatex:r})}function YA({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=M.useMemo(()=>n?Jbe(t):[{type:"text",value:t}],[t,n]),i=e.length>0;return r.length===1&&r[0].type==="text"?i?f.jsx("div",{className:"text-sm text-foreground/90",children:f.jsx($2,{content:t,renderOptions:e})}):f.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:t}):i?f.jsx("div",{className:"text-sm text-foreground/90",children:r.map((s,o)=>s.type==="text"?f.jsx($2,{content:s.value,renderOptions:e},o):f.jsx(rj,{content:s.value},o))}):f.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,o)=>s.type==="text"?f.jsx("span",{children:s.value},o):f.jsx(rj,{content:s.value},o))})}function KA({text:t}){const[e,n]=M.useState(!1),r=async i=>{i.stopPropagation(),await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3)};return f.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",title:e?"Copied!":"Copy to clipboard",children:e?f.jsx(vm,{className:"h-3.5 w-3.5 text-foreground/30"}):f.jsx(TT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function N4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function s_e(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function o_e(t,e,n){var r;if(t){if(e){const i=(r=t.get(e))==null?void 0:r.get(n);if(i)return i}for(const i of t.values()){const s=i.get(n);if(s)return s}}}function ZA(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function sC({rawString:t,totalTokens:e,turns:n}){const[r,i]=M.useState(!1),[s,o]=M.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)},l=c=>{const d=c.split(`
`);return d.map((p,m)=>f.jsxs("span",{children:[p,m<d.length-1&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-muted-foreground/50",children:"\\n"}),`
`]})]},m))};return f.jsxs(qu,{children:[f.jsx(CT,{asChild:!0,children:f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),f.jsxs(Xu,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[f.jsx(Zc,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Qc,{children:"Raw Text"}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:[e!=null&&f.jsxs(f.Fragment,{children:[e.toLocaleString()," tokens"]}),e!=null&&n!=null&&n>0&&" • ",n!=null&&n>0&&f.jsxs(f.Fragment,{children:[n," ",n===1?"turn":"turns"]})]}),f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:a,children:[r?f.jsx(vm,{className:"size-3"}):f.jsx(TT,{className:"size-3"}),r?"Copied":"Copy"]}),f.jsx(S1,{variant:"outline",size:"sm",pressed:s,onPressedChange:o,className:"text-xs",children:"Line breaks"})]})}),f.jsx(Ex,{className:"h-[60vh] w-full rounded-md border bg-background p-4",children:f.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:s?l(t):t})})]})]})}function a_e(t){switch(t){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}}function l_e(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function c_e(t){const e=M.useMemo(()=>{if(t!=null&&t.prompts)return t.prompts.map(a=>({step:a.trainer_step,group_id:a.group_id,env:a.env,system_prompt:a.system_prompt,tokens_system_prompt:a.tokens_system_prompt,prompt:a.prompt,tokens_prompt:a.tokens_prompt}))},[t]),n=M.useMemo(()=>{if(t!=null&&t.rollouts)return t.rollouts.map(a=>({step:a.trainer_step,group_id:a.group_id,sample_idx:a.sample_idx,turn_order:a.turn_order,turn_type:a.turn_type,content:a.content,tokens:a.tokens}))},[t]),r=M.useMemo(()=>{if(t!=null&&t.samples_data)return t.samples_data.map(a=>({step:a.trainer_step,group_id:a.group_id,sample_idx:a.sample_idx,reward:a.reward,advantage:a.advantage,turns:a.turns,total_tokens:a.total_tokens,raw_string:a.raw_string}))},[t]),i=M.useMemo(()=>{if(!(t!=null&&t.rollout_metrics))return;const a=t.trainer_step??0;return t.rollout_metrics.map(l=>({step:a,sample_idx:l.sample_idx,env:l.env,metric_name:l.metric_name,value:l.value}))},[t]),s=M.useMemo(()=>{if(!(t!=null&&t.golden_answers))return;const a=t.trainer_step??0;return t.golden_answers.map(l=>({step:a,sample_idx:l.sample_idx,env:l.env,key:l.key,value:l.value}))},[t]),o=M.useMemo(()=>{if(!(t!=null&&t.info_turns))return;const a=t.trainer_step??0;return t.info_turns.map(l=>({step:a,sample_idx:l.sample_idx,turn_order:l.turn_order,env:l.env,info_key:l.info_key,info_value:l.info_value,info_type:l.info_type}))},[t]);return{mappedPrompts:e,mappedRollouts:n,mappedSamplesData:r,mappedRolloutMetrics:i,mappedGoldenAnswers:s,mappedInfoTurns:o}}function u_e({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var se,le,re,pe,be;const[o,a]=M.useState(!1),{data:l,isLoading:c,error:d}=GG(t,e,n,o,r),{data:p}=cd(t,o&&!!t,!1),m=r?((se=p==null?void 0:p.summary)==null?void 0:se.eval_env_details)??((le=p==null?void 0:p.config)==null?void 0:le.eval_env_details):(re=p==null?void 0:p.config)==null?void 0:re.environments,x=r||(pe=p==null?void 0:p.summary)==null?void 0:pe.env_details,b=M.useMemo(()=>_w(m),[m]),_=M.useMemo(()=>{const xe=yp(m),Pe=yp(x),me=Sw(p==null?void 0:p.data_metric_ranges);return bp(bp(xe,Pe),me)},[m,x,p==null?void 0:p.data_metric_ranges]),S=M.useMemo(()=>{var ke;const xe=(ke=p==null?void 0:p.config)==null?void 0:ke.group_size,Pe=typeof xe=="object"&&xe!==null&&"value"in xe?Number(xe.value):Number(xe);if(!Pe||isNaN(Pe)||Pe<=1)return null;const me=Math.sqrt(Pe-1);return{min:-me,max:me}},[(be=p==null?void 0:p.config)==null?void 0:be.group_size]),w=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:C,mappedRollouts:A,mappedSamplesData:N,mappedRolloutMetrics:D,mappedGoldenAnswers:P,mappedInfoTurns:O}=c_e(w),R=M.useMemo(()=>{var Pe;if(!l||l.kind!=="eval")return null;const xe=(Pe=l.samples_data)==null?void 0:Pe[0];return xe?{groupId:xe.group_id,sampleIdx:xe.sample_idx}:null},[l]),L=(l==null?void 0:l.kind)==="rollouts_discarded"?"Discarded":(l==null?void 0:l.kind)==="rollouts"?"Kept":(l==null?void 0:l.kind)==="eval"?"Eval":null,V=X5(),F=M.useMemo(()=>l?l.kind==="rollouts"?`/rollouts?step=${l.step}&group=${e}&sample=${n}`:l.kind==="rollouts_discarded"?`/rollouts-discarded?trainer_step=${l.trainer_step}&group=${e}&sample=${n}`:l.kind==="eval"?`/evals?step=${l.step}&eval_name=${encodeURIComponent(l.eval_name)}&group=${e}&sample=${n}`:null:null,[l,e,n]),U=()=>{F&&(a(!1),V(F))},[W,Y]=M.useState(0),[$,X]=M.useState(0),[Z,K]=M.useState(!0),[ne,H]=dn(wT),[B,G]=dn(MT),j=ne.length+(B?1:0),ie=xe=>{H(Pe=>Pe.includes(xe)?Pe.filter(me=>me!==xe):[...Pe,xe])},ce=M.useMemo(()=>{if(!l)return null;const xe=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?N:l.kind==="eval"?l.samples_data:null;if(!xe)return null;const Pe=l.kind==="eval"?(R==null?void 0:R.sampleIdx)??n:n;return xe.find(me=>me.sample_idx===Pe)??null},[l,N,n,R]),te=!c&&!d&&l&&l.kind!==null;return f.jsxs(qu,{open:o,onOpenChange:a,children:[f.jsx(CT,{asChild:!0,children:s??f.jsx(Mn,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),f.jsxs(Xu,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[f.jsx(Zc,{children:f.jsxs(Qc,{className:"flex items-center gap-2 flex-wrap",children:[f.jsx("span",{children:(l==null?void 0:l.kind)==="eval"?`Completion ${n} / Sample ${e}`:`Sample ${n} / Group ${e}`}),L&&f.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[L,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(w==null?void 0:w.discard_reason)&&f.jsx(J1,{variant:l_e(w.discard_reason),className:"text-xs",children:a_e(w.discard_reason)}),F&&f.jsx(Mn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:U,children:"Go to"}),te&&f.jsxs(f.Fragment,{children:[(ce==null?void 0:ce.raw_string)&&f.jsx(sC,{rawString:ce.raw_string,totalTokens:ce.total_tokens,turns:ce.turns??void 0}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{Y(xe=>xe+1),K(!1)},children:"Collapse All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{X(xe=>xe+1),K(!0)},children:"Expand All"}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",j>0&&` (${j})`]})}),f.jsxs(ua,{align:"start",className:"w-auto",children:[f.jsx(ti,{checked:B,onCheckedChange:xe=>G(!!xe),onSelect:xe=>xe.preventDefault(),children:"Format Think"}),f.jsx(ti,{checked:ne.includes("markdown"),onCheckedChange:()=>ie("markdown"),onSelect:xe=>xe.preventDefault(),children:"Markdown"}),f.jsx(ti,{checked:ne.includes("latex"),onCheckedChange:()=>ie("latex"),onSelect:xe=>xe.preventDefault(),children:"LaTeX"}),f.jsx(ti,{checked:ne.includes("code"),onCheckedChange:()=>ie("code"),onSelect:xe=>xe.preventDefault(),children:"Code"})]})]})]})]})}),d&&f.jsx(Ju,{className:"border-destructive",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-sm text-destructive",children:["Error: ",d instanceof Error?d.message:"Unknown error"]})})}),c&&!d&&f.jsx(Ju,{children:f.jsxs(ih,{className:"pt-6 space-y-3",children:[f.jsx(tp,{className:"h-5 w-40"}),f.jsx(tp,{className:"h-32 w-full"}),f.jsx(tp,{className:"h-24 w-full"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(tp,{className:"h-6 w-20"}),f.jsx(tp,{className:"h-6 w-20"}),f.jsx(tp,{className:"h-6 w-20"})]})]})}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts"&&f.jsx(E1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:W,expandAllSignal:$,defaultSectionsOpen:Z,renderOptions:ne,formatThinkBlocks:B}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts_discarded"&&f.jsx(E1,{prompts:C,data:A,samplesData:N,rolloutMetrics:D,goldenAnswers:P,infoTurns:O,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:W,expandAllSignal:$,defaultSectionsOpen:Z,renderOptions:ne,formatThinkBlocks:B}),!c&&!d&&(l==null?void 0:l.kind)==="eval"&&f.jsx(E1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:(R==null?void 0:R.groupId)??e,filterSampleIdx:(R==null?void 0:R.sampleIdx)??n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:W,expandAllSignal:$,defaultSectionsOpen:Z,renderOptions:ne,formatThinkBlocks:B}),!c&&!d&&(l==null?void 0:l.kind)===null&&f.jsx(Ju,{children:f.jsx(ih,{className:"pt-6",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:i?"Sample canceled due to async policy.":"Sample not found in rollouts or discarded rollouts."})})})]})]})}const d_e=.005;function f_e(t){const e=t*2;if(e<=0)return{thresholdSeconds:.005,displayLabel:"5ms"};const n=Math.pow(10,Math.floor(Math.log10(e))),r=e/n;let i;r<1.5?i=1:r<3.5?i=2:r<7.5?i=5:i=10;const s=i*n,o=s>=1?`${s}ms`:`${Number(s.toPrecision(2))}ms`;return{thresholdSeconds:s/1e3,displayLabel:o}}function As(t){const e=Math.abs(t);if(e<1)return`${t.toFixed(2)}ms`;if(e<10)return`${t.toFixed(1)}ms`;if(e<1e3)return`${Math.round(t)}ms`;const n=t/1e3;if(e<6e4)return`${n.toFixed(2)}s`;const r=n/60;return e<36e5?`${r.toFixed(1)}min`:`${(r/60).toFixed(1)}h`}function QA(t){return t.toLocaleString("en-US")}function xX(t,e,n=[]){return[{label:"Duration",value:As(e)},...t.prompt_tokens!==void 0?[{label:"Prompt tokens",value:QA(t.prompt_tokens)}]:[],...t.rollout_tokens!==void 0?[{label:"Rollout tokens",value:QA(t.rollout_tokens)}]:[],...t.max_tokens!==void 0&&t.max_tokens!==null?[{label:"Max tokens",value:QA(t.max_tokens)}]:[],...n,...t.queue_time!==void 0&&t.queue_time!==null?[{label:"Queue time",value:As(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:As(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:As(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:As(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:As(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:As(t.e2e_latency*1e3)}]:[],...t.off_policy_steps!==void 0&&t.off_policy_steps!==null?[{label:"Off-policy steps",value:String(t.off_policy_steps)}]:[]]}function h_e(t,e){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16),o=Math.round(r+(255-r)*e),a=Math.round(i+(255-i)*e),l=Math.round(s+(255-s)*e);return`#${o.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}function p_e(t,e){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16),o=Math.round(r*(1-e)),a=Math.round(i*(1-e)),l=Math.round(s*(1-e));return`#${o.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}function m_e(t,e,n){return n?p_e(t,e):h_e(t,e)}const g_e=new Set;function vX(t){var n;const e=(n=GT[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function x_e(t,e=d_e){if(t.length===0)return{sortedEvents:[],windowByOriginalIndex:new Map};const n=t.map((l,c)=>({event:l,originalIndex:c})).sort((l,c)=>l.event.timestamp-c.event.timestamp),r=new Array(n.length),i=new Array(n.length);let s=0,o=0;for(let l=0;l<n.length;l++){const c=n[l].event.timestamp;for(;c-n[s].event.timestamp>e;)s++;for(o<l&&(o=l);o+1<n.length&&n[o+1].event.timestamp-c<=e;)o++;r[l]=s,i[l]=o}const a=new Map;return n.forEach((l,c)=>{a.set(l.originalIndex,{start:r[c],end:i[c],sortedIndex:c})}),{sortedEvents:n,windowByOriginalIndex:a}}function v_e({orchestratorData:t,trainerData:e,inferenceData:n,isLoading:r,intervalStart:i,intervalEnd:s,trainerGpuMetricsByGpuIndex:o,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:l=!1,trainerAvailableGpuMetrics:c=[],selectedTrainerGpuMetrics:d=[],onSelectedTrainerGpuMetricsChange:p,trainerSystemGpuIndices:m,trainerRankInfoByRank:x,totalSetupNodes:b,inferenceServerNodeMap:_,numInferenceServers:S=0,maxConcurrentPrompts:w=12,groupSize:C=1,freeLaneAfterGeneration:A=!1}){const N=Jn(_T),D=M.useMemo(()=>{const X=(m??[]).filter(K=>Number.isFinite(K));return X.length>0?X:o?Object.keys(o).map(Number).filter(K=>Number.isFinite(K)).sort((K,ne)=>K-ne):[]},[m,o]),P=s-i,O=M.useMemo(()=>!t||t.length===0?[]:t.filter(X=>X.timestamp>=i&&X.timestamp<s),[t,i,s]),R=M.useMemo(()=>!e||e.length===0?[]:e.filter(X=>X.start_time<s&&X.end_time>i),[e,i,s]),L=M.useMemo(()=>!n||n.length===0?[]:n.filter(X=>{const Z=X.end_time+(X.environment_response_time??0)+(X.compute_reward_time??0);return X.start_time<s&&Z>i}),[n,i,s]),{eventsByRank:V,ranks:F}=M.useMemo(()=>{const X={};R.forEach(K=>{X[K.rank]||(X[K.rank]=[]),X[K.rank].push(K)});const Z=Object.keys(X).map(Number).sort((K,ne)=>K-ne);return{eventsByRank:X,ranks:Z}},[R]),{eventsByServer:U,servers:W}=M.useMemo(()=>{const X={};L.forEach(K=>{X[K.server]||(X[K.server]=[]),X[K.server].push(K)});const Z=Object.keys(X).map(Number).sort((K,ne)=>K-ne);return{eventsByServer:X,servers:Z}},[L]),Y=S>0?S:Math.max(1,W.length),$=Math.max(1,Math.floor(w/Y*C));return f.jsx("div",{className:`transition-opacity duration-200 overflow-visible ${r&&!N?"opacity-50":""}`,children:f.jsxs("div",{className:"space-y-6",children:[(W.length>0||S>0)&&f.jsx(S_e,{servers:W.length>0?W:Array.from({length:S},(X,Z)=>Z),eventsByServer:U,intervalStart:i,intervalDuration:P,lanesPerServer:$,inferenceServerNodeMap:_,totalSetupNodes:b,isLoading:r,freeLaneAfterGeneration:A}),f.jsx(y_e,{events:O,intervalStart:i,intervalDuration:P,isLoading:r}),f.jsx(B_e,{ranks:F,eventsByRank:V,intervalStart:i,intervalDuration:P,intervalEnd:s,trainerGpuMetricsByGpuIndex:o,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:l,trainerAvailableGpuMetrics:c,selectedMetricNames:d,onSelectedMetricNamesChange:p,trainerSystemGpuIndices:D,trainerRankInfoByRank:x,totalSetupNodes:b,isLoading:r})]})})}function y_e({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=M.useState(!0),[o,a]=M.useState(null),[l,c]=M.useState(null),d=l??o,{thresholdSeconds:p,displayLabel:m}=M.useMemo(()=>f_e(n),[n]),{sortedEvents:x,windowByOriginalIndex:b}=M.useMemo(()=>x_e(t,p),[t,p]),_=M.useMemo(()=>{const S=[],w=new Map;return t.forEach(C=>{const A=R7(C.event_type),N=w.get(A);N!==void 0?S[N].count++:(w.set(A,S.length),S.push({displayName:A,color:N7(C.event_type),count:1}))}),S},[t]);return f.jsxs(Fi,{open:i,onOpenChange:s,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!i&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Orchestrator"}),r&&f.jsx(hl,{className:"size-3.5 text-muted-foreground"})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"mt-3",children:[_.length>0&&f.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mb-6 text-xs",children:_.map(({displayName:S,color:w,count:C})=>{const A=d===S,N=d!==null&&!A;return f.jsxs("div",{className:`flex items-center gap-1.5 cursor-pointer select-none transition-opacity duration-150 ${A?"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5":""}`,style:{opacity:N?.3:1},onPointerEnter:()=>a(S),onPointerLeave:()=>a(null),onClick:()=>c(D=>D===S?null:S),children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:w}}),f.jsx("span",{className:"capitalize text-muted-foreground",children:S}),f.jsx("span",{className:"text-muted-foreground/50",children:C})]},S)})}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"relative h-32 bg-background rounded-lg border border-border/50",children:[f.jsxs("div",{className:"absolute bottom-0 left-0 right-0 h-8 flex items-center justify-between px-2 text-xs text-muted-foreground border-t border-border/50",children:[f.jsx("span",{children:up(0)}),f.jsx("span",{children:up(n/2)}),f.jsx("span",{children:up(n)})]}),f.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((S,w)=>f.jsx(b_e,{event:S,intervalStart:e,intervalDuration:n,sortedEvents:x,closeEventWindow:b.get(w),thresholdLabel:m,highlightedDisplayName:d},`${S.timestamp}-${w}`))})]})})]})})]})}function b_e({event:t,intervalStart:e,intervalDuration:n,sortedEvents:r,closeEventWindow:i,thresholdLabel:s,highlightedDisplayName:o}){const l=(t.timestamp-e)/n*100;if(l<0||l>100)return null;const c=Jn(No),d=N7(t.event_type),m=(i?Math.max(0,i.end-i.start):0)>0,x=R7(t.event_type),b=o===null?null:x===o;return f.jsx(eu,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:b===!1?m_e(d,.8,c):d,zIndex:b===!0?20:1},interactive:m,tooltip:f.jsx(__e,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function __e({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=a=>{const l=R7(a.event_type).split(" ").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return(a.event_type==="weight_update"||a.event_type==="save_batch")&&a.step!==-1?`${l} ${a.step}`:l},s=M.useMemo(()=>!n||e.length===0?[t]:e.slice(n.start,n.end+1).map(l=>l.event),[n,e,t]),o=s.length>1;return f.jsxs("div",{className:"bg-popover text-popover-foreground text-xs rounded-lg shadow-xl whitespace-nowrap border border-border min-w-[220px] max-h-[60vh] overflow-y-auto",children:[o&&f.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2 pb-2 border-b border-border/50 sticky top-0 bg-popover z-10",children:[f.jsx("div",{className:"w-1 h-1 rounded-full bg-amber-500 flex-shrink-0"}),f.jsxs("span",{className:"text-amber-500 font-medium text-[10px]",children:[s.length," events within ",r]})]}),f.jsx("div",{className:`px-3 ${o?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((a,l)=>{const c=N7(a.event_type),d=i(a);return f.jsxs("div",{className:o&&l>0?"pt-2 border-t border-border/30":"",children:[f.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:c}}),f.jsx("span",{children:d})]}),f.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[a.step!==-1&&f.jsxs("div",{children:["Step: ",a.step]}),f.jsxs("div",{children:["Time:"," ",new Date(a.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${a.timestamp}-${l}`)})})]})}function S_e({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:o,isLoading:a,freeLaneAfterGeneration:l=!1}){var Ae;const[x,b]=M.useState(!0),[_,S]=dn(Zle),[w,C]=dn(_T),[A,N]=dn(Kle),[D,P]=dn(RG),[O,R]=dn(Qle),[L,V]=dn(Jle),[F,U]=dn(Xle),[W,Y]=dn(DG),$=Jn(xl),X=8,Z=t.length>X,K=M.useMemo(()=>{if(!Z)return[];const ve=[];for(let qe=0;qe<t.length;qe+=X){const Ee=t.slice(qe,qe+X),Ce=qe,Ye=Math.min(qe+X,t.length)-1;ve.push({label:`${Ce} – ${Ye}`,servers:Ee})}return ve},[t,Z]),ne=Z?Math.min(F,Math.max(0,K.length-1)):0;M.useEffect(()=>{Z&&F!==ne&&U(ne)},[Z,F,ne,U]);const H=Z?((Ae=K[ne])==null?void 0:Ae.servers)??t.slice(0,X):t,B=M.useMemo(()=>typeof o=="number"&&Number.isFinite(o)?o>1:s?new Set(Object.values(s).filter(qe=>qe!==null)).size>1:!1,[s,o]),G=M.useMemo(()=>{const ve=new Set,qe=[];for(const Ee of Object.values(e))for(const Ce of Ee){if(Ce.event_type!=="request"||Ce.sample_id==null||Ce.group_id==null)continue;const Ye=`${Ce.group_id}:${Ce.sample_id}`;ve.has(Ye)||(ve.add(Ye),qe.push({group_id:Ce.group_id,sample_idx:Ce.sample_id}))}return qe},[e]),{data:j}=k7($??"",G,!!$&&G.length>0&&w),ie=!w||G.length===0||!!j,ce=!w||ie,te=M.useMemo(()=>{const ve=new Map;return j==null||j.statuses.forEach(qe=>{ve.set(`${qe.group_id}:${qe.sample_idx}`,qe.kind)}),ve},[j]),se=M.useMemo(()=>{let ve=i;for(const qe of Object.values(e))for(const Ee of qe)Ee.event_type==="request"&&Ee.lane!=null&&Ee.lane+1>ve&&(ve=Ee.lane+1);return ve},[e,i]),le=Math.max(1,t.length),re=Math.max(1,Math.floor(L/le)),pe=se,be=Math.max(1,Math.ceil(pe/re)),xe=Math.min(O,Math.max(0,be-1));M.useEffect(()=>{O!==xe&&R(xe)},[O,xe,R]);const Pe=xe*re,me=re,ke=Math.min(Pe+re-1,pe-1),we=M.useMemo(()=>{let ve=0;for(const qe of Object.values(e))ve+=qe.length;return ve},[e]),Te=M.useMemo(()=>({servers:H,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[H,e,n,r,i]),oe=M.useMemo(()=>`${n}:${r}:${H.join(",")}:${we}:${w}`,[n,r,H,we,w]),[_e,Fe]=M.useState(null),[Ue,Oe]=M.useState(null),[ue,Q]=M.useState(null);ce&&(_e!==Te||Ue!==te||ue!==oe)&&(Fe(Te),Oe(te),Q(oe));const fe=w&&ue!==null&&oe!==ue,Se=M.useCallback(ve=>{if(ve.event_type==="request"&&!(ve.sample_id===void 0||ve.group_id===void 0)){if((W==null?void 0:W.sampleId)===ve.sample_id){Y(null);return}Y({sampleId:ve.sample_id,groupId:ve.group_id,isEval:ve.is_eval})}},[W,Y]);return f.jsxs(Fi,{open:x,onOpenChange:b,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!x&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Inference Servers"}),f.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:a&&f.jsx(hl,{className:"size-3.5 text-muted-foreground"})})]})}),x&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[f.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-l-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>S(ve=>Math.max(2,ve-4)),disabled:_<=2,children:f.jsx(uue,{className:"h-3 w-3"})}),f.jsx("button",{className:"flex items-center justify-center h-7 px-2 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground border-x border-input transition-colors",onClick:()=>S(14),children:"Reset"}),f.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-r-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>S(ve=>Math.min(42,ve+4)),disabled:_>=42,children:f.jsx(lp,{className:"h-3 w-3"})})]}),f.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[f.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-l-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>R(ve=>Math.max(0,ve-1)),disabled:xe<=0,children:f.jsx(M7,{className:"h-3 w-3"})}),f.jsx("span",{className:"flex items-center justify-center h-7 px-2 text-xs text-muted-foreground border-x border-input tabular-nums whitespace-nowrap select-none",children:pe===0?"0":`${Pe}–${ke}`}),f.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-r-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>R(ve=>Math.min(be-1,ve+1)),disabled:xe>=be-1,children:f.jsx(Ir,{className:"h-3 w-3"})})]}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-md border border-input transition-colors",children:f.jsx(UG,{className:"h-3.5 w-3.5"})})}),f.jsxs(ua,{align:"end",children:[f.jsx(K1,{children:"Max Lanes"}),f.jsx(aa,{}),[64,128,256,512,1024].map(ve=>f.jsx(ti,{checked:L===ve,onCheckedChange:()=>{V(ve),R(0)},children:ve},ve))]})]}),Z&&f.jsxs(o8,{value:String(ne),onValueChange:ve=>U(Number(ve)),children:[f.jsx(l8,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(a8,{})}),f.jsx(c8,{children:K.map((ve,qe)=>f.jsxs(u8,{value:String(qe),children:["Servers ",ve.label]},qe))})]}),f.jsx(S1,{variant:"selecting",size:"sm",pressed:w,onPressedChange:C,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),f.jsx(S1,{variant:"selecting",size:"sm",pressed:A,onPressedChange:N,className:"text-xs px-2 h-7",children:"Show Weight Update"}),f.jsx(S1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:P,className:"text-xs px-2 h-7",children:"Show Compute Reward"})]})]}),f.jsxs(Bi,{children:[f.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const ve=_e??(ce?Te:null),qe=Ue??(ce?te:null);if(!ve||!qe)return null;const Ee=fe?!0:ie;return f.jsx("div",{className:`transition-opacity ${fe?"opacity-60":"opacity-100"}`,children:f.jsx("div",{className:"space-y-3",children:ve.servers.map(Ce=>f.jsx(j_e,{server:Ce,nodeId:(s==null?void 0:s[Ce])??null,showNodeLabel:B,events:ve.eventsByServer[Ce]||[],intervalStart:ve.intervalStart,intervalDuration:ve.intervalDuration,numLanes:ve.lanesPerServer,selectedRequest:W,sampleStatusByKey:qe,highlightDiscarded:w,discardStatusReady:Ee,onEventClick:Se,showWeightUpdate:A,showComputeReward:D,laneHeight:_,laneStart:Pe,maxLanesToShow:me,freeLaneAfterGeneration:l},Ce))})})})():f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground bg-muted/30 rounded-lg border border-border/50",children:"No inference events in this interval"})}),f.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[f.jsx("span",{children:up(0)}),f.jsx("span",{children:up(r/2)}),f.jsx("span",{children:up(r)})]})]})]})}const w_e="#075985",M_e="#047857",yX="#0284c7",bX="#10b981",_X="#a1a1a1",SX="#555555",wX="#b0b0b0",MX="#4a4a4a",T_e="#0c4a6e",C_e="#065f46",TX="#8a8a8a",CX="#606060",E_e="#0ea5e9",A_e="#ababab",N_e="#555555",R_e="#0ea5e9",k_e="#ababab",D_e="#555555",P_e="#34d399",I_e="#ababab",O_e="#555555",EX="#0369a1",AX="#0369a1",NX="#047857",RX="#0284c7",kX="#0284c7",DX="#10b981",PX="#b3b3b3",IX="#505050",OX="#b3b3b3",LX="#505050",jX="#b3b3b3",zX="#505050";function L_e({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:o,onSampleClick:a,showNodeLabel:l,isEval:c}){const d=Object.keys(t).map(Number).sort((F,U)=>F-U),p=Jn(_T),m=Jn(No),x=m?"1px solid rgba(255, 255, 255, 0.2)":"1px solid rgba(0, 0, 0, 0.3)",b=m?"1px solid rgba(255, 255, 255, 0.1)":"1px solid rgba(0, 0, 0, 0.12)",_=m?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",S=M.useMemo(()=>d.map(F=>({group_id:r,sample_idx:F})),[r,d.join(",")]),{data:w}=k7(i,S,!!i&&S.length>0&&p),C=!p||S.length===0||!!w,A=M.useMemo(()=>!p||!(w!=null&&w.statuses)?!1:w.statuses.some(F=>F.kind==="rollouts_discarded"),[p,w]),N=M.useMemo(()=>{for(const F of Object.values(t))if(F.some(U=>U.is_eval))return!0;return!1},[t]),D=M.useMemo(()=>{for(const F of Object.values(t))if(F.some(U=>U.is_canceled))return!0;return!1},[t]),P=D?m?MX:wX:A?m?SX:_X:N?bX:yX,O=16,R=3,L=d.length*O+(d.length-1)*R,V=48;return C?f.jsxs("div",{className:"px-3 pb-2",children:[f.jsxs("div",{className:"flex items-start",children:[f.jsx("div",{className:"flex flex-col pr-2",style:{width:V,gap:R},children:d.map(F=>{const U=F===e;return f.jsx(u_e,{runPath:i,groupId:r,sampleId:F,isEval:c,isCanceled:D,children:f.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${U?D?"text-muted-foreground bg-gray-400/15 hover:bg-gray-400/25":A?"text-muted-foreground bg-gray-500/15 hover:bg-gray-500/25":N?"text-emerald-800 bg-emerald-500/15 hover:bg-emerald-500/25":"text-sky-900 bg-sky-500/15 hover:bg-sky-500/25":D?"text-muted-foreground bg-gray-400/10 hover:bg-gray-400/20":A?"text-muted-foreground bg-gray-500/10 hover:bg-gray-500/20":N?"text-emerald-600 bg-emerald-500/10 hover:bg-emerald-500/20":"text-sky-700 bg-sky-500/10 hover:bg-sky-500/20"}`,style:{height:O,width:34},children:F})},F)})}),f.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:L},children:d.map((F,U)=>{const W=t[F],Y=F===e,$=U*(O+R),X=Y?D?m?CX:TX:A?m?"#9ca3af":"#6b7280":N?C_e:T_e:P,Z=[...W].sort((G,j)=>G.start_time-j.start_time),K=(s==null?void 0:s[F])??[],ne=(o==null?void 0:o[F])??0,H=[];for(let G=0;G<Z.length&&G<K.length;G++){const j=K[G].time;j>0&&H.push({start:Z[G].end_time,duration:j,idx:G})}let B=0;if(ne>0&&Z.length>0&&(B=Z[Z.length-1].end_time,K.length>=Z.length)){const j=K[Z.length-1];j&&j.time>0&&(B+=j.time)}return f.jsxs("div",{className:"absolute left-0 right-0",style:{top:$,height:O},children:[W.map((G,j)=>{const ce=(G.start_time-n.start)/n.duration*100,te=G.end_time-G.start_time,se=te*1e3,le=Math.max(.5,te/n.duration*100);return f.jsx(eu,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${ce}%`,width:`${Math.min(le,100-ce)}%`,backgroundColor:X,borderRadius:"1px",border:D?b:x,boxSizing:"border-box"},onClick:a?()=>a(F):void 0,tooltip:f.jsx(Ku,{title:G.sample_id!==void 0?`Sample ${G.sample_id}`:G.group_id!==void 0?`Group ${G.group_id}`:"Request",titleSecondary:G.group_id!==void 0?`Group ${G.group_id}`:null,color:X,statusLabel:D?{text:"Canceled",className:"text-muted-foreground"}:A?{text:"Discarded",className:"text-red-700"}:null,details:xX(G,se,[{label:"Server",value:String(G.server)},...l&&G.node_id!==null&&G.node_id!==void 0?[{label:"Node",value:String(G.node_id)}]:[]]),startTime:G.start_time,endTime:G.end_time})},`req-${j}`)}),H.map(G=>{const ie=(G.start-n.start)/n.duration*100,ce=Math.max(.3,G.duration/n.duration*100),te=G.duration*1e3,se=Y?A?m?"#9ca3af":"#6b7280":EX:A?m?IX:PX:RX;return f.jsx(eu,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${ie}%`,width:`${Math.min(ce,100-ie)}%`,backgroundColor:se,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(F):void 0,tooltip:f.jsx(Ku,{title:"Env Response",titleSecondary:`Turn ${G.idx}`,color:se,details:[{label:"Duration",value:As(te)}]})},`env-${G.idx}`)}),ne>0&&Z.length>0&&(()=>{const j=(B-n.start)/n.duration*100,ie=Math.max(.3,ne/n.duration*100),ce=ne*1e3,te=Y?A?m?"#9ca3af":"#6b7280":c?NX:AX:A?c?m?zX:jX:m?LX:OX:c?DX:kX;return f.jsx(eu,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${j}%`,width:`${Math.min(ie,100-j)}%`,backgroundColor:te,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(F):void 0,tooltip:f.jsx(Ku,{title:c?"Compute Metrics":"Compute Reward",color:te,details:[{label:"Duration",value:As(ce)}]})})})()]},F)})})]}),f.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:V},children:[f.jsx("span",{children:As(0)}),f.jsx("span",{children:As(n.duration/2*1e3)}),f.jsx("span",{children:As(n.duration*1e3)})]})]}):f.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:L+24},children:f.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function j_e({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:o,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onEventClick:p,showWeightUpdate:m=!0,showComputeReward:x=!1,laneHeight:b=14,laneStart:_=0,maxLanesToShow:S,freeLaneAfterGeneration:w=!1}){const C=Jn(No),A=C?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",N=C?"1.5px solid rgba(255, 255, 255, 0.15)":"1.5px solid rgba(0, 0, 0, 0.2)",D=n&&e!==null&&e!==void 0?e:void 0,P=M.useMemo(()=>r.filter(K=>K.event_type==="weight_broadcast"),[r]),O=M.useMemo(()=>r.filter(K=>K.event_type==="request"),[r]),{assignedEvents:R,actualNumLanes:L}=M.useMemo(()=>{const K=[],ne=[];for(const B of O)B.lane!=null&&B.lane>=0?K.push({...B,lane:B.lane}):ne.push(B);if(ne.length>0){const B=[...ne].sort((j,ie)=>j.start_time-ie.start_time),G=[];for(const j of B){const ie=w?j.end_time+(j.environment_response_time??0):j.end_time+(j.environment_response_time??0)+(j.compute_reward_time??0);let ce=!1;for(let te=0;te<G.length;te++)if(G[te]<=j.start_time){G[te]=ie,K.push({...j,lane:te}),ce=!0;break}if(!ce){const te=G.length;G.push(ie),K.push({...j,lane:te})}}}const H=K.reduce((B,G)=>Math.max(B,G.lane),-1);return{assignedEvents:K,actualNumLanes:Math.max(o,H+1)}},[O,o,w]),V=i+s,F=b,U=S!==void 0?Math.min(_+S,L):L,W=Math.max(0,U-_),Y=W*F+Math.max(0,W-1)*2,$=M.useMemo(()=>Array.from({length:W},(K,ne)=>ne),[W]),{laneEventsByIndex:X,idlePeriodsByLane:Z}=M.useMemo(()=>{const K=Array.from({length:L},()=>[]);for(const H of R){const B=H.lane;K[B]&&K[B].push(H)}const ne=K.map(H=>{const B=[];if(H.length>0){H[0].start_time>i&&B.push({start:i,end:H[0].start_time,duration:H[0].start_time-i});for(let j=0;j<H.length-1;j++){const ie=H[j].end_time,ce=H[j+1].start_time;ie<ce&&B.push({start:ie,end:ce,duration:ce-ie})}const G=H[H.length-1];G.end_time<V&&B.push({start:G.end_time,end:V,duration:V-G.end_time})}else B.push({start:i,end:V,duration:s});return B});return{laneEventsByIndex:K,idlePeriodsByLane:ne}},[R,i,V,s,L]);return f.jsxs("div",{children:[f.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[f.jsxs("span",{children:["Server ",t]}),n&&e!==null&&e!==void 0&&f.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:Y},children:[$.map(K=>{const ne=K+_,H=K*(F+2),B=X[ne]||[],G=Z[ne]||[];return f.jsxs("div",{className:"absolute left-0 right-0",style:{top:H,height:F},children:[G.map((j,ie)=>{const ce=Math.max(j.start,i),te=Math.min(j.end,V),se=te-ce,le=(ce-i)/s*100,re=se/s*100;if(re<.5||le>=100||te<=ce)return null;const pe=C?BG:C2;return f.jsx(eu,{className:"absolute top-0 bottom-0 group",style:{left:`${le}%`,width:`${Math.min(re,100-le)}%`,backgroundColor:pe,borderRadius:"1px"},tooltip:f.jsx(Ku,{title:"Idle",color:pe,details:[{label:"Duration",value:As(j.duration*1e3)},{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[],{label:"Lane",value:String(ne)}]})},`idle-${ie}`)}),B.map((j,ie)=>{const ce=j.environment_response_time,te=j.compute_reward_time,se=sj(j,"env",a,l,c,d,C),le=sj(j,"reward",a,l,c,d,C);return f.jsxs(M.Fragment,{children:[f.jsx(U_e,{event:j,server:t,nodeId:D,lane:ne,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onClick:()=>p(j)}),ce!=null&&ce>0&&(()=>{const re=i+s,pe=j.end_time,be=pe+ce;if(pe>=re||be<=i)return null;const xe=Math.max(pe,i),Pe=Math.min(be,re),me=Math.max(0,(xe-i)/s*100),ke=Math.max(.3,(Pe-xe)/s*100),we=ce*1e3;return f.jsx(eu,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${me}%`,width:`${Math.min(ke,100-me)}%`,backgroundColor:se.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:se.opacity},onClick:()=>p(j),tooltip:f.jsx(Ku,{title:"Env Response",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:se.color,details:[{label:"Duration",value:As(we)},...j.group_id!==void 0?[{label:"Group",value:String(j.group_id)}]:[],{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[],{label:"Lane",value:String(ne)}]})})})(),x&&te!=null&&te>0&&(()=>{const re=i+s,pe=j.end_time+(ce!=null&&ce>0?ce:0),be=pe+te;if(pe>=re||be<=i)return null;const xe=Math.max(pe,i),Pe=Math.min(be,re),me=Math.max(0,(xe-i)/s*100),ke=Math.max(.3,(Pe-xe)/s*100),we=te*1e3,Te=w?Math.max(3,Math.round(F*.4)):void 0,oe=w?Math.round((F-Te)/2):void 0;return f.jsx(eu,{className:"absolute group cursor-pointer",style:{left:`${me}%`,width:`${Math.min(ke,100-me)}%`,backgroundColor:le.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:le.opacity,...w?{top:oe,height:Te,zIndex:2}:{top:0,bottom:0}},onClick:()=>p(j),tooltip:f.jsx(Ku,{title:j.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:le.color,details:[{label:"Duration",value:As(we)},...j.group_id!==void 0?[{label:"Group",value:String(j.group_id)}]:[],{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[],{label:"Lane",value:String(ne)}]})})})()]},`event-${ie}`)})]},ne)}),m&&P.map((K,ne)=>{const H=K.start_time-i,B=Math.max(0,H/s*100),j=(K.end_time-K.start_time)*1e3,ie=Math.max(K.start_time,i),ce=K.end_time-ie,te=Math.max(.5,ce/s*100),se=HG(K.event_type);return f.jsx(eu,{className:"absolute group cursor-default",style:{top:0,left:`${B}%`,width:`${Math.min(te,100-B)}%`,height:Y,backgroundColor:se,borderRadius:"2px",border:N,boxSizing:"border-box",opacity:.6},tooltip:f.jsx(Ku,{title:"Weight Broadcast",color:se,details:[...K.step!=null?[{label:"Step",value:String(K.step)}]:[],{label:"Duration",value:As(j)},{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[]],startTime:K.start_time,endTime:K.end_time})},`wb-${ne}`)})]})})]})}function z_e(t,e,n=!0,r=!0,i=!1){if(t.event_type!=="request")return HG(t.event_type);if(t.is_canceled)return i?T2:E7;if(!n)return t.is_eval?nA:FM;if(!r)return i?M2:w2;if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?nA:FM;const s=`${t.group_id}:${t.sample_id}`;return e.get(s)==="rollouts_discarded"?i?M2:w2:t.is_eval?nA:FM}function F_e(t,e,n,r=!0,i=!0,s=!1){const o=z_e(t,n,r,i,s);if(!e)return{color:o,opacity:1};const a=o===w2||o===M2,l=o===E7||o===T2;return t.sample_id===e.sampleId?l?{color:s?CX:TX,opacity:1}:a?{color:s?"#9ca3af":"#6b7280",opacity:1}:{color:t.is_eval?M_e:w_e,opacity:1}:t.group_id===e.groupId?l?{color:s?MX:wX,opacity:1}:a?{color:s?SX:_X,opacity:1}:{color:t.is_eval?bX:yX,opacity:1}:{color:o,opacity:.55}}function sj(t,e,n,r,i,s,o=!1){const a=e==="reward"&&t.is_eval,l=(()=>{if(!i)return!1;if(!s)return!0;if(t.sample_id==null||t.group_id==null)return!1;const d=`${t.group_id}:${t.sample_id}`;return r.get(d)==="rollouts_discarded"})(),c=l?e==="env"?o?N_e:A_e:a?o?O_e:I_e:o?D_e:k_e:e==="env"?E_e:a?P_e:R_e;return n?t.sample_id===n.sampleId?l?{color:o?"#9ca3af":"#6b7280",opacity:1}:{color:e==="env"?EX:a?NX:AX,opacity:1}:t.group_id===n.groupId?{color:l?e==="env"?o?IX:PX:a?o?zX:jX:o?LX:OX:e==="env"?RX:a?DX:kX,opacity:1}:{color:c,opacity:.35}:{color:c,opacity:.85}}function U_e({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:a,highlightDiscarded:l,discardStatusReady:c,onClick:d}){const p=Jn(No),m=i+s;if(t.end_time<=i||t.start_time>=m)return null;const x=t.start_time-i,b=Math.max(0,x/s*100),S=(t.end_time-t.start_time)*1e3,w=Math.max(t.start_time,i),A=(t.end_time-w)/s*100,{color:N,opacity:D}=F_e(t,o,a,l,c,p),P=t.event_type==="request"&&t.sample_id!==void 0,O=(()=>{if(t.event_type!=="request")return null;if(t.is_canceled)return{text:"Canceled",className:"text-muted-foreground"};if(l&&c&&t.sample_id!=null&&t.group_id!=null){const R=`${t.group_id}:${t.sample_id}`;if(a.get(R)==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"}}return null})();return f.jsx(eu,{className:`absolute top-0 bottom-0 group ${P?"cursor-pointer":"cursor-default"}`,style:{left:`${b}%`,width:`${Math.min(A,100-b)}%`,minWidth:"1px",backgroundColor:N,borderRadius:"1px",border:t.is_canceled?p?"1.5px solid rgba(255, 255, 255, 0.15)":"1.5px solid rgba(0, 0, 0, 0.2)":p?"1.5px solid rgba(255, 255, 255, 0.2)":"1.5px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box",opacity:D},onClick:P?d:void 0,tooltip:f.jsx(Ku,{title:t.event_type==="request"?t.sample_id!==void 0?`Sample ${t.sample_id}`:t.group_id!==void 0?`Group ${t.group_id}`:"Request":t.event_type,titleSecondary:t.event_type==="request"&&t.group_id!==void 0?`Group ${t.group_id}`:null,color:N,capitalize:!0,statusLabel:O,details:t.event_type==="request"?xX(t,S,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:As(S)},{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}],startTime:t.start_time,endTime:t.end_time})})}function B_e({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:a,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:d,trainerSystemGpuIndices:p,trainerRankInfoByRank:m,totalSetupNodes:x,isLoading:b}){var se;const[_,S]=M.useState(!0),[w,C]=dn(kG),[A,N]=dn(Yle),D=M.useMemo(()=>{const le=new Set;return(l??[]).forEach(re=>{typeof re=="string"&&le.add(re)}),Array.from(le)},[l]),[P,O]=M.useState([]),R=((p==null?void 0:p.length)??0)===0;R&&P.length>0?O([]):!R&&D.length>0&&P!==D&&O(D);const L=M.useMemo(()=>R?[]:D.length>0?D:P,[R,D,P]),V=M.useMemo(()=>Array.from(new Set((c??[]).filter(le=>typeof le=="string"&&le.trim().length>0))),[c]),F=M.useMemo(()=>L.length===0?V:V.filter(le=>L.includes(le)),[L,V]),U=M.useMemo(()=>{const le=Object.keys(m??{}).map(Number).filter(re=>Number.isFinite(re)).sort((re,pe)=>re-pe);return le.length>0?le:!p||p.length===0?[]:p.map((re,pe)=>pe)},[m,p]),W=M.useMemo(()=>{const le=new Set;return t.forEach(re=>le.add(re)),U.forEach(re=>le.add(re)),Array.from(le).sort((re,pe)=>re-pe)},[t,U]),Y=8,$=W.length>Y,X=M.useMemo(()=>{if(!$)return[];const le=[];for(let re=0;re<W.length;re+=Y){const pe=W.slice(re,re+Y),be=re+1,xe=Math.min(re+Y,W.length);le.push({label:`${be} – ${xe}`,ranks:pe})}return le},[W,$]),Z=$?Math.min(A,Math.max(0,X.length-1)):0;M.useEffect(()=>{$&&A!==Z&&N(Z)},[$,A,Z,N]);const K=$?((se=X[Z])==null?void 0:se.ranks)??W.slice(0,Y):W;M.useMemo(()=>new Set(K),[K]);const ne=M.useMemo(()=>{const le=new Map;return Object.entries(e).forEach(([re,pe])=>{const be=new Set;pe.forEach(xe=>{if(!xe.event_type.includes("/"))return;const Pe=xe.event_type.split("/")[0];be.add(`${Pe}|${xe.step}`)}),le.set(Number(re),be)}),le},[e]),H=M.useMemo(()=>{const le=new Map;return K.forEach(re=>{var xe;const pe=((xe=m==null?void 0:m[re])==null?void 0:xe.node_id)??null,be=pe===null?"__unknown__":String(pe);le.has(be)||le.set(be,{nodeId:pe,ranks:[]}),le.get(be).ranks.push(re)}),Array.from(le.values()).map(re=>({nodeId:re.nodeId,ranks:re.ranks.sort((pe,be)=>pe-be)})).sort((re,pe)=>re.nodeId===null&&pe.nodeId===null?0:re.nodeId===null?1:pe.nodeId===null?-1:re.nodeId-pe.nodeId)},[K,m]),B=M.useMemo(()=>typeof x=="number"&&Number.isFinite(x)?x>1:H.filter(re=>re.nodeId!==null).length>1,[H,x]),G=M.useCallback(le=>{var pe;le.event_type.includes("/")||!(((pe=ne.get(le.rank))==null?void 0:pe.has(`${le.event_type}|${le.step}`))??!1)||C(be=>(be==null?void 0:be.eventType)===le.event_type&&(be==null?void 0:be.rank)===le.rank&&(be==null?void 0:be.step)===le.step?null:{eventType:le.event_type,rank:le.rank,step:le.step})},[ne,C]),j=M.useCallback((le,re)=>{const pe=F,xe=re===!0?pe.includes(le)?pe:[...pe,le]:pe.filter(Pe=>Pe!==le);d==null||d(xe)},[F,d]),ie=M.useCallback(()=>d==null?void 0:d([...L]),[L,d]),ce=M.useCallback(()=>d==null?void 0:d([]),[d]),te=M.useCallback(le=>{const re=m==null?void 0:m[le],pe=(re==null?void 0:re.local_rank)??(p?p[le]:void 0),be=(o==null?void 0:o[le])??(pe!==void 0&&s?s[pe]??[]:void 0);return f.jsx(V_e,{rank:le,nodeId:(re==null?void 0:re.node_id)??null,showNodeLabel:B,events:e[le]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:w,onEventClick:G,childEventKeys:ne.get(le)??g_e,systemGpuIndex:pe,gpuMetrics:be,selectedMetricNames:F,gpuMetricsIsLoading:a??!1},le)},[ne,F,e,G,r,i,n,w,s,o,a,m,p,B]);return f.jsxs(Fi,{open:_,onOpenChange:S,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Trainer GPUs"}),f.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:b&&f.jsx(hl,{className:"size-3.5 text-muted-foreground"})})]})}),_&&f.jsxs(f.Fragment,{children:[$&&f.jsxs(o8,{value:String(Z),onValueChange:le=>N(Number(le)),children:[f.jsx(l8,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(a8,{})}),f.jsx(c8,{children:X.map((le,re)=>f.jsxs(u8,{value:String(re),children:["GPUs ",le.label]},re))})]}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-md border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors",children:["Plots",f.jsx("span",{className:"text-[10px] font-medium rounded bg-accent text-accent-foreground px-1.5 py-0.5",children:F.length}),f.jsx(Ir,{className:"h-3 w-3 text-muted-foreground"})]})}),f.jsxs(ua,{align:"start",className:"w-64",children:[f.jsx(K1,{children:"Trainer GPU Plots"}),f.jsx(aa,{}),f.jsx(ra,{onSelect:le=>{le.preventDefault(),ie()},className:"text-xs",children:"Select All"}),f.jsx(ra,{onSelect:le=>{le.preventDefault(),ce()},className:"text-xs",children:"Unselect All"}),f.jsx(aa,{}),L.length>0?L.map(le=>f.jsx(ti,{checked:F.includes(le),onCheckedChange:re=>j(le,re),onSelect:re=>re.preventDefault(),className:"text-xs",children:vX(le)},le)):f.jsx(ra,{disabled:!0,className:"text-xs text-muted-foreground",children:a?"Loading plots...":"No plots available"})]})]})]})]}),f.jsxs(Bi,{children:[f.jsx("div",{className:"space-y-4",children:K.length>0?B?H.map(le=>f.jsx(H_e,{nodeId:le.nodeId,rankCount:le.ranks.length,children:le.ranks.map(re=>te(re))},le.nodeId===null?"__unknown__":String(le.nodeId))):K.map(le=>te(le)):f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground bg-muted/30 rounded-lg border border-border/50",children:"No trainer events in this interval"})}),f.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[f.jsx("span",{children:up(0)}),f.jsx("span",{children:up(r/2)}),f.jsx("span",{children:up(r)})]})]})]})}function H_e({nodeId:t,rankCount:e,children:n}){const[r,i]=M.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return f.jsxs(Fi,{open:r,onOpenChange:i,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),f.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),f.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function V_e({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:o,selectedEvent:a,onEventClick:l,childEventKeys:c,systemGpuIndex:d,gpuMetrics:p,selectedMetricNames:m,gpuMetricsIsLoading:x}){const b=M.useMemo(()=>[...r.filter(D=>!D.event_type.includes("/"))].sort((D,P)=>D.start_time-P.start_time),[r]),_=M.useMemo(()=>FX(b,i,o),[b,i,o]),S=M.useMemo(()=>{if(!p||p.length===0)return{};const N={};return p.forEach(D=>{N[D.metric_name]||(N[D.metric_name]=[]),N[D.metric_name].push(D)}),N},[p]),w=M.useMemo(()=>{const N=new Set;return p==null||p.forEach(D=>{Number.isFinite(D.gpu_index)&&N.add(D.gpu_index)}),N.size>0?Array.from(N).sort((D,P)=>D-P):d!==void 0?[d]:[]},[p,d]),C=n&&e!==null&&e!==void 0?`Rank ${t} Node ${e}`:`Rank ${t}`,A=M.useMemo(()=>{if(w.length===0)return;const N={};return w.forEach(D=>{N[D]=C}),N},[w,C]);return f.jsxs("div",{children:[f.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[f.jsxs("span",{children:["Rank ",t]}),n&&e!==null&&e!==void 0&&f.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),f.jsxs("div",{className:"relative",children:[f.jsxs("div",{className:"relative h-12 bg-muted/30 rounded-lg border border-border/50",children:[_.map((N,D)=>f.jsx(G_e,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:a!==null},`idle-${D}`)),b.map((N,D)=>{const P=(a==null?void 0:a.eventType)===N.event_type&&(a==null?void 0:a.rank)===N.rank&&(a==null?void 0:a.step)===N.step,O=c.has(`${N.event_type}|${N.step}`),R=a!==null&&!P;return f.jsx(W_e,{event:N,intervalStart:i,intervalDuration:s,isSelected:P,isDimmed:R,hasChildren:O,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${D}`)})]}),w.length>0&&m.map(N=>f.jsxs("div",{className:`mt-2 transition-opacity duration-200 ${x?"opacity-50":""}`,children:[f.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:vX(N)}),f.jsx(R$,{metricName:N,data:S[N]??[],gpuIndices:w,intervalStart:i,intervalEnd:o,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:x})]},N))]})]})}function G_e({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const o=Jn(No)?BG:C2,l=(t.start-n)/r*100,c=t.duration/r*100;return c<.5||l<0||l>=100?null:f.jsx(eu,{className:"absolute top-1 bottom-1 group cursor-pointer transition-opacity duration-200",style:{left:`${l}%`,width:`${Math.min(c,100-l)}%`,backgroundColor:o,borderRadius:"2px",opacity:i?.3:1},tooltip:f.jsx(Ku,{title:"Idle",color:o,details:[{label:"Duration",value:As(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function W_e({event:t,intervalStart:e,intervalDuration:n,isSelected:r=!1,isDimmed:i=!1,hasChildren:s=!1,onClick:o}){const a=e+n;if(t.end_time<=e||t.start_time>=a)return null;const l=t.start_time-e,c=Math.max(0,l/n*100),p=(t.end_time-t.start_time)*1e3,m=Math.max(t.start_time,e),b=(t.end_time-m)/n*100,_=E2(t.event_type),S=VG(t.event_type,t.step,t.microbatch,t.minibatch);return f.jsx(eu,{className:`absolute top-1 bottom-1 group transition-all duration-200 ${s?"cursor-pointer":"cursor-default"}`,style:{left:`${c}%`,width:`${Math.min(b,100-c)}%`,minWidth:"1px",backgroundColor:_,borderRadius:"2px",opacity:i?.3:1,boxShadow:r?`0 0 0 2px ${_}, 0 0 8px ${_}`:void 0,zIndex:r?10:1},onClick:s?o:void 0,tooltip:f.jsx(Ku,{title:S.primary,titleSecondary:S.secondary,color:_,details:[{label:"Duration",value:As(p)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function $_e({parentEvent:t,childEvents:e}){const n=Jn(No),r=[...e].sort((l,c)=>l.start_time-c.start_time),i=t.start_time,s=t.end_time,o=s-i,a=FX(r,i,s);return f.jsxs("div",{className:"px-3 pb-2",children:[f.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 text-xs",children:r.map(l=>{const c=E2(l.event_type),d=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type,p=l.end_time-l.start_time,m=o>0?(p/o*100).toFixed(0):"0";return f.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{backgroundColor:`${c}20`},children:[f.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:c}}),f.jsx("span",{className:"capitalize text-muted-foreground",children:d}),f.jsx("span",{className:"font-medium",children:As(p*1e3)}),f.jsxs("span",{className:"text-muted-foreground",children:[m,"%"]})]},l.event_type)})}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"relative h-7 bg-muted/30 rounded-lg border border-border/50",children:[a.map((l,c)=>{const p=(l.start-i)/o*100,m=l.duration/o*100;return m<.5||p<0||p>=100?null:f.jsx(eu,{className:"absolute top-px bottom-px group",style:{left:`${p}%`,width:`${Math.min(m,100-p)}%`,backgroundColor:C2,borderRadius:"1px",opacity:.5},tooltip:f.jsx(Ku,{title:"Gap",color:C2,details:[{label:"Duration",value:As(l.duration*1e3)}]})},`child-idle-${c}`)}),r.map((l,c)=>{const d=l.start_time-i,p=Math.max(0,d/o*100),m=l.end_time-l.start_time,x=m*1e3,b=Math.max(.5,m/o*100),_=E2(l.event_type),S=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type;return f.jsx(eu,{className:"absolute top-px bottom-px group cursor-default flex items-center justify-center",style:{left:`${p}%`,width:`${Math.min(b,100-p)}%`,backgroundColor:_,borderRadius:"1px",border:n?"1px solid rgba(255, 255, 255, 0.2)":"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},tooltip:f.jsx(Ku,{title:S||l.event_type,color:_,capitalize:!0,details:[{label:"Duration",value:As(x)},{label:"% of parent",value:`${(m/o*100).toFixed(1)}%`}],startTime:l.start_time,endTime:l.end_time}),children:b>8&&f.jsx("span",{className:"text-[9px] font-medium text-white truncate px-1 drop-shadow-sm pointer-events-none",children:S})},`child-${l.start_time}-${c}`)})]})}),f.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[f.jsx("span",{children:As(0)}),f.jsx("span",{children:As(o/2*1e3)}),f.jsx("span",{children:As(o*1e3)})]})]})}function Ku({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:o,endTime:a,statusLabel:l}){return f.jsxs("div",{className:"bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl whitespace-nowrap pointer-events-none border border-border min-w-[200px]",children:[f.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:n}}),f.jsxs("span",{className:i?"capitalize":"",children:[t,e&&f.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:e})]})]}),l&&f.jsx("div",{className:`font-semibold mb-1.5 ${l.className}`,children:l.text}),f.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[r.map(c=>f.jsxs("div",{children:[c.label,": ",c.value]},c.label)),s!==void 0&&f.jsxs("div",{children:["Time: ",new Date(s*1e3).toISOString().slice(11,23)]}),o!==void 0&&f.jsxs("div",{children:["Start: ",new Date(o*1e3).toISOString().slice(11,23)]}),a!==void 0&&f.jsxs("div",{children:["End: ",new Date(a*1e3).toISOString().slice(11,23)]})]})]})}function eu({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[o,a]=M.useState(!1),[l,c]=M.useState(!1),[d,p]=M.useState({x:0,y:0}),[m,x]=M.useState(null),b=M.useRef(null),_=M.useRef(null),S=o||l,w=l&&m?m:d;M.useLayoutEffect(()=>{const A=b.current;if(!S||!A)return;const N=A.getBoundingClientRect(),D=8;let P=w.x-N.width/2;P+N.width+D>window.innerWidth&&(P=window.innerWidth-N.width-D),P<D&&(P=D);let O=w.y-N.height-12;O<D&&(O=w.y+16),O+N.height+D>window.innerHeight&&(O=window.innerHeight-N.height-D),A.style.left=`${P}px`,A.style.top=`${O}px`,A.style.visibility="visible"},[S,w]),M.useEffect(()=>{if(!l)return;const A=D=>{var O,R;const P=D.target;(O=b.current)!=null&&O.contains(P)||(R=_.current)!=null&&R.contains(P)||(c(!1),x(null))},N=setTimeout(()=>{document.addEventListener("pointerdown",A)},0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",A)}},[l]);const C=M.useCallback(()=>{s&&c(A=>A?(x(null),!1):(x(d),!0)),n==null||n()},[s,n,d]);return f.jsxs("div",{ref:_,className:t,style:e,onClick:C,onPointerEnter:A=>{p({x:A.clientX,y:A.clientY}),a(!0)},onPointerLeave:()=>{a(!1)},onPointerMove:A=>{l||p({x:A.clientX,y:A.clientY})},children:[i,S?Wd.createPortal(f.jsx("div",{ref:b,className:"fixed",style:{left:w.x,top:w.y,zIndex:99999,visibility:"hidden",pointerEvents:l?"auto":"none"},children:r}),document.body):null]})}function FX(t,e,n){const r=[];t.length>0&&t[0].start_time>e&&r.push({start:e,end:t[0].start_time,duration:t[0].start_time-e});for(let i=0;i<t.length-1;i++){const s=t[i].end_time,o=t[i+1].start_time;s<o&&r.push({start:s,end:o,duration:o-s})}if(t.length>0){const i=t[t.length-1];i.end_time<n&&r.push({start:i.end_time,end:n,duration:n-i.end_time})}else r.push({start:e,end:n,duration:n-e});return r}function q8({currentPage:t,totalPages:e,onPageChange:n,disabled:r=!1,pageValues:i}){const s=(i==null?void 0:i[t])??t,o=(i==null?void 0:i[0])??0,a=i&&i.length>0?i[i.length-1]:Math.max(0,e-1),[l,c]=M.useState(s.toString());M.useEffect(()=>{c(s.toString())},[s]);const d=x=>{c(x.target.value)},p=x=>{if(x.key==="Enter"){const b=parseInt(l,10);if(isNaN(b)){c(s.toString());return}if(i&&i.length>0){const _=i.indexOf(b);_>=0?n(_):c(s.toString());return}b>=0&&b<e?n(b):c(s.toString())}},m=()=>{c(s.toString())};return f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:f.jsx(Hce,{className:"h-3.5 w-3.5"})}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:f.jsx(w7,{className:"h-3.5 w-3.5"})}),f.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[f.jsx(cp,{type:"number",value:l,onChange:d,onKeyDown:p,onBlur:m,disabled:r,className:"w-12 h-6 text-center px-1 py-0 text-xs",min:o,max:a}),f.jsxs("span",{className:"text-muted-foreground",children:["/ ",a]})]}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:f.jsx(Zg,{className:"h-3.5 w-3.5"})}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:f.jsx(Gce,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const ww="183",kg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Dg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UX=0,UR=1,BX=2,q_e=3,HX=0,A1=1,U_=2,zg=3,_p=0,$l=1,Kc=2,sh=0,ex=1,BR=2,HR=3,VR=4,VX=5,X_e=6,P0=100,GX=101,WX=102,$X=103,qX=104,XX=200,YX=201,KX=202,ZX=203,q2=204,X2=205,QX=206,JX=207,eY=208,tY=209,nY=210,rY=211,iY=212,sY=213,oY=214,Y2=0,K2=1,Z2=2,px=3,Q2=4,J2=5,e5=6,t5=7,Mw=0,aY=1,lY=2,ou=0,X8=1,Y8=2,K8=3,oC=4,Z8=5,Q8=6,J8=7,GR="attached",cY="detached",aC=300,ch=301,om=302,B_=303,H_=304,jy=306,_S=1e3,Ec=1001,SS=1002,Co=1003,e9=1004,Y_e=1004,d1=1005,K_e=1005,rs=1006,V_=1007,Z_e=1007,Jf=1008,Q_e=1008,Bl=1009,t9=1010,n9=1011,ly=1012,lC=1013,id=1014,Wl=1015,uh=1016,cC=1017,uC=1018,cy=1020,r9=35902,i9=35899,s9=1021,o9=1022,ml=1023,dh=1026,W0=1027,dC=1028,Tw=1029,mx=1030,fC=1031,J_e=1032,hC=1033,G_=33776,W_=33777,$_=33778,q_=33779,n5=35840,r5=35841,i5=35842,s5=35843,o5=36196,a5=37492,l5=37496,c5=37488,u5=37489,d5=37490,f5=37491,h5=37808,p5=37809,m5=37810,g5=37811,x5=37812,v5=37813,y5=37814,b5=37815,_5=37816,S5=37817,w5=37818,M5=37819,T5=37820,C5=37821,E5=36492,A5=36494,N5=36495,R5=36283,k5=36284,D5=36285,P5=36286,uY=2200,dY=2201,fY=2202,wS=2300,I5=2301,WM=2302,WR=2303,Fg=2400,Ug=2401,MS=2402,pC=2500,a9=2501,eSe=0,tSe=1,nSe=2,hY=3200,pY=3201,rSe=3202,iSe=3203,wm=0,mY=1,op="",pl="srgb",am="srgb-linear",TS="linear",zi="srgb",sSe="",oSe="rg",aSe="ga",lSe=0,Pg=7680,cSe=7681,uSe=7682,dSe=7683,fSe=34055,hSe=34056,pSe=5386,mSe=512,gSe=513,xSe=514,vSe=515,ySe=516,bSe=517,_Se=518,$R=519,gY=512,xY=513,vY=514,mC=515,yY=516,bY=517,gC=518,_Y=519,CS=35044,SSe=35048,wSe=35040,MSe=35045,TSe=35049,CSe=35041,ESe=35046,ASe=35050,NSe=35042,RSe="100",qR="300 es",tu=2e3,gx=2001,kSe={COMPUTE:"compute",RENDER:"render"},DSe={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},PSe={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},ISe={TEXTURE_COMPARE:"depthTextureCompare"};function OSe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const LSe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function f1(t,e){return new LSe[t](e)}function SY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ES(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function wY(){const t=ES("canvas");return t.style.display="block",t}const oj={};let lm=null;function jSe(t){lm=t}function zSe(){return lm}function AS(...t){const e="THREE."+t.shift();lm?lm("log",e,...t):console.log(e,...t)}function MY(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 gn(...t){t=MY(t);const e="THREE."+t.shift();if(lm)lm("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Un(...t){t=MY(t);const e="THREE."+t.shift();if(lm)lm("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function NS(...t){const e=t.join(" ");e in oj||(oj[e]=!0,gn(...t))}function FSe(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}const USe={[Y2]:K2,[Z2]:e5,[Q2]:t5,[px]:J2,[K2]:Y2,[e5]:Z2,[t5]:Q2,[J2]:px};let yh=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}};const cl=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let aj=1234567;const tx=Math.PI/180,uy=180/Math.PI;function au(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(cl[t&255]+cl[t>>8&255]+cl[t>>16&255]+cl[t>>24&255]+"-"+cl[e&255]+cl[e>>8&255]+"-"+cl[e>>16&15|64]+cl[e>>24&255]+"-"+cl[n&63|128]+cl[n>>8&255]+"-"+cl[n>>16&255]+cl[n>>24&255]+cl[r&255]+cl[r>>8&255]+cl[r>>16&255]+cl[r>>24&255]).toLowerCase()}function lr(t,e,n){return Math.max(e,Math.min(n,t))}function l9(t,e){return(t%e+e)%e}function BSe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function HSe(t,e,n){return t!==e?(n-t)/(e-t):0}function X_(t,e,n){return(1-n)*t+n*e}function VSe(t,e,n,r){return X_(t,e,1-Math.exp(-n*r))}function GSe(t,e=1){return e-Math.abs(l9(t,e*2)-e)}function WSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function $Se(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function qSe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function XSe(t,e){return t+Math.random()*(e-t)}function YSe(t){return t*(.5-Math.random())}function KSe(t){t!==void 0&&(aj=t);let e=aj+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function ZSe(t){return t*tx}function QSe(t){return t*uy}function JSe(t){return(t&t-1)===0&&t!==0}function ewe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function twe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function nwe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),p=s((e-r)/2),m=o((e-r)/2),x=s((r-e)/2),b=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*p,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*p,a*c);break;case"ZXZ":t.set(l*p,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*b,l*x,a*c);break;case"YXY":t.set(l*x,a*d,l*b,a*c);break;case"ZYZ":t.set(l*b,l*x,a*d,a*c);break;default:gn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Hl(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 Rr(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.")}}const TY={DEG2RAD:tx,RAD2DEG:uy,generateUUID:au,clamp:lr,euclideanModulo:l9,mapLinear:BSe,inverseLerp:HSe,lerp:X_,damp:VSe,pingpong:GSe,smoothstep:WSe,smootherstep:$Se,randInt:qSe,randFloat:XSe,randFloatSpread:YSe,seededRandom:KSe,degToRad:ZSe,radToDeg:QSe,isPowerOfTwo:JSe,ceilPowerOfTwo:ewe,floorPowerOfTwo:twe,setQuaternionFromProperEuler:nwe,normalize:Rr,denormalize:Hl};class Ht{constructor(e=0,n=0){Ht.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,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=lr(this.x,e.x,n.x),this.y=lr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=lr(this.x,e,n),this.y=lr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(lr(r,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 r=this.dot(e)/n;return Math.acos(lr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,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 r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class $a{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,o,a){let l=r[i+0],c=r[i+1],d=r[i+2],p=r[i+3],m=s[o+0],x=s[o+1],b=s[o+2],_=s[o+3];if(p!==_||l!==m||c!==x||d!==b){let S=l*m+c*x+d*b+p*_;S<0&&(m=-m,x=-x,b=-b,_=-_,S=-S);let w=1-a;if(S<.9995){const C=Math.acos(S),A=Math.sin(C);w=Math.sin(w*C)/A,a=Math.sin(a*C)/A,l=l*w+m*a,c=c*w+x*a,d=d*w+b*a,p=p*w+_*a}else{l=l*w+m*a,c=c*w+x*a,d=d*w+b*a,p=p*w+_*a;const C=1/Math.sqrt(l*l+c*c+d*d+p*p);l*=C,c*=C,d*=C,p*=C}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=p}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],p=s[o],m=s[o+1],x=s[o+2],b=s[o+3];return e[n]=a*b+d*p+l*x-c*m,e[n+1]=l*b+d*m+c*p-a*x,e[n+2]=c*b+d*x+a*m-l*p,e[n+3]=d*b-a*p-l*m-c*x,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,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),p=a(s/2),m=l(r/2),x=l(i/2),b=l(s/2);switch(o){case"XYZ":this._x=m*d*p+c*x*b,this._y=c*x*p-m*d*b,this._z=c*d*b+m*x*p,this._w=c*d*p-m*x*b;break;case"YXZ":this._x=m*d*p+c*x*b,this._y=c*x*p-m*d*b,this._z=c*d*b-m*x*p,this._w=c*d*p+m*x*b;break;case"ZXY":this._x=m*d*p-c*x*b,this._y=c*x*p+m*d*b,this._z=c*d*b+m*x*p,this._w=c*d*p-m*x*b;break;case"ZYX":this._x=m*d*p-c*x*b,this._y=c*x*p+m*d*b,this._z=c*d*b-m*x*p,this._w=c*d*p+m*x*b;break;case"YZX":this._x=m*d*p+c*x*b,this._y=c*x*p+m*d*b,this._z=c*d*b-m*x*p,this._w=c*d*p-m*x*b;break;case"XZY":this._x=m*d*p-c*x*b,this._y=c*x*p-m*d*b,this._z=c*d*b+m*x*p,this._w=c*d*p+m*x*b;break;default:gn("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],p=n[10],m=r+a+p;if(m>0){const x=.5/Math.sqrt(m+1);this._w=.25/x,this._x=(d-l)*x,this._y=(s-c)*x,this._z=(o-i)*x}else if(r>a&&r>p){const x=2*Math.sqrt(1+r-a-p);this._w=(d-l)/x,this._x=.25*x,this._y=(i+o)/x,this._z=(s+c)/x}else if(a>p){const x=2*Math.sqrt(1+a-r-p);this._w=(s-c)/x,this._x=(i+o)/x,this._y=.25*x,this._z=(l+d)/x}else{const x=2*Math.sqrt(1+p-r-a);this._w=(o-i)/x,this._x=(s+c)/x,this._y=(l+d)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(lr(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(r=-r,i=-i,s=-s,o=-o,a=-a);let l=1-n;if(a<.9995){const c=Math.acos(a),d=Math.sin(c);l=Math.sin(l*c)/d,n=Math.sin(n*c)/d,this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+o*n,this._onChangeCallback()}else this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+o*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*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 He{constructor(e=0,n=0,r=0){He.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,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(lj.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(lj.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),p=2*(s*r-o*n);return this.x=n+l*c+o*p-a*d,this.y=r+l*d+a*c-s*p,this.z=i+l*p+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=lr(this.x,e.x,n.x),this.y=lr(this.y,e.y,n.y),this.z=lr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=lr(this.x,e,n),this.y=lr(this.y,e,n),this.z=lr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(lr(r,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return JA.copy(this).projectOnVector(e),this.sub(JA)}reflect(e){return this.sub(JA.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 r=this.dot(e)/n;return Math.acos(lr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,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,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const JA=new He,lj=new $a;class Sr{constructor(e,n,r,i,s,o,a,l,c){Sr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.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 r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],p=r[7],m=r[2],x=r[5],b=r[8],_=i[0],S=i[3],w=i[6],C=i[1],A=i[4],N=i[7],D=i[2],P=i[5],O=i[8];return s[0]=o*_+a*C+l*D,s[3]=o*S+a*A+l*P,s[6]=o*w+a*N+l*O,s[1]=c*_+d*C+p*D,s[4]=c*S+d*A+p*P,s[7]=c*w+d*N+p*O,s[2]=m*_+x*C+b*D,s[5]=m*S+x*A+b*P,s[8]=m*w+x*N+b*O,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],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],p=d*o-a*c,m=a*l-d*s,x=c*s-o*l,b=n*p+r*m+i*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/b;return e[0]=p*_,e[1]=(i*c-d*r)*_,e[2]=(a*r-i*o)*_,e[3]=m*_,e[4]=(d*n-i*l)*_,e[5]=(i*s-a*n)*_,e[6]=x*_,e[7]=(r*l-c*n)*_,e[8]=(o*n-r*s)*_,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,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(e6.makeScale(e,n)),this}rotate(e){return this.premultiply(e6.makeRotation(-e)),this}translate(e,n){return this.premultiply(e6.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),r=Math.sin(e);return this.set(n,-r,0,r,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,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const e6=new Sr,cj=new Sr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),uj=new Sr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function rwe(){const t={enabled:!0,workingColorSpace:am,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===zi&&(i.r=pp(i.r),i.g=pp(i.g),i.b=pp(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===zi&&(i.r=N1(i.r),i.g=N1(i.g),i.b=N1(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===op?TS:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return NS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return NS("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[am]:{primaries:e,whitePoint:r,transfer:TS,toXYZ:cj,fromXYZ:uj,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:pl},outputColorSpaceConfig:{drawingBufferColorSpace:pl}},[pl]:{primaries:e,whitePoint:r,transfer:zi,toXYZ:cj,fromXYZ:uj,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:pl}}}),t}const ai=rwe();function pp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function N1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ov;class CY{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Ov===void 0&&(Ov=ES("canvas")),Ov.width=e.width,Ov.height=e.height;const i=Ov.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Ov}return r.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=ES("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=pp(s[o]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(pp(n[r]/255)*255):n[r]=pp(n[r]);return{data:n,width:e.width,height:e.height}}else return gn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let iwe=0;class $0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iwe++}),this.uuid=au(),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 r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(t6(i[o].image)):s.push(t6(i[o]))}else s=t6(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function t6(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?CY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(gn("Texture: Unable to serialize Texture."),{})}let swe=0;const n6=new He;class ro extends yh{constructor(e=ro.DEFAULT_IMAGE,n=ro.DEFAULT_MAPPING,r=Ec,i=Ec,s=rs,o=Jf,a=ml,l=Bl,c=ro.DEFAULT_ANISOTROPY,d=op){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:swe++}),this.uuid=au(),this.name="",this.source=new $0(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ht(0,0),this.repeat=new Ht(1,1),this.center=new Ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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(n6).x}get height(){return this.source.getSize(n6).y}get depth(){return this.source.getSize(n6).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 r=e[n];if(r===void 0){gn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){gn(`Texture.setValues(): property '${n}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={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&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==aC)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case _S:e.x=e.x-Math.floor(e.x);break;case Ec:e.x=e.x<0?0:1;break;case SS: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 _S:e.y=e.y-Math.floor(e.y);break;case Ec:e.y=e.y<0?0:1;break;case SS: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++}}ro.DEFAULT_IMAGE=null;ro.DEFAULT_MAPPING=aC;ro.DEFAULT_ANISOTROPY=1;class fi{constructor(e=0,n=0,r=0,i=1){fi.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,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,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+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,r,i,s;const l=e.elements,c=l[0],d=l[4],p=l[8],m=l[1],x=l[5],b=l[9],_=l[2],S=l[6],w=l[10];if(Math.abs(d-m)<.01&&Math.abs(p-_)<.01&&Math.abs(b-S)<.01){if(Math.abs(d+m)<.1&&Math.abs(p+_)<.1&&Math.abs(b+S)<.1&&Math.abs(c+x+w-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(c+1)/2,N=(x+1)/2,D=(w+1)/2,P=(d+m)/4,O=(p+_)/4,R=(b+S)/4;return A>N&&A>D?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=P/r,s=O/r):N>D?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=P/i,s=R/i):D<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(D),r=O/s,i=R/s),this.set(r,i,s,n),this}let C=Math.sqrt((S-b)*(S-b)+(p-_)*(p-_)+(m-d)*(m-d));return Math.abs(C)<.001&&(C=1),this.x=(S-b)/C,this.y=(p-_)/C,this.z=(m-d)/C,this.w=Math.acos((c+x+w-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=lr(this.x,e.x,n.x),this.y=lr(this.y,e.y,n.y),this.z=lr(this.z,e.z,n.z),this.w=lr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=lr(this.x,e,n),this.y=lr(this.y,e,n),this.z=lr(this.z,e,n),this.w=lr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(lr(r,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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 c9 extends yh{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new fi(0,0,e,n),this.scissorTest=!1,this.viewport=new fi(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new ro(i),o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:rs,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 r=0;r<this.textures.length;r++)this.textures[r].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,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].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,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new $0(i)}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 lu extends c9{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class xC extends ro{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Co,this.minFilter=Co,this.wrapR=Ec,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class owe extends lu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new xC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class vC extends ro{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Co,this.minFilter=Co,this.wrapR=Ec,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class awe extends lu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new vC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class sr{constructor(e,n,r,i,s,o,a,l,c,d,p,m,x,b,_,S){sr.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,r,i,s,o,a,l,c,d,p,m,x,b,_,S)}set(e,n,r,i,s,o,a,l,c,d,p,m,x,b,_,S){const w=this.elements;return w[0]=e,w[4]=n,w[8]=r,w[12]=i,w[1]=s,w[5]=o,w[9]=a,w[13]=l,w[2]=c,w[6]=d,w[10]=p,w[14]=m,w[3]=x,w[7]=b,w[11]=_,w[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new sr().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[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,r){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),r.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this)}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,r=e.elements,i=1/Lv.setFromMatrixColumn(e,0).length(),s=1/Lv.setFromMatrixColumn(e,1).length(),o=1/Lv.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const m=o*d,x=o*p,b=a*d,_=a*p;n[0]=l*d,n[4]=-l*p,n[8]=c,n[1]=x+b*c,n[5]=m-_*c,n[9]=-a*l,n[2]=_-m*c,n[6]=b+x*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,x=l*p,b=c*d,_=c*p;n[0]=m+_*a,n[4]=b*a-x,n[8]=o*c,n[1]=o*p,n[5]=o*d,n[9]=-a,n[2]=x*a-b,n[6]=_+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,x=l*p,b=c*d,_=c*p;n[0]=m-_*a,n[4]=-o*p,n[8]=b+x*a,n[1]=x+b*a,n[5]=o*d,n[9]=_-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,x=o*p,b=a*d,_=a*p;n[0]=l*d,n[4]=b*c-x,n[8]=m*c+_,n[1]=l*p,n[5]=_*c+m,n[9]=x*c-b,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,x=o*c,b=a*l,_=a*c;n[0]=l*d,n[4]=_-m*p,n[8]=b*p+x,n[1]=p,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=x*p+b,n[10]=m-_*p}else if(e.order==="XZY"){const m=o*l,x=o*c,b=a*l,_=a*c;n[0]=l*d,n[4]=-p,n[8]=c*d,n[1]=m*p+_,n[5]=o*d,n[9]=x*p-b,n[2]=b*p-x,n[6]=a*d,n[10]=_*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(lwe,e,cwe)}lookAt(e,n,r){const i=this.elements;return Gc.subVectors(e,n),Gc.lengthSq()===0&&(Gc.z=1),Gc.normalize(),b0.crossVectors(r,Gc),b0.lengthSq()===0&&(Math.abs(r.z)===1?Gc.x+=1e-4:Gc.z+=1e-4,Gc.normalize(),b0.crossVectors(r,Gc)),b0.normalize(),R4.crossVectors(Gc,b0),i[0]=b0.x,i[4]=R4.x,i[8]=Gc.x,i[1]=b0.y,i[5]=R4.y,i[9]=Gc.y,i[2]=b0.z,i[6]=R4.z,i[10]=Gc.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],p=r[5],m=r[9],x=r[13],b=r[2],_=r[6],S=r[10],w=r[14],C=r[3],A=r[7],N=r[11],D=r[15],P=i[0],O=i[4],R=i[8],L=i[12],V=i[1],F=i[5],U=i[9],W=i[13],Y=i[2],$=i[6],X=i[10],Z=i[14],K=i[3],ne=i[7],H=i[11],B=i[15];return s[0]=o*P+a*V+l*Y+c*K,s[4]=o*O+a*F+l*$+c*ne,s[8]=o*R+a*U+l*X+c*H,s[12]=o*L+a*W+l*Z+c*B,s[1]=d*P+p*V+m*Y+x*K,s[5]=d*O+p*F+m*$+x*ne,s[9]=d*R+p*U+m*X+x*H,s[13]=d*L+p*W+m*Z+x*B,s[2]=b*P+_*V+S*Y+w*K,s[6]=b*O+_*F+S*$+w*ne,s[10]=b*R+_*U+S*X+w*H,s[14]=b*L+_*W+S*Z+w*B,s[3]=C*P+A*V+N*Y+D*K,s[7]=C*O+A*F+N*$+D*ne,s[11]=C*R+A*U+N*X+D*H,s[15]=C*L+A*W+N*Z+D*B,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],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],p=e[6],m=e[10],x=e[14],b=e[3],_=e[7],S=e[11],w=e[15],C=l*x-c*m,A=a*x-c*p,N=a*m-l*p,D=o*x-c*d,P=o*m-l*d,O=o*p-a*d;return n*(_*C-S*A+w*N)-r*(b*C-S*D+w*P)+i*(b*A-_*D+w*O)-s*(b*N-_*P+S*O)}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,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],p=e[9],m=e[10],x=e[11],b=e[12],_=e[13],S=e[14],w=e[15],C=n*a-r*o,A=n*l-i*o,N=n*c-s*o,D=r*l-i*a,P=r*c-s*a,O=i*c-s*l,R=d*_-p*b,L=d*S-m*b,V=d*w-x*b,F=p*S-m*_,U=p*w-x*_,W=m*w-x*S,Y=C*W-A*U+N*F+D*V-P*L+O*R;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const $=1/Y;return e[0]=(a*W-l*U+c*F)*$,e[1]=(i*U-r*W-s*F)*$,e[2]=(_*O-S*P+w*D)*$,e[3]=(m*P-p*O-x*D)*$,e[4]=(l*V-o*W-c*L)*$,e[5]=(n*W-i*V+s*L)*$,e[6]=(S*N-b*O-w*A)*$,e[7]=(d*O-m*N+x*A)*$,e[8]=(o*U-a*V+c*R)*$,e[9]=(r*V-n*U-s*R)*$,e[10]=(b*P-_*N+w*C)*$,e[11]=(p*N-d*P-x*C)*$,e[12]=(a*L-o*F-l*R)*$,e[13]=(n*F-r*L+i*R)*$,e[14]=(_*A-b*D-S*C)*$,e[15]=(d*D-p*A+m*C)*$,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,p=a+a,m=s*c,x=s*d,b=s*p,_=o*d,S=o*p,w=a*p,C=l*c,A=l*d,N=l*p,D=r.x,P=r.y,O=r.z;return i[0]=(1-(_+w))*D,i[1]=(x+N)*D,i[2]=(b-A)*D,i[3]=0,i[4]=(x-N)*P,i[5]=(1-(m+w))*P,i[6]=(S+C)*P,i[7]=0,i[8]=(b+A)*O,i[9]=(S-C)*O,i[10]=(1-(m+_))*O,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return r.set(1,1,1),n.identity(),this;let o=Lv.set(i[0],i[1],i[2]).length();const a=Lv.set(i[4],i[5],i[6]).length(),l=Lv.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Od.copy(this);const c=1/o,d=1/a,p=1/l;return Od.elements[0]*=c,Od.elements[1]*=c,Od.elements[2]*=c,Od.elements[4]*=d,Od.elements[5]*=d,Od.elements[6]*=d,Od.elements[8]*=p,Od.elements[9]*=p,Od.elements[10]*=p,n.setFromRotationMatrix(Od),r.x=o,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,o,a=tu,l=!1){const c=this.elements,d=2*s/(n-e),p=2*s/(r-i),m=(n+e)/(n-e),x=(r+i)/(r-i);let b,_;if(l)b=s/(o-s),_=o*s/(o-s);else if(a===tu)b=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===gx)b=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=d,c[4]=0,c[8]=m,c[12]=0,c[1]=0,c[5]=p,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=b,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=tu,l=!1){const c=this.elements,d=2/(n-e),p=2/(r-i),m=-(n+e)/(n-e),x=-(r+i)/(r-i);let b,_;if(l)b=1/(o-s),_=o/(o-s);else if(a===tu)b=-2/(o-s),_=-(o+s)/(o-s);else if(a===gx)b=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=d,c[4]=0,c[8]=0,c[12]=m,c[1]=0,c[5]=p,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=b,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Lv=new He,Od=new sr,lwe=new He(0,0,0),cwe=new He(1,1,1),b0=new He,R4=new He,Gc=new He,dj=new sr,fj=new $a;class cu{constructor(e=0,n=0,r=0,i=cu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],p=i[2],m=i[6],x=i[10];switch(n){case"XYZ":this._y=Math.asin(lr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-lr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(lr(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-lr(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(lr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-lr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,x),this._y=0);break;default:gn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return dj.makeRotationFromQuaternion(e),this.setFromRotationMatrix(dj,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return fj.setFromEuler(this),this.setFromQuaternion(fj,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}}cu.DEFAULT_ORDER="XYZ";class dy{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 uwe=0;const hj=new He,jv=new $a,Xh=new sr,k4=new He,r_=new He,dwe=new He,fwe=new $a,pj=new He(1,0,0),mj=new He(0,1,0),gj=new He(0,0,1),xj={type:"added"},hwe={type:"removed"},zv={type:"childadded",child:null},r6={type:"childremoved",child:null};class _i extends yh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:uwe++}),this.uuid=au(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_i.DEFAULT_UP.clone();const e=new He,n=new cu,r=new $a,i=new He(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._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:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new sr},normalMatrix:{value:new Sr}}),this.matrix=new sr,this.matrixWorld=new sr,this.matrixAutoUpdate=_i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dy,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 jv.setFromAxisAngle(e,n),this.quaternion.multiply(jv),this}rotateOnWorldAxis(e,n){return jv.setFromAxisAngle(e,n),this.quaternion.premultiply(jv),this}rotateX(e){return this.rotateOnAxis(pj,e)}rotateY(e){return this.rotateOnAxis(mj,e)}rotateZ(e){return this.rotateOnAxis(gj,e)}translateOnAxis(e,n){return hj.copy(e).applyQuaternion(this.quaternion),this.position.add(hj.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(pj,e)}translateY(e){return this.translateOnAxis(mj,e)}translateZ(e){return this.translateOnAxis(gj,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Xh.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?k4.copy(e):k4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),r_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xh.lookAt(r_,k4,this.up):Xh.lookAt(k4,r_,this.up),this.quaternion.setFromRotationMatrix(Xh),i&&(Xh.extractRotation(i.matrixWorld),jv.setFromRotationMatrix(Xh),this.quaternion.premultiply(jv.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Un("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(xj),zv.child=e,this.dispatchEvent(zv),zv.child=null):Un("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(hwe),r6.child=e,this.dispatchEvent(r6),r6.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),Xh.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Xh.multiply(e.parent.matrixWorld)),e.applyMatrix4(Xh),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xj),zv.child=e,this.dispatchEvent(zv),zv.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 r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r_,e,dwe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r_,fwe,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 r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].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,r=e.y,i=e.z,s=this.matrix.elements;s[12]+=n-s[0]*n-s[4]*r-s[8]*i,s[13]+=r-s[1]*n-s[5]*r-s[9]*i,s[14]+=i-s[2]*n-s[6]*r-s[10]*i}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 r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.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 i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const p=l[c];s(e.shapes,p)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(n){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),d=o(e.images),p=o(e.shapes),m=o(e.skeletons),x=o(e.animations),b=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),p.length>0&&(r.shapes=p),m.length>0&&(r.skeletons=m),x.length>0&&(r.animations=x),b.length>0&&(r.nodes=b)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}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 r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}_i.DEFAULT_UP=new He(0,1,0);_i.DEFAULT_MATRIX_AUTO_UPDATE=!0;_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class h1 extends _i{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pwe={type:"move"};class $M{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new h1,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 h1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new He,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new He),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new h1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new He,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new He),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 r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const S=n.getJointPose(_,r),w=this._getHandJoint(c,_);S!==null&&(w.matrix.fromArray(S.transform.matrix),w.matrix.decompose(w.position,w.rotation,w.scale),w.matrixWorldNeedsUpdate=!0,w.jointRadius=S.radius),w.visible=S!==null}const d=c.joints["index-finger-tip"],p=c.joints["thumb-tip"],m=d.position.distanceTo(p.position),x=.02,b=.005;c.inputState.pinching&&m>x+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=x-b&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(pwe)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new h1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const EY={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},_0={h:0,s:0,l:0},D4={h:0,s:0,l:0};function i6(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 Sn{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=pl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ai.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=ai.workingColorSpace){return this.r=e,this.g=n,this.b=r,ai.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=ai.workingColorSpace){if(e=l9(e,1),n=lr(n,0,1),r=lr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=i6(o,s,e+1/3),this.g=i6(o,s,e),this.b=i6(o,s,e-1/3)}return ai.colorSpaceToWorking(this,i),this}setStyle(e,n=pl){function r(s){s!==void 0&&parseFloat(s)<1&&gn("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,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(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:gn("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);gn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=pl){const r=EY[e.toLowerCase()];return r!==void 0?this.setHex(r,n):gn("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=pp(e.r),this.g=pp(e.g),this.b=pp(e.b),this}copyLinearToSRGB(e){return this.r=N1(e.r),this.g=N1(e.g),this.b=N1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=pl){return ai.workingToColorSpace(ul.copy(this),e),Math.round(lr(ul.r*255,0,255))*65536+Math.round(lr(ul.g*255,0,255))*256+Math.round(lr(ul.b*255,0,255))}getHexString(e=pl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ai.workingColorSpace){ai.workingToColorSpace(ul.copy(this),n);const r=ul.r,i=ul.g,s=ul.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const p=o-a;switch(c=d<=.5?p/(o+a):p/(2-o-a),o){case r:l=(i-s)/p+(i<s?6:0);break;case i:l=(s-r)/p+2;break;case s:l=(r-i)/p+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=ai.workingColorSpace){return ai.workingToColorSpace(ul.copy(this),n),e.r=ul.r,e.g=ul.g,e.b=ul.b,e}getStyle(e=pl){ai.workingToColorSpace(ul.copy(this),e);const n=ul.r,r=ul.g,i=ul.b;return e!==pl?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(_0),this.setHSL(_0.h+e,_0.s+n,_0.l+r)}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,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(_0),e.getHSL(D4);const r=X_(_0.h,D4.h,n),i=X_(_0.s,D4.s,n),s=X_(_0.l,D4.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,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 ul=new Sn;Sn.NAMES=EY;class yC{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new Sn(e),this.density=n}clone(){return new yC(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class bC{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new Sn(e),this.near=n,this.far=r}clone(){return new bC(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let u9=class extends _i{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 cu,this.environmentIntensity=1,this.environmentRotation=new cu,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 Ld=new He,Yh=new He,s6=new He,Kh=new He,Fv=new He,Uv=new He,vj=new He,o6=new He,a6=new He,l6=new He,c6=new fi,u6=new fi,d6=new fi;class Cc{constructor(e=new He,n=new He,r=new He){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ld.subVectors(e,n),i.cross(Ld);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Ld.subVectors(i,n),Yh.subVectors(r,n),s6.subVectors(e,n);const o=Ld.dot(Ld),a=Ld.dot(Yh),l=Ld.dot(s6),c=Yh.dot(Yh),d=Yh.dot(s6),p=o*c-a*a;if(p===0)return s.set(0,0,0),null;const m=1/p,x=(c*l-a*d)*m,b=(o*d-a*l)*m;return s.set(1-x-b,b,x)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Kh)===null?!1:Kh.x>=0&&Kh.y>=0&&Kh.x+Kh.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Kh)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Kh.x),l.addScaledVector(o,Kh.y),l.addScaledVector(a,Kh.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return c6.setScalar(0),u6.setScalar(0),d6.setScalar(0),c6.fromBufferAttribute(e,n),u6.fromBufferAttribute(e,r),d6.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(c6,s.x),o.addScaledVector(u6,s.y),o.addScaledVector(d6,s.z),o}static isFrontFacing(e,n,r,i){return Ld.subVectors(r,n),Yh.subVectors(e,n),Ld.cross(Yh).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ld.subVectors(this.c,this.b),Yh.subVectors(this.a,this.b),Ld.cross(Yh).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Cc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Cc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Cc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Cc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Cc.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;Fv.subVectors(i,r),Uv.subVectors(s,r),o6.subVectors(e,r);const l=Fv.dot(o6),c=Uv.dot(o6);if(l<=0&&c<=0)return n.copy(r);a6.subVectors(e,i);const d=Fv.dot(a6),p=Uv.dot(a6);if(d>=0&&p<=d)return n.copy(i);const m=l*p-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(Fv,o);l6.subVectors(e,s);const x=Fv.dot(l6),b=Uv.dot(l6);if(b>=0&&x<=b)return n.copy(s);const _=x*c-l*b;if(_<=0&&c>=0&&b<=0)return a=c/(c-b),n.copy(r).addScaledVector(Uv,a);const S=d*b-x*p;if(S<=0&&p-d>=0&&x-b>=0)return vj.subVectors(s,i),a=(p-d)/(p-d+(x-b)),n.copy(i).addScaledVector(vj,a);const w=1/(S+_+m);return o=_*w,a=m*w,n.copy(r).addScaledVector(Fv,o).addScaledVector(Uv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Eo{constructor(e=new He(1/0,1/0,1/0),n=new He(-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,r=e.length;n<r;n+=3)this.expandByPoint(jd.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(jd.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=jd.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,jd):jd.fromBufferAttribute(s,o),jd.applyMatrix4(e.matrixWorld),this.expandByPoint(jd);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),P4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),P4.copy(r.boundingBox)),P4.applyMatrix4(e.matrixWorld),this.union(P4)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[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,jd),jd.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(i_),I4.subVectors(this.max,i_),Bv.subVectors(e.a,i_),Hv.subVectors(e.b,i_),Vv.subVectors(e.c,i_),S0.subVectors(Hv,Bv),w0.subVectors(Vv,Hv),hg.subVectors(Bv,Vv);let n=[0,-S0.z,S0.y,0,-w0.z,w0.y,0,-hg.z,hg.y,S0.z,0,-S0.x,w0.z,0,-w0.x,hg.z,0,-hg.x,-S0.y,S0.x,0,-w0.y,w0.x,0,-hg.y,hg.x,0];return!f6(n,Bv,Hv,Vv,I4)||(n=[1,0,0,0,1,0,0,0,1],!f6(n,Bv,Hv,Vv,I4))?!1:(O4.crossVectors(S0,w0),n=[O4.x,O4.y,O4.z],f6(n,Bv,Hv,Vv,I4))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,jd).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(jd).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:(Zh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zh),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 Zh=[new He,new He,new He,new He,new He,new He,new He,new He],jd=new He,P4=new Eo,Bv=new He,Hv=new He,Vv=new He,S0=new He,w0=new He,hg=new He,i_=new He,I4=new He,O4=new He,pg=new He;function f6(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){pg.fromArray(t,s);const a=i.x*Math.abs(pg.x)+i.y*Math.abs(pg.y)+i.z*Math.abs(pg.z),l=e.dot(pg),c=n.dot(pg),d=r.dot(pg);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const ap=mwe();function mwe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function _c(t){Math.abs(t)>65504&&gn("DataUtils.toHalfFloat(): Value out of range."),t=lr(t,-65504,65504),ap.floatView[0]=t;const e=ap.uint32View[0],n=e>>23&511;return ap.baseTable[n]+((e&8388607)>>ap.shiftTable[n])}function T_(t){const e=t>>10;return ap.uint32View[0]=ap.mantissaTable[ap.offsetTable[e]+(t&1023)]+ap.exponentTable[e],ap.floatView[0]}class gwe{static toHalfFloat(e){return _c(e)}static fromHalfFloat(e){return T_(e)}}const Uo=new He,L4=new Ht;let xwe=0;class Wi{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xwe++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=CS,this.updateRanges=[],this.gpuType=Wl,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,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)L4.fromBufferAttribute(this,n),L4.applyMatrix3(e),this.setXY(n,L4.x,L4.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyMatrix3(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyMatrix4(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyNormalMatrix(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.transformDirection(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Hl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Rr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Hl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Hl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Rr(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=Hl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Rr(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=Hl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array),s=Rr(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,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!==CS&&(e.usage=this.usage),e}}class vwe extends Wi{constructor(e,n,r){super(new Int8Array(e),n,r)}}class ywe extends Wi{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class bwe extends Wi{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class _we extends Wi{constructor(e,n,r){super(new Int16Array(e),n,r)}}class d9 extends Wi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class Swe extends Wi{constructor(e,n,r){super(new Int32Array(e),n,r)}}class f9 extends Wi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class wwe extends Wi{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=T_(this.array[e*this.itemSize]);return this.normalized&&(n=Hl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize]=_c(n),this}getY(e){let n=T_(this.array[e*this.itemSize+1]);return this.normalized&&(n=Hl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize+1]=_c(n),this}getZ(e){let n=T_(this.array[e*this.itemSize+2]);return this.normalized&&(n=Hl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize+2]=_c(n),this}getW(e){let n=T_(this.array[e*this.itemSize+3]);return this.normalized&&(n=Hl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Rr(n,this.array)),this.array[e*this.itemSize+3]=_c(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array)),this.array[e+0]=_c(n),this.array[e+1]=_c(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array)),this.array[e+0]=_c(n),this.array[e+1]=_c(r),this.array[e+2]=_c(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array),s=Rr(s,this.array)),this.array[e+0]=_c(n),this.array[e+1]=_c(r),this.array[e+2]=_c(i),this.array[e+3]=_c(s),this}}class Rn extends Wi{constructor(e,n,r){super(new Float32Array(e),n,r)}}const Mwe=new Eo,s_=new He,h6=new He;class Wo{constructor(e=new He,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 r=this.center;n!==void 0?r.copy(n):Mwe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),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 r=this.center.distanceToSquared(e);return n.copy(e),r>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;s_.subVectors(e,this.center);const n=s_.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(s_,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(h6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(s_.copy(e.center).add(h6)),this.expandByPoint(s_.copy(e.center).sub(h6))),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 Twe=0;const Fu=new sr,p6=new _i,Gv=new He,Wc=new Eo,o_=new Eo,Sa=new He;class wr extends yh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Twe++}),this.uuid=au(),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(OSe(e)?f9:d9)(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,r=0){this.groups.push({start:e,count:n,materialIndex:r})}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 r=this.attributes.normal;if(r!==void 0){const s=new Sr().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Fu.makeRotationFromQuaternion(e),this.applyMatrix4(Fu),this}rotateX(e){return Fu.makeRotationX(e),this.applyMatrix4(Fu),this}rotateY(e){return Fu.makeRotationY(e),this.applyMatrix4(Fu),this}rotateZ(e){return Fu.makeRotationZ(e),this.applyMatrix4(Fu),this}translate(e,n,r){return Fu.makeTranslation(e,n,r),this.applyMatrix4(Fu),this}scale(e,n,r){return Fu.makeScale(e,n,r),this.applyMatrix4(Fu),this}lookAt(e){return p6.lookAt(e),p6.updateMatrix(),this.applyMatrix4(p6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gv).negate(),this.translate(Gv.x,Gv.y,Gv.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Rn(r,3))}else{const r=Math.min(e.length,n.count);for(let i=0;i<r;i++){const s=e[i];n.setXYZ(i,s.x,s.y,s.z||0)}e.length>n.count&&gn("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 Eo);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Un("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new He(-1/0,-1/0,-1/0),new He(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];Wc.setFromBufferAttribute(s),this.morphTargetsRelative?(Sa.addVectors(this.boundingBox.min,Wc.min),this.boundingBox.expandByPoint(Sa),Sa.addVectors(this.boundingBox.max,Wc.max),this.boundingBox.expandByPoint(Sa)):(this.boundingBox.expandByPoint(Wc.min),this.boundingBox.expandByPoint(Wc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Un('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 Wo);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Un("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new He,1/0);return}if(e){const r=this.boundingSphere.center;if(Wc.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];o_.setFromBufferAttribute(a),this.morphTargetsRelative?(Sa.addVectors(Wc.min,o_.min),Wc.expandByPoint(Sa),Sa.addVectors(Wc.max,o_.max),Wc.expandByPoint(Sa)):(Wc.expandByPoint(o_.min),Wc.expandByPoint(o_.max))}Wc.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)Sa.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(Sa));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,d=a.count;c<d;c++)Sa.fromBufferAttribute(a,c),l&&(Gv.fromBufferAttribute(e,c),Sa.add(Gv)),i=Math.max(i,r.distanceToSquared(Sa))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Un('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){Un("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Wi(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<r.count;R++)a[R]=new He,l[R]=new He;const c=new He,d=new He,p=new He,m=new Ht,x=new Ht,b=new Ht,_=new He,S=new He;function w(R,L,V){c.fromBufferAttribute(r,R),d.fromBufferAttribute(r,L),p.fromBufferAttribute(r,V),m.fromBufferAttribute(s,R),x.fromBufferAttribute(s,L),b.fromBufferAttribute(s,V),d.sub(c),p.sub(c),x.sub(m),b.sub(m);const F=1/(x.x*b.y-b.x*x.y);isFinite(F)&&(_.copy(d).multiplyScalar(b.y).addScaledVector(p,-x.y).multiplyScalar(F),S.copy(p).multiplyScalar(x.x).addScaledVector(d,-b.x).multiplyScalar(F),a[R].add(_),a[L].add(_),a[V].add(_),l[R].add(S),l[L].add(S),l[V].add(S))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let R=0,L=C.length;R<L;++R){const V=C[R],F=V.start,U=V.count;for(let W=F,Y=F+U;W<Y;W+=3)w(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const A=new He,N=new He,D=new He,P=new He;function O(R){D.fromBufferAttribute(i,R),P.copy(D);const L=a[R];A.copy(L),A.sub(D.multiplyScalar(D.dot(L))).normalize(),N.crossVectors(P,L);const F=N.dot(l[R])<0?-1:1;o.setXYZW(R,A.x,A.y,A.z,F)}for(let R=0,L=C.length;R<L;++R){const V=C[R],F=V.start,U=V.count;for(let W=F,Y=F+U;W<Y;W+=3)O(e.getX(W+0)),O(e.getX(W+1)),O(e.getX(W+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Wi(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let m=0,x=r.count;m<x;m++)r.setXYZ(m,0,0,0);const i=new He,s=new He,o=new He,a=new He,l=new He,c=new He,d=new He,p=new He;if(e)for(let m=0,x=e.count;m<x;m+=3){const b=e.getX(m+0),_=e.getX(m+1),S=e.getX(m+2);i.fromBufferAttribute(n,b),s.fromBufferAttribute(n,_),o.fromBufferAttribute(n,S),d.subVectors(o,s),p.subVectors(i,s),d.cross(p),a.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,S),a.add(d),l.add(d),c.add(d),r.setXYZ(b,a.x,a.y,a.z),r.setXYZ(_,l.x,l.y,l.z),r.setXYZ(S,c.x,c.y,c.z)}else for(let m=0,x=n.count;m<x;m+=3)i.fromBufferAttribute(n,m+0),s.fromBufferAttribute(n,m+1),o.fromBufferAttribute(n,m+2),d.subVectors(o,s),p.subVectors(i,s),d.cross(p),r.setXYZ(m+0,d.x,d.y,d.z),r.setXYZ(m+1,d.x,d.y,d.z),r.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Sa.fromBufferAttribute(e,n),Sa.normalize(),e.setXYZ(n,Sa.x,Sa.y,Sa.z)}toNonIndexed(){function e(a,l){const c=a.array,d=a.itemSize,p=a.normalized,m=new c.constructor(l.length*d);let x=0,b=0;for(let _=0,S=l.length;_<S;_++){a.isInterleavedBufferAttribute?x=l[_]*a.data.stride+a.offset:x=l[_]*d;for(let w=0;w<d;w++)m[b++]=c[x++]}return new Wi(m,d,p)}if(this.index===null)return gn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new wr,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);n.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let d=0,p=c.length;d<p;d++){const m=c[d],x=e(m,r);l.push(x)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];n.addGroup(c.start,c.count,c.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 l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let p=0,m=c.length;p<m;p++){const x=c[p];d.push(x.toJSON(e.data))}d.length>0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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 r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],p=s[c];for(let m=0,x=p.length;m<x;m++)d.push(p[m].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,d=o.length;c<d;c++){const p=o[c];this.addGroup(p.start,p.count,p.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class _C{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=CS,this.updateRanges=[],this.version=0,this.uuid=au()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=n.array[r+i];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=au()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=au()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ol=new He;class nu{constructor(e,n,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,r=this.data.count;n<r;n++)Ol.fromBufferAttribute(this,n),Ol.applyMatrix4(e),this.setXYZ(n,Ol.x,Ol.y,Ol.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Ol.fromBufferAttribute(this,n),Ol.applyNormalMatrix(e),this.setXYZ(n,Ol.x,Ol.y,Ol.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Ol.fromBufferAttribute(this,n),Ol.transformDirection(e),this.setXYZ(n,Ol.x,Ol.y,Ol.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Hl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Rr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=Rr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Rr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Rr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Rr(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=Hl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Hl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Hl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Hl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Rr(n,this.array),r=Rr(r,this.array),i=Rr(i,this.array),s=Rr(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){AS("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return new Wi(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nu(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){AS("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Cwe=0;class bl extends yh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Cwe++}),this.uuid=au(),this.name="",this.type="Material",this.blending=ex,this.side=_p,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=q2,this.blendDst=X2,this.blendEquation=P0,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Sn(0,0,0),this.blendAlpha=0,this.depthFunc=px,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$R,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pg,this.stencilZFail=Pg,this.stencilZPass=Pg,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 r=e[n];if(r===void 0){gn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){gn(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==ex&&(r.blending=this.blending),this.side!==_p&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==q2&&(r.blendSrc=this.blendSrc),this.blendDst!==X2&&(r.blendDst=this.blendDst),this.blendEquation!==P0&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==px&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$R&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Pg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Pg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Pg&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}}class h9 extends bl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Sn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Wv;const a_=new He,$v=new He,qv=new He,Xv=new Ht,l_=new Ht,AY=new sr,j4=new He,c_=new He,z4=new He,yj=new Ht,m6=new Ht,bj=new Ht;class NY extends _i{constructor(e=new h9){if(super(),this.isSprite=!0,this.type="Sprite",Wv===void 0){Wv=new wr;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new _C(n,5);Wv.setIndex([0,1,2,0,2,3]),Wv.setAttribute("position",new nu(r,3,0,!1)),Wv.setAttribute("uv",new nu(r,2,3,!1))}this.geometry=Wv,this.material=e,this.center=new Ht(.5,.5),this.count=1}raycast(e,n){e.camera===null&&Un('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),$v.setFromMatrixScale(this.matrixWorld),AY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),qv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&$v.multiplyScalar(-qv.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;F4(j4.set(-.5,-.5,0),qv,o,$v,i,s),F4(c_.set(.5,-.5,0),qv,o,$v,i,s),F4(z4.set(.5,.5,0),qv,o,$v,i,s),yj.set(0,0),m6.set(1,0),bj.set(1,1);let a=e.ray.intersectTriangle(j4,c_,z4,!1,a_);if(a===null&&(F4(c_.set(-.5,.5,0),qv,o,$v,i,s),m6.set(0,1),a=e.ray.intersectTriangle(j4,z4,c_,!1,a_),a===null))return;const l=e.ray.origin.distanceTo(a_);l<e.near||l>e.far||n.push({distance:l,point:a_.clone(),uv:Cc.getInterpolation(a_,j4,c_,z4,yj,m6,bj,new Ht),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function F4(t,e,n,r,i,s){Xv.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(l_.x=s*Xv.x-i*Xv.y,l_.y=i*Xv.x+s*Xv.y):l_.copy(Xv),t.copy(e),t.x+=l_.x,t.y+=l_.y,t.applyMatrix4(AY)}const U4=new He,_j=new He;class RY extends _i{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r<i;r++){const s=n[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,n=0,r=0){n=Math.abs(n);const i=this.levels;let s;for(s=0;s<i.length&&!(n<i[s].distance);s++);return i.splice(s,0,{distance:n,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const n=this.levels;for(let r=0;r<n.length;r++)if(n[r].distance===e){const i=n.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const n=this.levels;if(n.length>0){let r,i;for(r=1,i=n.length;r<i;r++){let s=n[r].distance;if(n[r].object.visible&&(s-=s*n[r].hysteresis),e<s)break}return n[r-1].object}return null}raycast(e,n){if(this.levels.length>0){U4.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(U4);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){U4.setFromMatrixPosition(e.matrixWorld),_j.setFromMatrixPosition(this.matrixWorld);const r=U4.distanceTo(_j)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let o=n[i].distance;if(n[i].object.visible&&(o-=o*n[i].hysteresis),r>=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)n[i].object.visible=!1}}toJSON(e){const n=super.toJSON(e);this.autoUpdate===!1&&(n.object.autoUpdate=!1),n.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return n}}const Qh=new He,g6=new He,B4=new He,M0=new He,x6=new He,H4=new He,v6=new He;class Dx{constructor(e=new He,n=new He(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,Qh)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Qh.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Qh.copy(this.origin).addScaledVector(this.direction,n),Qh.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){g6.copy(e).add(n).multiplyScalar(.5),B4.copy(n).sub(e).normalize(),M0.copy(this.origin).sub(g6);const s=e.distanceTo(n)*.5,o=-this.direction.dot(B4),a=M0.dot(this.direction),l=-M0.dot(B4),c=M0.lengthSq(),d=Math.abs(1-o*o);let p,m,x,b;if(d>0)if(p=o*l-a,m=o*a-l,b=s*d,p>=0)if(m>=-b)if(m<=b){const _=1/d;p*=_,m*=_,x=p*(p+o*m+2*a)+m*(o*p+m+2*l)+c}else m=s,p=Math.max(0,-(o*m+a)),x=-p*p+m*(m+2*l)+c;else m=-s,p=Math.max(0,-(o*m+a)),x=-p*p+m*(m+2*l)+c;else m<=-b?(p=Math.max(0,-(-o*s+a)),m=p>0?-s:Math.min(Math.max(-s,-l),s),x=-p*p+m*(m+2*l)+c):m<=b?(p=0,m=Math.min(Math.max(-s,-l),s),x=m*(m+2*l)+c):(p=Math.max(0,-(o*s+a)),m=p>0?s:Math.min(Math.max(-s,-l),s),x=-p*p+m*(m+2*l)+c);else m=o>0?-s:s,p=Math.max(0,-(o*m+a)),x=-p*p+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(g6).addScaledVector(B4,m),x}intersectSphere(e,n){Qh.subVectors(e.center,this.origin);const r=Qh.dot(this.direction),i=Qh.dot(Qh)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,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 r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),p>=0?(a=(e.min.z-m.z)*p,l=(e.max.z-m.z)*p):(a=(e.max.z-m.z)*p,l=(e.min.z-m.z)*p),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Qh)!==null}intersectTriangle(e,n,r,i,s){x6.subVectors(n,e),H4.subVectors(r,e),v6.crossVectors(x6,H4);let o=this.direction.dot(v6),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;M0.subVectors(this.origin,e);const l=a*this.direction.dot(H4.crossVectors(M0,H4));if(l<0)return null;const c=a*this.direction.dot(x6.cross(M0));if(c<0||l+c>o)return null;const d=-a*M0.dot(v6);return d<0?null:this.at(d/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 Ap extends bl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Sn(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 cu,this.combine=Mw,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 Sj=new sr,mg=new Dx,V4=new Wo,wj=new He,G4=new He,W4=new He,$4=new He,y6=new He,q4=new He,Mj=new He,X4=new He;class Fs extends _i{constructor(e=new wr,n=new Ap){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,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){q4.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=a[l],p=s[l];d!==0&&(y6.fromBufferAttribute(p,e),o?q4.addScaledVector(y6,d):q4.addScaledVector(y6.sub(n),d))}n.add(q4)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),V4.copy(r.boundingSphere),V4.applyMatrix4(s),mg.copy(e.ray).recast(e.near),!(V4.containsPoint(mg.origin)===!1&&(mg.intersectSphere(V4,wj)===null||mg.origin.distanceToSquared(wj)>(e.far-e.near)**2))&&(Sj.copy(s).invert(),mg.copy(e.ray).applyMatrix4(Sj),!(r.boundingBox!==null&&mg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,mg)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,p=s.attributes.normal,m=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let b=0,_=m.length;b<_;b++){const S=m[b],w=o[S.materialIndex],C=Math.max(S.start,x.start),A=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let N=C,D=A;N<D;N+=3){const P=a.getX(N),O=a.getX(N+1),R=a.getX(N+2);i=Y4(this,w,e,r,c,d,p,P,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(a.count,x.start+x.count);for(let S=b,w=_;S<w;S+=3){const C=a.getX(S),A=a.getX(S+1),N=a.getX(S+2);i=Y4(this,o,e,r,c,d,p,C,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let b=0,_=m.length;b<_;b++){const S=m[b],w=o[S.materialIndex],C=Math.max(S.start,x.start),A=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let N=C,D=A;N<D;N+=3){const P=N,O=N+1,R=N+2;i=Y4(this,w,e,r,c,d,p,P,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(l.count,x.start+x.count);for(let S=b,w=_;S<w;S+=3){const C=S,A=S+1,N=S+2;i=Y4(this,o,e,r,c,d,p,C,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}}}function Ewe(t,e,n,r,i,s,o,a){let l;if(e.side===$l?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===_p,a),l===null)return null;X4.copy(a),X4.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(X4);return c<n.near||c>n.far?null:{distance:c,point:X4.clone(),object:t}}function Y4(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,G4),t.getVertexPosition(l,W4),t.getVertexPosition(c,$4);const d=Ewe(t,e,n,r,G4,W4,$4,Mj);if(d){const p=new He;Cc.getBarycoord(Mj,G4,W4,$4,p),i&&(d.uv=Cc.getInterpolatedAttribute(i,a,l,c,p,new Ht)),s&&(d.uv1=Cc.getInterpolatedAttribute(s,a,l,c,p,new Ht)),o&&(d.normal=Cc.getInterpolatedAttribute(o,a,l,c,p,new He),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new He,materialIndex:0};Cc.getNormal(G4,W4,$4,m.normal),d.face=m,d.barycoord=p}return d}const Tj=new He,Cj=new fi,Ej=new fi,Awe=new He,Aj=new sr,K4=new He,b6=new Wo,Nj=new sr,_6=new Dx;class kY extends Fs{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=GR,this.bindMatrix=new sr,this.bindMatrixInverse=new sr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Eo),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,K4),this.boundingBox.expandByPoint(K4)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wo),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,K4),this.boundingSphere.expandByPoint(K4)}copy(e,n){return super.copy(e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,n){const r=this.material,i=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),b6.copy(this.boundingSphere),b6.applyMatrix4(i),e.ray.intersectsSphere(b6)!==!1&&(Nj.copy(i).invert(),_6.copy(e.ray).applyMatrix4(Nj),!(this.boundingBox!==null&&_6.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,_6)))}getVertexPosition(e,n){return super.getVertexPosition(e,n),this.applyBoneTransform(e,n),n}bind(e,n){this.skeleton=e,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new fi,n=this.geometry.attributes.skinWeight;for(let r=0,i=n.count;r<i;r++){e.fromBufferAttribute(n,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),n.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===GR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===cY?this.bindMatrixInverse.copy(this.bindMatrix).invert():gn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;Cj.fromBufferAttribute(i.attributes.skinIndex,e),Ej.fromBufferAttribute(i.attributes.skinWeight,e),Tj.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=Ej.getComponent(s);if(o!==0){const a=Cj.getComponent(s);Aj.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(Awe.copy(Tj).applyMatrix4(Aj),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class p9 extends _i{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Yd extends ro{constructor(e=null,n=1,r=1,i,s,o,a,l,c=Co,d=Co,p,m){super(null,o,a,l,c,d,i,s,p,m),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Rj=new sr,Nwe=new sr;class SC{constructor(e=[],n=[]){this.uuid=au(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),n.length===0)this.calculateInverses();else if(e.length!==n.length){gn("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new sr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new sr;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,n=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:Nwe;Rj.multiplyMatrices(a,n[s]),Rj.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new SC(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new Yd(n,e,e,ml,Wl);return r.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=r,this}getBoneByName(e){for(let n=0,r=this.bones.length;n<r;n++){const i=this.bones[n];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,n){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){const s=e.bones[r];let o=n[s];o===void 0&&(gn("Skeleton: No bone found with UUID:",s),o=new p9),this.bones.push(o),this.boneInverses.push(new sr().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const n=this.bones,r=this.boneInverses;for(let i=0,s=n.length;i<s;i++){const o=n[i];e.bones.push(o.uuid);const a=r[i];e.boneInverses.push(a.toArray())}return e}}class xx extends Wi{constructor(e,n,r,i=1){super(e,n,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Yv=new sr,kj=new sr,Z4=[],Dj=new Eo,Rwe=new sr,u_=new Fs,d_=new Wo;class DY extends Fs{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new xx(new Float32Array(r*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<r;i++)this.setMatrixAt(i,Rwe)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Eo),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Yv),Dj.copy(e.boundingBox).applyMatrix4(Yv),this.boundingBox.union(Dj)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Yv),d_.copy(e.boundingSphere).applyMatrix4(Yv),this.boundingSphere.union(d_)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const r=n.morphTargetInfluences,i=this.morphTexture.source.data.data,s=r.length+1,o=e*s+1;for(let a=0;a<r.length;a++)r[a]=i[o+a]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(u_.geometry=this.geometry,u_.material=this.material,u_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),d_.copy(this.boundingSphere),d_.applyMatrix4(r),e.ray.intersectsSphere(d_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Yv),kj.multiplyMatrices(r,Yv),u_.matrixWorld=kj,u_.raycast(e,Z4);for(let o=0,a=Z4.length;o<a;o++){const l=Z4[o];l.instanceId=s,l.object=this,n.push(l)}Z4.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new xx(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const r=n.morphTargetInfluences,i=r.length+1;this.morphTexture===null&&(this.morphTexture=new Yd(new Float32Array(i*this.count),i,this.count,dC,Wl));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<r.length;c++)o+=r[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(r,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const S6=new He,kwe=new He,Dwe=new Sr;class rp{constructor(e=new He(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,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=S6.subVectors(r,n).cross(kwe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(S6),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<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 r=n||Dwe.getNormalMatrix(e),i=this.coplanarPoint(S6).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const gg=new Wo,Pwe=new Ht(.5,.5),Q4=new He;class zy{constructor(e=new rp,n=new rp,r=new rp,i=new rp,s=new rp,o=new rp){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=tu,r=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],d=s[4],p=s[5],m=s[6],x=s[7],b=s[8],_=s[9],S=s[10],w=s[11],C=s[12],A=s[13],N=s[14],D=s[15];if(i[0].setComponents(c-o,x-d,w-b,D-C).normalize(),i[1].setComponents(c+o,x+d,w+b,D+C).normalize(),i[2].setComponents(c+a,x+p,w+_,D+A).normalize(),i[3].setComponents(c-a,x-p,w-_,D-A).normalize(),r)i[4].setComponents(l,m,S,N).normalize(),i[5].setComponents(c-l,x-m,w-S,D-N).normalize();else if(i[4].setComponents(c-l,x-m,w-S,D-N).normalize(),n===tu)i[5].setComponents(c+l,x+m,w+S,D+N).normalize();else if(n===gx)i[5].setComponents(l,m,S,N).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(),gg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),gg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(gg)}intersectsSprite(e){gg.center.set(0,0,0);const n=Pwe.distanceTo(e.center);return gg.radius=.7071067811865476+n,gg.applyMatrix4(e.matrixWorld),this.intersectsSphere(gg)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(Q4.x=i.normal.x>0?e.max.x:e.min.x,Q4.y=i.normal.y>0?e.max.y:e.min.y,Q4.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Q4)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Df=new sr,Pf=new zy;class wC{constructor(){this.coordinateSystem=tu}intersectsObject(e,n){if(!n.isArrayCamera||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Df.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pf.setFromProjectionMatrix(Df,i.coordinateSystem,i.reversedDepth),Pf.intersectsObject(e))return!0}return!1}intersectsSprite(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Df.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pf.setFromProjectionMatrix(Df,i.coordinateSystem,i.reversedDepth),Pf.intersectsSprite(e))return!0}return!1}intersectsSphere(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Df.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pf.setFromProjectionMatrix(Df,i.coordinateSystem,i.reversedDepth),Pf.intersectsSphere(e))return!0}return!1}intersectsBox(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Df.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pf.setFromProjectionMatrix(Df,i.coordinateSystem,i.reversedDepth),Pf.intersectsBox(e))return!0}return!1}containsPoint(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Df.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pf.setFromProjectionMatrix(Df,i.coordinateSystem,i.reversedDepth),Pf.containsPoint(e))return!0}return!1}clone(){return new wC}}function w6(t,e){return t-e}function Iwe(t,e){return t.z-e.z}function Owe(t,e){return e.z-t.z}class Lwe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=n,a.z=r,a.index=i}reset(){this.list.length=0,this.index=0}}const yc=new sr,jwe=new Sn(1,1,1),Pj=new zy,zwe=new wC,J4=new Eo,xg=new Wo,f_=new He,Ij=new He,Fwe=new He,M6=new Lwe,dl=new Fs,eM=[];function Uwe(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s<i;s++)for(let o=0;o<r;o++)e.setComponent(s+n,o,t.getComponent(s,o))}else e.array.set(t.array,n*r);e.needsUpdate=!0}function vg(t,e){if(t.constructor!==e.constructor){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++)e[r]=t[r]}else{const n=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,n))}}class PY extends Fs{constructor(e,n,r=n*2,i){super(new wr,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=n,this._maxIndexCount=r,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4),r=new Yd(n,e,e,ml,Wl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Yd(n,e,e,Tw,id);this._indirectTexture=r}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Float32Array(e*e*4).fill(1),r=new Yd(n,e,e,ml,Wl);r.colorSpace=ai.workingColorSpace,this._colorsTexture=r}_initializeGeometry(e){const n=this.geometry,r=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,d=new a.constructor(r*l),p=new Wi(d,l,c);n.setAttribute(s,p)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Wi(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`THREE.BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const n=this._instanceInfo;if(e<0||e>=n.length||n[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const n=this._geometryInfo;if(e<0||e>=n.length||n[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Eo);const e=this.boundingBox,n=this._instanceInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,yc),this.getBoundingBoxAt(s,J4).applyMatrix4(yc),e.union(J4)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wo);const e=this.boundingSphere,n=this._instanceInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,yc),this.getBoundingSphereAt(s,xg).applyMatrix4(yc),e.union(xg)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(w6),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=r):(i=this._instanceInfo.length,this._instanceInfo.push(r));const s=this._matricesTexture;yc.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(jwe.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,n=-1,r=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=n===-1?e.getAttribute("position").count:n;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=r===-1?o.count:r),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(w6),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._geometryInfo[e];if(i&&o.count>a.reservedIndexCount||n.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=n.getAttribute("position").count;for(const d in r.attributes){const p=n.getAttribute(d),m=r.getAttribute(d);Uwe(p,m,l);const x=p.itemSize;for(let b=p.count,_=c;b<_;b++){const S=l+b;for(let w=0;w<x;w++)m.setComponent(S,w,0)}m.needsUpdate=!0,m.addUpdateRange(l*x,c*x)}if(i){const d=a.indexStart,p=a.reservedIndexCount;a.indexCount=n.getIndex().count;for(let m=0;m<o.count;m++)s.setX(d+m,l+o.getX(m));for(let m=o.count,x=p;m<x;m++)s.setX(d+m,l);s.needsUpdate=!0,s.addUpdateRange(d,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?a.indexCount:a.vertexCount,a.boundingBox=null,n.boundingBox!==null&&(a.boundingBox=n.boundingBox.clone()),a.boundingSphere=null,n.boundingSphere!==null&&(a.boundingSphere=n.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const n=this._geometryInfo;if(e>=n.length||n[e].active===!1)return this;const r=this._instanceInfo;for(let i=0,s=r.length;i<s;i++)r[i].active&&r[i].geometryIndex===e&&this.deleteInstance(i);return n[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,n=0;const r=this._geometryInfo,i=r.map((o,a)=>a).sort((o,a)=>r[o].vertexStart-r[a].vertexStart),s=this.geometry;for(let o=0,a=r.length;o<a;o++){const l=i[o],c=r[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==n){const{indexStart:d,vertexStart:p,reservedIndexCount:m}=c,x=s.index,b=x.array,_=e-p;for(let S=d;S<d+m;S++)b[S]=b[S]+_;x.array.copyWithin(n,d,d+m),x.addUpdateRange(n,m),x.needsUpdate=!0,c.indexStart=n}n+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:d,reservedVertexCount:p}=c,m=s.attributes;for(const x in m){const b=m[x],{array:_,itemSize:S}=b;_.copyWithin(e*S,d*S,(d+p)*S),b.addUpdateRange(e*S,p*S),b.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=n,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Eo,o=r.index,a=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let d=l;o&&(d=o.getX(d)),s.expandByPoint(f_.fromBufferAttribute(a,d))}i.boundingBox=s}return n.copy(i.boundingBox),n}getBoundingSphereAt(e,n){if(e>=this._geometryCount)return null;const r=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Wo;this.getBoundingBoxAt(e,J4),J4.getCenter(s.center);const o=r.index,a=r.attributes.position;let l=0;for(let c=i.start,d=i.start+i.count;c<d;c++){let p=c;o&&(p=o.getX(p)),f_.fromBufferAttribute(a,p),l=Math.max(l,s.center.distanceToSquared(f_))}s.radius=Math.sqrt(l),i.boundingSphere=s}return n.copy(i.boundingSphere),n}setMatrixAt(e,n){this.validateInstanceId(e);const r=this._matricesTexture,i=this._matricesTexture.image.data;return n.toArray(i,e*16),r.needsUpdate=!0,this}getMatrixAt(e,n){return this.validateInstanceId(e),n.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,n){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),n.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,n){return this.validateInstanceId(e),n.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,n){return this.validateInstanceId(e),this._instanceInfo[e].visible===n?this:(this._instanceInfo[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,n){return this.validateInstanceId(e),this.validateGeometryId(n),this._instanceInfo[e].geometryIndex=n,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,n={}){this.validateGeometryId(e);const r=this._geometryInfo[e];return n.vertexStart=r.vertexStart,n.vertexCount=r.vertexCount,n.reservedVertexCount=r.reservedVertexCount,n.indexStart=r.indexStart,n.indexCount=r.indexCount,n.reservedIndexCount=r.reservedIndexCount,n.start=r.start,n.count=r.count,n}setInstanceCount(e){const n=this._availableInstanceIds,r=this._instanceInfo;for(n.sort(w6);n[n.length-1]===r.length-1;)r.pop(),n.pop();if(e<r.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);vg(this._multiDrawCounts,i),vg(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),vg(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),vg(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),vg(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,n){const r=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...r.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${n}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...r.map(l=>l.indexStart+l.reservedIndexCount))>n)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${n}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=n,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new wr,this._initializeGeometry(s));const o=this.geometry;s.index&&vg(s.index.array,o.index.array);for(const a in s.attributes)vg(s.attributes[a].array,o.attributes[a].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;dl.material=this.material,dl.geometry.index=o.index,dl.geometry.attributes=o.attributes,dl.geometry.boundingBox===null&&(dl.geometry.boundingBox=new Eo),dl.geometry.boundingSphere===null&&(dl.geometry.boundingSphere=new Wo);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,d=i[c];dl.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(a,dl.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,dl.geometry.boundingBox),this.getBoundingSphereAt(c,dl.geometry.boundingSphere),dl.raycast(e,eM);for(let p=0,m=eM.length;p<m;p++){const x=eM[p];x.object=this,x.batchId=a,n.push(x)}eM.length=0}dl.material=null,dl.geometry.index=null,dl.geometry.attributes={},dl.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(n=>({...n,boundingBox:n.boundingBox!==null?n.boundingBox.clone():null,boundingSphere:n.boundingSphere!==null?n.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(n=>({...n})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex();let a=o===null?1:o.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,a=i.attributes.position.count>65535?4:2);const c=this._instanceInfo,d=this._multiDrawStarts,p=this._multiDrawCounts,m=this._geometryInfo,x=this.perObjectFrustumCulled,b=this._indirectTexture,_=b.image.data,S=r.isArrayCamera?zwe:Pj;x&&!r.isArrayCamera&&(yc.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),Pj.setFromProjectionMatrix(yc,r.coordinateSystem,r.reversedDepth));let w=0;if(this.sortObjects){yc.copy(this.matrixWorld).invert(),f_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(yc),Ij.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(yc);for(let N=0,D=c.length;N<D;N++)if(c[N].visible&&c[N].active){const P=c[N].geometryIndex;this.getMatrixAt(N,yc),this.getBoundingSphereAt(P,xg).applyMatrix4(yc);let O=!1;if(x&&(O=!S.intersectsSphere(xg,r)),!O){const R=m[P],L=Fwe.subVectors(xg.center,f_).dot(Ij);M6.push(R.start,R.count,L,N)}}const C=M6.list,A=this.customSort;A===null?C.sort(s.transparent?Owe:Iwe):A.call(this,C,r);for(let N=0,D=C.length;N<D;N++){const P=C[N];d[w]=P.start*a*l,p[w]=P.count*l,_[w]=P.index,w++}M6.reset()}else for(let C=0,A=c.length;C<A;C++)if(c[C].visible&&c[C].active){const N=c[C].geometryIndex;let D=!1;if(x&&(this.getMatrixAt(C,yc),this.getBoundingSphereAt(N,xg).applyMatrix4(yc),D=!S.intersectsSphere(xg,r)),!D){const P=m[N];d[w]=P.start*a*l,p[w]=P.count*l,_[w]=C,w++}}b.needsUpdate=!0,this._multiDrawCount=w,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class Xl extends bl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Sn(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const O5=new He,L5=new He,Oj=new sr,h_=new Dx,tM=new Wo,T6=new He,Lj=new He;let cm=class extends _i{constructor(e=new wr,n=new Xl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[0];for(let i=1,s=n.count;i<s;i++)O5.fromBufferAttribute(n,i-1),L5.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=O5.distanceTo(L5);e.setAttribute("lineDistance",new Rn(r,1))}else gn("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),tM.copy(r.boundingSphere),tM.applyMatrix4(i),tM.radius+=s,e.ray.intersectsSphere(tM)===!1)return;Oj.copy(i).invert(),h_.copy(e.ray).applyMatrix4(Oj);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,d=r.index,m=r.attributes.position;if(d!==null){const x=Math.max(0,o.start),b=Math.min(d.count,o.start+o.count);for(let _=x,S=b-1;_<S;_+=c){const w=d.getX(_),C=d.getX(_+1),A=nM(this,e,h_,l,w,C,_);A&&n.push(A)}if(this.isLineLoop){const _=d.getX(b-1),S=d.getX(x),w=nM(this,e,h_,l,_,S,b-1);w&&n.push(w)}}else{const x=Math.max(0,o.start),b=Math.min(m.count,o.start+o.count);for(let _=x,S=b-1;_<S;_+=c){const w=nM(this,e,h_,l,_,_+1,_);w&&n.push(w)}if(this.isLineLoop){const _=nM(this,e,h_,l,b-1,x,b-1);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function nM(t,e,n,r,i,s,o){const a=t.geometry.attributes.position;if(O5.fromBufferAttribute(a,i),L5.fromBufferAttribute(a,s),n.distanceSqToSegment(O5,L5,T6,Lj)>r)return;T6.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(T6);if(!(c<e.near||c>e.far))return{distance:c,point:Lj.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const jj=new He,zj=new He;class bh extends cm{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i<s;i+=2)jj.fromBufferAttribute(n,i),zj.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+jj.distanceTo(zj);e.setAttribute("lineDistance",new Rn(r,1))}else gn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class IY extends cm{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class m9 extends bl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Sn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Fj=new sr,XR=new Dx,rM=new Wo,iM=new He;class OY extends _i{constructor(e=new wr,n=new m9){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),rM.copy(r.boundingSphere),rM.applyMatrix4(i),rM.radius+=s,e.ray.intersectsSphere(rM)===!1)return;Fj.copy(i).invert(),XR.copy(e.ray).applyMatrix4(Fj);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=r.index,p=r.attributes.position;if(c!==null){const m=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let b=m,_=x;b<_;b++){const S=c.getX(b);iM.fromBufferAttribute(p,S),Uj(iM,S,l,i,e,n,this)}}else{const m=Math.max(0,o.start),x=Math.min(p.count,o.start+o.count);for(let b=m,_=x;b<_;b++)iM.fromBufferAttribute(p,b),Uj(iM,b,l,i,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Uj(t,e,n,r,i,s,o){const a=XR.distanceSqToPoint(t);if(a<n){const l=new He;XR.closestPointToPoint(t,l),l.applyMatrix4(r);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class LY extends ro{constructor(e,n,r,i,s=rs,o=rs,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const d=this;function p(){d.needsUpdate=!0,d._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Bwe extends LY{constructor(e,n,r,i,s,o,a,l){super({},e,n,r,i,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class Hwe extends ro{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Co,this.minFilter=Co,this.generateMipmaps=!1,this.needsUpdate=!0}}class MC extends ro{constructor(e,n,r,i,s,o,a,l,c,d,p,m){super(null,o,a,l,c,d,i,s,p,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Vwe extends MC{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ec,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Gwe extends MC{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,ch),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Cw extends ro{constructor(e=[],n=ch,r,i,s,o,a,l,c,d){super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Wwe extends ro{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class fy extends ro{constructor(e,n,r=id,i,s,o,a=Co,l=Co,c,d=dh,p=1){if(d!==dh&&d!==W0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:n,depth:p};super(m,i,s,o,a,l,d,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new $0(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 jY extends fy{constructor(e,n=id,r=ch,i,s,o=Co,a=Co,l,c=dh){const d={width:e,height:e,depth:1},p=[d,d,d,d,d,d];super(e,e,n,r,i,s,o,a,l,c),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class g9 extends ro{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Px extends wr{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],p=[];let m=0,x=0;b("z","y","x",-1,-1,r,n,e,o,s,0),b("z","y","x",1,-1,r,n,-e,o,s,1),b("x","z","y",1,1,e,r,n,i,o,2),b("x","z","y",1,-1,e,r,-n,i,o,3),b("x","y","z",1,-1,e,n,r,i,s,4),b("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(d,3)),this.setAttribute("uv",new Rn(p,2));function b(_,S,w,C,A,N,D,P,O,R,L){const V=N/O,F=D/R,U=N/2,W=D/2,Y=P/2,$=O+1,X=R+1;let Z=0,K=0;const ne=new He;for(let H=0;H<X;H++){const B=H*F-W;for(let G=0;G<$;G++){const j=G*V-U;ne[_]=j*C,ne[S]=B*A,ne[w]=Y,c.push(ne.x,ne.y,ne.z),ne[_]=0,ne[S]=0,ne[w]=P>0?1:-1,d.push(ne.x,ne.y,ne.z),p.push(G/O),p.push(1-H/R),Z+=1}}for(let H=0;H<R;H++)for(let B=0;B<O;B++){const G=m+B+$*H,j=m+B+$*(H+1),ie=m+(B+1)+$*(H+1),ce=m+(B+1)+$*H;l.push(G,j,ce),l.push(j,ie,ce),K+=6}a.addGroup(x,K,L),x+=K,m+=Z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Px(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class TC extends wr{constructor(e=1,n=1,r=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:n,capSegments:r,radialSegments:i,heightSegments:s},n=Math.max(0,n),r=Math.max(1,Math.floor(r)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],a=[],l=[],c=[],d=n/2,p=Math.PI/2*e,m=n,x=2*p+m,b=r*2+s,_=i+1,S=new He,w=new He;for(let C=0;C<=b;C++){let A=0,N=0,D=0,P=0;if(C<=r){const L=C/r,V=L*Math.PI/2;N=-d-e*Math.cos(V),D=e*Math.sin(V),P=-e*Math.cos(V),A=L*p}else if(C<=r+s){const L=(C-r)/s;N=-d+L*n,D=e,P=0,A=p+L*m}else{const L=(C-r-s)/r,V=L*Math.PI/2;N=d+e*Math.sin(V),D=e*Math.cos(V),P=e*Math.sin(V),A=p+m+L*p}const O=Math.max(0,Math.min(1,A/x));let R=0;C===0?R=.5/i:C===b&&(R=-.5/i);for(let L=0;L<=i;L++){const V=L/i,F=V*Math.PI*2,U=Math.sin(F),W=Math.cos(F);w.x=-D*W,w.y=N,w.z=D*U,a.push(w.x,w.y,w.z),S.set(-D*W,P,D*U),S.normalize(),l.push(S.x,S.y,S.z),c.push(V+R,O)}if(C>0){const L=(C-1)*_;for(let V=0;V<i;V++){const F=L+V,U=L+V+1,W=C*_+V,Y=C*_+V+1;o.push(F,U,W),o.push(U,Y,W)}}}this.setIndex(o),this.setAttribute("position",new Rn(a,3)),this.setAttribute("normal",new Rn(l,3)),this.setAttribute("uv",new Rn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TC(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class CC extends wr{constructor(e=1,n=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);const s=[],o=[],a=[],l=[],c=new He,d=new Ht;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let p=0,m=3;p<=n;p++,m+=3){const x=r+p/n*i;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),d.x=(o[m]/e+1)/2,d.y=(o[m+1]/e+1)/2,l.push(d.x,d.y)}for(let p=1;p<=n;p++)s.push(p,p+1,0);this.setIndex(s),this.setAttribute("position",new Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CC(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ew extends wr{constructor(e=1,n=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const d=[],p=[],m=[],x=[];let b=0;const _=[],S=r/2;let w=0;C(),o===!1&&(e>0&&A(!0),n>0&&A(!1)),this.setIndex(d),this.setAttribute("position",new Rn(p,3)),this.setAttribute("normal",new Rn(m,3)),this.setAttribute("uv",new Rn(x,2));function C(){const N=new He,D=new He;let P=0;const O=(n-e)/r;for(let R=0;R<=s;R++){const L=[],V=R/s,F=V*(n-e)+e;for(let U=0;U<=i;U++){const W=U/i,Y=W*l+a,$=Math.sin(Y),X=Math.cos(Y);D.x=F*$,D.y=-V*r+S,D.z=F*X,p.push(D.x,D.y,D.z),N.set($,O,X).normalize(),m.push(N.x,N.y,N.z),x.push(W,1-V),L.push(b++)}_.push(L)}for(let R=0;R<i;R++)for(let L=0;L<s;L++){const V=_[L][R],F=_[L+1][R],U=_[L+1][R+1],W=_[L][R+1];(e>0||L!==0)&&(d.push(V,F,W),P+=3),(n>0||L!==s-1)&&(d.push(F,U,W),P+=3)}c.addGroup(w,P,0),w+=P}function A(N){const D=b,P=new Ht,O=new He;let R=0;const L=N===!0?e:n,V=N===!0?1:-1;for(let U=1;U<=i;U++)p.push(0,S*V,0),m.push(0,V,0),x.push(.5,.5),b++;const F=b;for(let U=0;U<=i;U++){const Y=U/i*l+a,$=Math.cos(Y),X=Math.sin(Y);O.x=L*X,O.y=S*V,O.z=L*$,p.push(O.x,O.y,O.z),m.push(0,V,0),P.x=$*.5+.5,P.y=X*.5*V+.5,x.push(P.x,P.y),b++}for(let U=0;U<i;U++){const W=D+U,Y=F+U;N===!0?d.push(Y,Y+1,W):d.push(Y+1,Y,W),R+=3}c.addGroup(w,R,N===!0?1:2),w+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ew(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Aw extends Ew{constructor(e=1,n=1,r=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,n,r,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Aw(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Mm extends wr{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],o=[];a(i),c(r),d(),this.setAttribute("position",new Rn(s,3)),this.setAttribute("normal",new Rn(s.slice(),3)),this.setAttribute("uv",new Rn(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(C){const A=new He,N=new He,D=new He;for(let P=0;P<n.length;P+=3)x(n[P+0],A),x(n[P+1],N),x(n[P+2],D),l(A,N,D,C)}function l(C,A,N,D){const P=D+1,O=[];for(let R=0;R<=P;R++){O[R]=[];const L=C.clone().lerp(N,R/P),V=A.clone().lerp(N,R/P),F=P-R;for(let U=0;U<=F;U++)U===0&&R===P?O[R][U]=L:O[R][U]=L.clone().lerp(V,U/F)}for(let R=0;R<P;R++)for(let L=0;L<2*(P-R)-1;L++){const V=Math.floor(L/2);L%2===0?(m(O[R][V+1]),m(O[R+1][V]),m(O[R][V])):(m(O[R][V+1]),m(O[R+1][V+1]),m(O[R+1][V]))}}function c(C){const A=new He;for(let N=0;N<s.length;N+=3)A.x=s[N+0],A.y=s[N+1],A.z=s[N+2],A.normalize().multiplyScalar(C),s[N+0]=A.x,s[N+1]=A.y,s[N+2]=A.z}function d(){const C=new He;for(let A=0;A<s.length;A+=3){C.x=s[A+0],C.y=s[A+1],C.z=s[A+2];const N=S(C)/2/Math.PI+.5,D=w(C)/Math.PI+.5;o.push(N,1-D)}b(),p()}function p(){for(let C=0;C<o.length;C+=6){const A=o[C+0],N=o[C+2],D=o[C+4],P=Math.max(A,N,D),O=Math.min(A,N,D);P>.9&&O<.1&&(A<.2&&(o[C+0]+=1),N<.2&&(o[C+2]+=1),D<.2&&(o[C+4]+=1))}}function m(C){s.push(C.x,C.y,C.z)}function x(C,A){const N=C*3;A.x=e[N+0],A.y=e[N+1],A.z=e[N+2]}function b(){const C=new He,A=new He,N=new He,D=new He,P=new Ht,O=new Ht,R=new Ht;for(let L=0,V=0;L<s.length;L+=9,V+=6){C.set(s[L+0],s[L+1],s[L+2]),A.set(s[L+3],s[L+4],s[L+5]),N.set(s[L+6],s[L+7],s[L+8]),P.set(o[V+0],o[V+1]),O.set(o[V+2],o[V+3]),R.set(o[V+4],o[V+5]),D.copy(C).add(A).add(N).divideScalar(3);const F=S(D);_(P,V+0,C,F),_(O,V+2,A,F),_(R,V+4,N,F)}}function _(C,A,N,D){D<0&&C.x===1&&(o[A]=C.x-1),N.x===0&&N.z===0&&(o[A]=D/2/Math.PI+.5)}function S(C){return Math.atan2(C.z,-C.x)}function w(C){return Math.atan2(-C.y,Math.sqrt(C.x*C.x+C.z*C.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mm(e.vertices,e.indices,e.radius,e.detail)}}class EC extends Mm{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new EC(e.radius,e.detail)}}const sM=new He,oM=new He,C6=new He,aM=new Cc;class x9 extends wr{constructor(e=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:n},e!==null){const i=Math.pow(10,4),s=Math.cos(tx*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],d=["a","b","c"],p=new Array(3),m={},x=[];for(let b=0;b<l;b+=3){o?(c[0]=o.getX(b),c[1]=o.getX(b+1),c[2]=o.getX(b+2)):(c[0]=b,c[1]=b+1,c[2]=b+2);const{a:_,b:S,c:w}=aM;if(_.fromBufferAttribute(a,c[0]),S.fromBufferAttribute(a,c[1]),w.fromBufferAttribute(a,c[2]),aM.getNormal(C6),p[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,p[1]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,p[2]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,!(p[0]===p[1]||p[1]===p[2]||p[2]===p[0]))for(let C=0;C<3;C++){const A=(C+1)%3,N=p[C],D=p[A],P=aM[d[C]],O=aM[d[A]],R=`${N}_${D}`,L=`${D}_${N}`;L in m&&m[L]?(C6.dot(m[L].normal)<=s&&(x.push(P.x,P.y,P.z),x.push(O.x,O.y,O.z)),m[L]=null):R in m||(m[R]={index0:c[C],index1:c[A],normal:C6.clone()})}}for(const b in m)if(m[b]){const{index0:_,index1:S}=m[b];sM.fromBufferAttribute(a,_),oM.fromBufferAttribute(a,S),x.push(sM.x,sM.y,sM.z),x.push(oM.x,oM.y,oM.z)}this.setAttribute("position",new Rn(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class nf{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){gn("Curve: .getPoint() not implemented.")}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n=null){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,x=(o-d)/m;return(i+x)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ht:new He);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n=!1){const r=new He,i=[],s=[],o=[],a=new He,l=new sr;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new He)}s[0]=new He,o[0]=new He;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),p=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),p<=c&&(c=p,r.set(0,1,0)),m<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(i[x-1],i[x]),a.length()>Number.EPSILON){a.normalize();const b=Math.acos(lr(i[x-1].dot(i[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,b))}o[x].crossVectors(i[x],s[x])}if(n===!0){let x=Math.acos(lr(s[0].dot(s[e]),-1,1));x/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],x*b)),o[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class AC extends nf{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ht){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const d=Math.cos(this.aRotation),p=Math.sin(this.aRotation),m=l-this.aX,x=c-this.aY;l=m*d-x*p+this.aX,c=m*p+x*d+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class zY extends AC{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function v9(){let t=0,e=0,n=0,r=0;function i(s,o,a,l){t=s,e=a,n=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,d,p){let m=(o-s)/c-(a-s)/(c+d)+(a-o)/d,x=(a-o)/d-(l-o)/(d+p)+(l-a)/p;m*=d,x*=d,i(o,a,m,x)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const lM=new He,E6=new v9,A6=new v9,N6=new v9;class FY extends nf{constructor(e=[],n=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=r,this.tension=i}getPoint(e,n=new He){const r=n,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(lM.subVectors(i[0],i[1]).add(i[0]),c=lM);const p=i[a%s],m=i[(a+1)%s];if(this.closed||a+2<s?d=i[(a+2)%s]:(lM.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=lM),this.curveType==="centripetal"||this.curveType==="chordal"){const x=this.curveType==="chordal"?.5:.25;let b=Math.pow(c.distanceToSquared(p),x),_=Math.pow(p.distanceToSquared(m),x),S=Math.pow(m.distanceToSquared(d),x);_<1e-4&&(_=1),b<1e-4&&(b=_),S<1e-4&&(S=_),E6.initNonuniformCatmullRom(c.x,p.x,m.x,d.x,b,_,S),A6.initNonuniformCatmullRom(c.y,p.y,m.y,d.y,b,_,S),N6.initNonuniformCatmullRom(c.z,p.z,m.z,d.z,b,_,S)}else this.curveType==="catmullrom"&&(E6.initCatmullRom(c.x,p.x,m.x,d.x,this.tension),A6.initCatmullRom(c.y,p.y,m.y,d.y,this.tension),N6.initCatmullRom(c.z,p.z,m.z,d.z,this.tension));return r.set(E6.calc(l),A6.calc(l),N6.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new He().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Bj(t,e,n,r,i){const s=(r-e)*.5,o=(i-n)*.5,a=t*t,l=t*a;return(2*n-2*r+s+o)*l+(-3*n+3*r-2*s-o)*a+s*t+n}function $we(t,e){const n=1-t;return n*n*e}function qwe(t,e){return 2*(1-t)*t*e}function Xwe(t,e){return t*t*e}function Y_(t,e,n,r){return $we(t,e)+qwe(t,n)+Xwe(t,r)}function Ywe(t,e){const n=1-t;return n*n*n*e}function Kwe(t,e){const n=1-t;return 3*n*n*t*e}function Zwe(t,e){return 3*(1-t)*t*t*e}function Qwe(t,e){return t*t*t*e}function K_(t,e,n,r,i){return Ywe(t,e)+Kwe(t,n)+Zwe(t,r)+Qwe(t,i)}class y9 extends nf{constructor(e=new Ht,n=new Ht,r=new Ht,i=new Ht){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Ht){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(K_(e,i.x,s.x,o.x,a.x),K_(e,i.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class UY extends nf{constructor(e=new He,n=new He,r=new He,i=new He){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new He){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(K_(e,i.x,s.x,o.x,a.x),K_(e,i.y,s.y,o.y,a.y),K_(e,i.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class b9 extends nf{constructor(e=new Ht,n=new Ht){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Ht){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Ht){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class BY extends nf{constructor(e=new He,n=new He){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new He){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new He){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _9 extends nf{constructor(e=new Ht,n=new Ht,r=new Ht){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Ht){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Y_(e,i.x,s.x,o.x),Y_(e,i.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class S9 extends nf{constructor(e=new He,n=new He,r=new He){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new He){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Y_(e,i.x,s.x,o.x),Y_(e,i.y,s.y,o.y),Y_(e,i.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class w9 extends nf{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Ht){const r=n,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],d=i[o>i.length-2?i.length-1:o+1],p=i[o>i.length-3?i.length-1:o+2];return r.set(Bj(a,l.x,c.x,d.x,p.x),Bj(a,l.y,c.y,d.y,p.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new Ht().fromArray(i))}return this}}var j5=Object.freeze({__proto__:null,ArcCurve:zY,CatmullRomCurve3:FY,CubicBezierCurve:y9,CubicBezierCurve3:UY,EllipseCurve:AC,LineCurve:b9,LineCurve3:BY,QuadraticBezierCurve:_9,QuadraticBezierCurve3:S9,SplineCurve:w9});class HY extends nf{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(n)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new j5[r](n,e))}return this}getPoint(e,n){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r<i;r++)n+=this.curves[r].getLength(),e.push(n);return this.cacheLengths=e,e}getSpacedPoints(e=40){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return this.autoClose&&n.push(n[0]),n}getPoints(e=12){const n=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const d=l[c];r&&r.equals(d)||(n.push(d),r=d)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new j5[i.type]().fromJSON(i))}return this}}class z5 extends HY{constructor(e){super(),this.type="Path",this.currentPoint=new Ht,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let n=1,r=e.length;n<r;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){return this.currentPoint.set(e,n),this}lineTo(e,n){const r=new b9(this.currentPoint.clone(),new Ht(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new _9(this.currentPoint.clone(),new Ht(e,n),new Ht(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new y9(this.currentPoint.clone(),new Ht(e,n),new Ht(r,i),new Ht(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new w9(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,n+l,r,i,s,o),this}absarc(e,n,r,i,s,o){return this.absellipse(e,n,r,r,i,s,o),this}ellipse(e,n,r,i,s,o,a,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new AC(e,n,r,i,s,o,a,l);if(this.curves.length>0){const p=c.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Y0 extends z5{constructor(e){super(e),this.uuid=au(),this.type="Shape",this.holes=[]}getPointsHoles(e){const n=[];for(let r=0,i=this.holes.length;r<i;r++)n[r]=this.holes[r].getPoints(e);return n}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let n=0,r=this.holes.length;n<r;n++){const i=this.holes[n];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(new z5().fromJSON(i))}return this}}function Jwe(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=VY(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=i3e(t,e,s,n)),t.length>80*n){a=t[0],l=t[1];let d=a,p=l;for(let m=n;m<i;m+=n){const x=t[m],b=t[m+1];x<a&&(a=x),b<l&&(l=b),x>d&&(d=x),b>p&&(p=b)}c=Math.max(d-a,p-l),c=c!==0?32767/c:0}return RS(s,o,n,a,l,c,0),o}function VY(t,e,n,r,i){let s;if(i===m3e(t,e,n,r)>0)for(let o=e;o<n;o+=r)s=Hj(o/r|0,t[o],t[o+1],s);else for(let o=n-r;o>=e;o-=r)s=Hj(o/r|0,t[o],t[o+1],s);return s&&hy(s,s.next)&&(DS(s),s=s.next),s}function vx(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(hy(n,n.next)||eo(n.prev,n,n.next)===0)){if(DS(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function RS(t,e,n,r,i,s,o){if(!t)return;!o&&s&&c3e(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?t3e(t,r,i,s):e3e(t)){e.push(l.i,t.i,c.i),DS(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=n3e(vx(t),e),RS(t,e,n,r,i,s,2)):o===2&&r3e(t,e,n,r,i,s):RS(vx(t),e,n,r,i,s,1);break}}}function e3e(t){const e=t.prev,n=t,r=t.next;if(eo(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=Math.min(i,s,o),p=Math.min(a,l,c),m=Math.max(i,s,o),x=Math.max(a,l,c);let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=m&&b.y>=p&&b.y<=x&&C_(i,a,s,l,o,c,b.x,b.y)&&eo(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function t3e(t,e,n,r){const i=t.prev,s=t,o=t.next;if(eo(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,p=s.y,m=o.y,x=Math.min(a,l,c),b=Math.min(d,p,m),_=Math.max(a,l,c),S=Math.max(d,p,m),w=YR(x,b,e,n,r),C=YR(_,S,e,n,r);let A=t.prevZ,N=t.nextZ;for(;A&&A.z>=w&&N&&N.z<=C;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&C_(a,d,l,p,c,m,A.x,A.y)&&eo(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&C_(a,d,l,p,c,m,N.x,N.y)&&eo(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;A&&A.z>=w;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&C_(a,d,l,p,c,m,A.x,A.y)&&eo(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;N&&N.z<=C;){if(N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&C_(a,d,l,p,c,m,N.x,N.y)&&eo(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function n3e(t,e){let n=t;do{const r=n.prev,i=n.next.next;!hy(r,i)&&WY(r,n,n.next,i)&&kS(r,i)&&kS(i,r)&&(e.push(r.i,n.i,i.i),DS(n),DS(n.next),n=t=i),n=n.next}while(n!==t);return vx(n)}function r3e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&f3e(o,a)){let l=$Y(o,a);o=vx(o,o.next),l=vx(l,l.next),RS(o,e,n,r,i,s,0),RS(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function i3e(t,e,n,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,c=VY(t,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(d3e(c))}i.sort(s3e);for(let s=0;s<i.length;s++)n=o3e(i[s],n);return n}function s3e(t,e){let n=t.x-e.x;if(n===0&&(n=t.y-e.y,n===0)){const r=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);n=r-i}return n}function o3e(t,e){const n=a3e(t,e);if(!n)return e;const r=$Y(n,t);return vx(r,r.next),vx(n,n.next)}function a3e(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,o;if(hy(t,n))return n;do{if(hy(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const p=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=r&&p>s&&(s=p,o=n.x<n.next.x?n:n.next,p===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let d=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&GY(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const p=Math.abs(i-n.y)/(r-n.x);kS(n,t)&&(p<d||p===d&&(n.x>o.x||n.x===o.x&&l3e(o,n)))&&(o=n,d=p)}n=n.next}while(n!==a);return o}function l3e(t,e){return eo(t.prev,t,e.prev)<0&&eo(e.next,t,t.next)<0}function c3e(t,e,n,r){let i=t;do i.z===0&&(i.z=YR(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,u3e(i)}function u3e(t){let e,n=1;do{let r=t,i;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<n&&(a++,o=o.nextZ,!!o);c++);let l=n;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=o}s.nextZ=null,n*=2}while(e>1);return t}function YR(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function d3e(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function GY(t,e,n,r,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function C_(t,e,n,r,i,s,o,a){return!(t===o&&e===a)&&GY(t,e,n,r,i,s,o,a)}function f3e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!h3e(t,e)&&(kS(t,e)&&kS(e,t)&&p3e(t,e)&&(eo(t.prev,t,e.prev)||eo(t,e.prev,e))||hy(t,e)&&eo(t.prev,t,t.next)>0&&eo(e.prev,e,e.next)>0)}function eo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function hy(t,e){return t.x===e.x&&t.y===e.y}function WY(t,e,n,r){const i=uM(eo(t,e,n)),s=uM(eo(t,e,r)),o=uM(eo(n,r,t)),a=uM(eo(n,r,e));return!!(i!==s&&o!==a||i===0&&cM(t,n,e)||s===0&&cM(t,r,e)||o===0&&cM(n,t,r)||a===0&&cM(n,e,r))}function cM(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function uM(t){return t>0?1:t<0?-1:0}function h3e(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&WY(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function kS(t,e){return eo(t.prev,t,t.next)<0?eo(t,e,t.next)>=0&&eo(t,t.prev,e)>=0:eo(t,e,t.prev)<0||eo(t,t.next,e)<0}function p3e(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function $Y(t,e){const n=KR(t.i,t.x,t.y),r=KR(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function Hj(t,e,n,r){const i=KR(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function DS(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function KR(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function m3e(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class g3e{static triangulate(e,n,r=2){return Jwe(e,n,r)}}class Xd{static area(e){const n=e.length;let r=0;for(let i=n-1,s=0;s<n;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return Xd.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];Vj(e),Gj(r,e);let o=e.length;n.forEach(Vj);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,Gj(r,n[l]);const a=g3e.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function Vj(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Gj(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class NC extends wr{constructor(e=new Y0([new Ht(.5,.5),new Ht(-.5,.5),new Ht(-.5,-.5),new Ht(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const r=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Rn(i,3)),this.setAttribute("uv",new Rn(s,2)),this.computeVertexNormals();function o(a){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,d=n.steps!==void 0?n.steps:1,p=n.depth!==void 0?n.depth:1;let m=n.bevelEnabled!==void 0?n.bevelEnabled:!0,x=n.bevelThickness!==void 0?n.bevelThickness:.2,b=n.bevelSize!==void 0?n.bevelSize:x-.1,_=n.bevelOffset!==void 0?n.bevelOffset:0,S=n.bevelSegments!==void 0?n.bevelSegments:3;const w=n.extrudePath,C=n.UVGenerator!==void 0?n.UVGenerator:x3e;let A,N=!1,D,P,O,R;if(w){A=w.getSpacedPoints(d),N=!0,m=!1;const me=w.isCatmullRomCurve3?w.closed:!1;D=w.computeFrenetFrames(d,me),P=new He,O=new He,R=new He}m||(S=0,x=0,b=0,_=0);const L=a.extractPoints(c);let V=L.shape;const F=L.holes;if(!Xd.isClockWise(V)){V=V.reverse();for(let me=0,ke=F.length;me<ke;me++){const we=F[me];Xd.isClockWise(we)&&(F[me]=we.reverse())}}function W(me){const we=10000000000000001e-36;let Te=me[0];for(let oe=1;oe<=me.length;oe++){const _e=oe%me.length,Fe=me[_e],Ue=Fe.x-Te.x,Oe=Fe.y-Te.y,ue=Ue*Ue+Oe*Oe,Q=Math.max(Math.abs(Fe.x),Math.abs(Fe.y),Math.abs(Te.x),Math.abs(Te.y)),fe=we*Q*Q;if(ue<=fe){me.splice(_e,1),oe--;continue}Te=Fe}}W(V),F.forEach(W);const Y=F.length,$=V;for(let me=0;me<Y;me++){const ke=F[me];V=V.concat(ke)}function X(me,ke,we){return ke||Un("ExtrudeGeometry: vec does not exist"),me.clone().addScaledVector(ke,we)}const Z=V.length;function K(me,ke,we){let Te,oe,_e;const Fe=me.x-ke.x,Ue=me.y-ke.y,Oe=we.x-me.x,ue=we.y-me.y,Q=Fe*Fe+Ue*Ue,fe=Fe*ue-Ue*Oe;if(Math.abs(fe)>Number.EPSILON){const Se=Math.sqrt(Q),Ae=Math.sqrt(Oe*Oe+ue*ue),ve=ke.x-Ue/Se,qe=ke.y+Fe/Se,Ee=we.x-ue/Ae,Ce=we.y+Oe/Ae,Ye=((Ee-ve)*ue-(Ce-qe)*Oe)/(Fe*ue-Ue*Oe);Te=ve+Fe*Ye-me.x,oe=qe+Ue*Ye-me.y;const Ze=Te*Te+oe*oe;if(Ze<=2)return new Ht(Te,oe);_e=Math.sqrt(Ze/2)}else{let Se=!1;Fe>Number.EPSILON?Oe>Number.EPSILON&&(Se=!0):Fe<-Number.EPSILON?Oe<-Number.EPSILON&&(Se=!0):Math.sign(Ue)===Math.sign(ue)&&(Se=!0),Se?(Te=-Ue,oe=Fe,_e=Math.sqrt(Q)):(Te=Fe,oe=Ue,_e=Math.sqrt(Q/2))}return new Ht(Te/_e,oe/_e)}const ne=[];for(let me=0,ke=$.length,we=ke-1,Te=me+1;me<ke;me++,we++,Te++)we===ke&&(we=0),Te===ke&&(Te=0),ne[me]=K($[me],$[we],$[Te]);const H=[];let B,G=ne.concat();for(let me=0,ke=Y;me<ke;me++){const we=F[me];B=[];for(let Te=0,oe=we.length,_e=oe-1,Fe=Te+1;Te<oe;Te++,_e++,Fe++)_e===oe&&(_e=0),Fe===oe&&(Fe=0),B[Te]=K(we[Te],we[_e],we[Fe]);H.push(B),G=G.concat(B)}let j;if(S===0)j=Xd.triangulateShape($,F);else{const me=[],ke=[];for(let we=0;we<S;we++){const Te=we/S,oe=x*Math.cos(Te*Math.PI/2),_e=b*Math.sin(Te*Math.PI/2)+_;for(let Fe=0,Ue=$.length;Fe<Ue;Fe++){const Oe=X($[Fe],ne[Fe],_e);re(Oe.x,Oe.y,-oe),Te===0&&me.push(Oe)}for(let Fe=0,Ue=Y;Fe<Ue;Fe++){const Oe=F[Fe];B=H[Fe];const ue=[];for(let Q=0,fe=Oe.length;Q<fe;Q++){const Se=X(Oe[Q],B[Q],_e);re(Se.x,Se.y,-oe),Te===0&&ue.push(Se)}Te===0&&ke.push(ue)}}j=Xd.triangulateShape(me,ke)}const ie=j.length,ce=b+_;for(let me=0;me<Z;me++){const ke=m?X(V[me],G[me],ce):V[me];N?(O.copy(D.normals[0]).multiplyScalar(ke.x),P.copy(D.binormals[0]).multiplyScalar(ke.y),R.copy(A[0]).add(O).add(P),re(R.x,R.y,R.z)):re(ke.x,ke.y,0)}for(let me=1;me<=d;me++)for(let ke=0;ke<Z;ke++){const we=m?X(V[ke],G[ke],ce):V[ke];N?(O.copy(D.normals[me]).multiplyScalar(we.x),P.copy(D.binormals[me]).multiplyScalar(we.y),R.copy(A[me]).add(O).add(P),re(R.x,R.y,R.z)):re(we.x,we.y,p/d*me)}for(let me=S-1;me>=0;me--){const ke=me/S,we=x*Math.cos(ke*Math.PI/2),Te=b*Math.sin(ke*Math.PI/2)+_;for(let oe=0,_e=$.length;oe<_e;oe++){const Fe=X($[oe],ne[oe],Te);re(Fe.x,Fe.y,p+we)}for(let oe=0,_e=F.length;oe<_e;oe++){const Fe=F[oe];B=H[oe];for(let Ue=0,Oe=Fe.length;Ue<Oe;Ue++){const ue=X(Fe[Ue],B[Ue],Te);N?re(ue.x,ue.y+A[d-1].y,A[d-1].x+we):re(ue.x,ue.y,p+we)}}}te(),se();function te(){const me=i.length/3;if(m){let ke=0,we=Z*ke;for(let Te=0;Te<ie;Te++){const oe=j[Te];pe(oe[2]+we,oe[1]+we,oe[0]+we)}ke=d+S*2,we=Z*ke;for(let Te=0;Te<ie;Te++){const oe=j[Te];pe(oe[0]+we,oe[1]+we,oe[2]+we)}}else{for(let ke=0;ke<ie;ke++){const we=j[ke];pe(we[2],we[1],we[0])}for(let ke=0;ke<ie;ke++){const we=j[ke];pe(we[0]+Z*d,we[1]+Z*d,we[2]+Z*d)}}r.addGroup(me,i.length/3-me,0)}function se(){const me=i.length/3;let ke=0;le($,ke),ke+=$.length;for(let we=0,Te=F.length;we<Te;we++){const oe=F[we];le(oe,ke),ke+=oe.length}r.addGroup(me,i.length/3-me,1)}function le(me,ke){let we=me.length;for(;--we>=0;){const Te=we;let oe=we-1;oe<0&&(oe=me.length-1);for(let _e=0,Fe=d+S*2;_e<Fe;_e++){const Ue=Z*_e,Oe=Z*(_e+1),ue=ke+Te+Ue,Q=ke+oe+Ue,fe=ke+oe+Oe,Se=ke+Te+Oe;be(ue,Q,fe,Se)}}}function re(me,ke,we){l.push(me),l.push(ke),l.push(we)}function pe(me,ke,we){xe(me),xe(ke),xe(we);const Te=i.length/3,oe=C.generateTopUV(r,i,Te-3,Te-2,Te-1);Pe(oe[0]),Pe(oe[1]),Pe(oe[2])}function be(me,ke,we,Te){xe(me),xe(ke),xe(Te),xe(ke),xe(we),xe(Te);const oe=i.length/3,_e=C.generateSideWallUV(r,i,oe-6,oe-3,oe-2,oe-1);Pe(_e[0]),Pe(_e[1]),Pe(_e[3]),Pe(_e[1]),Pe(_e[2]),Pe(_e[3])}function xe(me){i.push(l[me*3+0]),i.push(l[me*3+1]),i.push(l[me*3+2])}function Pe(me){s.push(me.x),s.push(me.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,r=this.parameters.options;return v3e(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=n[e.shapes[s]];r.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new j5[i.type]().fromJSON(i)),new NC(r,e.options)}}const x3e={generateTopUV:function(t,e,n,r,i){const s=e[n*3],o=e[n*3+1],a=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new Ht(s,o),new Ht(a,l),new Ht(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[n*3],a=e[n*3+1],l=e[n*3+2],c=e[r*3],d=e[r*3+1],p=e[r*3+2],m=e[i*3],x=e[i*3+1],b=e[i*3+2],_=e[s*3],S=e[s*3+1],w=e[s*3+2];return Math.abs(a-d)<Math.abs(o-c)?[new Ht(o,1-l),new Ht(c,1-p),new Ht(m,1-b),new Ht(_,1-w)]:[new Ht(a,1-l),new Ht(d,1-p),new Ht(x,1-b),new Ht(S,1-w)]}};function v3e(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const s=t[r];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class RC extends Mm{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,n),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new RC(e.radius,e.detail)}}class kC extends wr{constructor(e=[new Ht(0,-.5),new Ht(.5,0),new Ht(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=lr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,p=new He,m=new Ht,x=new He,b=new He,_=new He;let S=0,w=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:S=e[C+1].x-e[C].x,w=e[C+1].y-e[C].y,x.x=w*1,x.y=-S,x.z=w*0,_.copy(x),x.normalize(),l.push(x.x,x.y,x.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:S=e[C+1].x-e[C].x,w=e[C+1].y-e[C].y,x.x=w*1,x.y=-S,x.z=w*0,b.copy(x),x.x+=_.x,x.y+=_.y,x.z+=_.z,x.normalize(),l.push(x.x,x.y,x.z),_.copy(b)}for(let C=0;C<=n;C++){const A=r+C*d*i,N=Math.sin(A),D=Math.cos(A);for(let P=0;P<=e.length-1;P++){p.x=e[P].x*N,p.y=e[P].y,p.z=e[P].x*D,o.push(p.x,p.y,p.z),m.x=C/n,m.y=P/(e.length-1),a.push(m.x,m.y);const O=l[3*P+0]*N,R=l[3*P+1],L=l[3*P+0]*D;c.push(O,R,L)}}for(let C=0;C<n;C++)for(let A=0;A<e.length-1;A++){const N=A+C*e.length,D=N,P=N+e.length,O=N+e.length+1,R=N+1;s.push(D,P,R),s.push(O,R,P)}this.setIndex(s),this.setAttribute("position",new Rn(o,3)),this.setAttribute("uv",new Rn(a,2)),this.setAttribute("normal",new Rn(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kC(e.points,e.segments,e.phiStart,e.phiLength)}}class Nw extends Mm{constructor(e=1,n=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new Nw(e.radius,e.detail)}}class Np extends wr{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,o=n/2,a=Math.floor(r),l=Math.floor(i),c=a+1,d=l+1,p=e/a,m=n/l,x=[],b=[],_=[],S=[];for(let w=0;w<d;w++){const C=w*m-o;for(let A=0;A<c;A++){const N=A*p-s;b.push(N,-C,0),_.push(0,0,1),S.push(A/a),S.push(1-w/l)}}for(let w=0;w<l;w++)for(let C=0;C<a;C++){const A=C+c*w,N=C+c*(w+1),D=C+1+c*(w+1),P=C+1+c*w;x.push(A,N,P),x.push(N,D,P)}this.setIndex(x),this.setAttribute("position",new Rn(b,3)),this.setAttribute("normal",new Rn(_,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Np(e.width,e.height,e.widthSegments,e.heightSegments)}}class DC extends wr{constructor(e=.5,n=1,r=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:o},r=Math.max(3,r),i=Math.max(1,i);const a=[],l=[],c=[],d=[];let p=e;const m=(n-e)/i,x=new He,b=new Ht;for(let _=0;_<=i;_++){for(let S=0;S<=r;S++){const w=s+S/r*o;x.x=p*Math.cos(w),x.y=p*Math.sin(w),l.push(x.x,x.y,x.z),c.push(0,0,1),b.x=(x.x/n+1)/2,b.y=(x.y/n+1)/2,d.push(b.x,b.y)}p+=m}for(let _=0;_<i;_++){const S=_*(r+1);for(let w=0;w<r;w++){const C=w+S,A=C,N=C+r+1,D=C+r+2,P=C+1;a.push(A,N,P),a.push(N,D,P)}}this.setIndex(a),this.setAttribute("position",new Rn(l,3)),this.setAttribute("normal",new Rn(c,3)),this.setAttribute("uv",new Rn(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new DC(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class PC extends wr{constructor(e=new Y0([new Ht(0,.5),new Ht(-.5,-.5),new Ht(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(a,l,d),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Rn(i,3)),this.setAttribute("normal",new Rn(s,3)),this.setAttribute("uv",new Rn(o,2));function c(d){const p=i.length/3,m=d.extractPoints(n);let x=m.shape;const b=m.holes;Xd.isClockWise(x)===!1&&(x=x.reverse());for(let S=0,w=b.length;S<w;S++){const C=b[S];Xd.isClockWise(C)===!0&&(b[S]=C.reverse())}const _=Xd.triangulateShape(x,b);for(let S=0,w=b.length;S<w;S++){const C=b[S];x=x.concat(C)}for(let S=0,w=x.length;S<w;S++){const C=x[S];i.push(C.x,C.y,0),s.push(0,0,1),o.push(C.x,C.y)}for(let S=0,w=_.length;S<w;S++){const C=_[S],A=C[0]+p,N=C[1]+p,D=C[2]+p;r.push(A,N,D),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes;return y3e(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=n[e.shapes[i]];r.push(o)}return new PC(r,e.curveSegments)}}function y3e(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}class Rw extends wr{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(o+a,Math.PI);let c=0;const d=[],p=new He,m=new He,x=[],b=[],_=[],S=[];for(let w=0;w<=r;w++){const C=[],A=w/r;let N=0;w===0&&o===0?N=.5/n:w===r&&l===Math.PI&&(N=-.5/n);for(let D=0;D<=n;D++){const P=D/n;p.x=-e*Math.cos(i+P*s)*Math.sin(o+A*a),p.y=e*Math.cos(o+A*a),p.z=e*Math.sin(i+P*s)*Math.sin(o+A*a),b.push(p.x,p.y,p.z),m.copy(p).normalize(),_.push(m.x,m.y,m.z),S.push(P+N,1-A),C.push(c++)}d.push(C)}for(let w=0;w<r;w++)for(let C=0;C<n;C++){const A=d[w][C+1],N=d[w][C],D=d[w+1][C],P=d[w+1][C+1];(w!==0||o>0)&&x.push(A,N,P),(w!==r-1||l<Math.PI)&&x.push(N,D,P)}this.setIndex(x),this.setAttribute("position",new Rn(b,3)),this.setAttribute("normal",new Rn(_,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class IC extends Mm{constructor(e=1,n=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,e,n),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new IC(e.radius,e.detail)}}class OC extends wr{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2,o=0,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s,thetaStart:o,thetaLength:a},r=Math.floor(r),i=Math.floor(i);const l=[],c=[],d=[],p=[],m=new He,x=new He,b=new He;for(let _=0;_<=r;_++){const S=o+_/r*a;for(let w=0;w<=i;w++){const C=w/i*s;x.x=(e+n*Math.cos(S))*Math.cos(C),x.y=(e+n*Math.cos(S))*Math.sin(C),x.z=n*Math.sin(S),c.push(x.x,x.y,x.z),m.x=e*Math.cos(C),m.y=e*Math.sin(C),b.subVectors(x,m).normalize(),d.push(b.x,b.y,b.z),p.push(w/i),p.push(_/r)}}for(let _=1;_<=r;_++)for(let S=1;S<=i;S++){const w=(i+1)*_+S-1,C=(i+1)*(_-1)+S-1,A=(i+1)*(_-1)+S,N=(i+1)*_+S;l.push(w,C,N),l.push(C,A,N)}this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(d,3)),this.setAttribute("uv",new Rn(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new OC(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class LC extends wr{constructor(e=1,n=.4,r=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:o},r=Math.floor(r),i=Math.floor(i);const a=[],l=[],c=[],d=[],p=new He,m=new He,x=new He,b=new He,_=new He,S=new He,w=new He;for(let A=0;A<=r;++A){const N=A/r*s*Math.PI*2;C(N,s,o,e,x),C(N+.01,s,o,e,b),S.subVectors(b,x),w.addVectors(b,x),_.crossVectors(S,w),w.crossVectors(_,S),_.normalize(),w.normalize();for(let D=0;D<=i;++D){const P=D/i*Math.PI*2,O=-n*Math.cos(P),R=n*Math.sin(P);p.x=x.x+(O*w.x+R*_.x),p.y=x.y+(O*w.y+R*_.y),p.z=x.z+(O*w.z+R*_.z),l.push(p.x,p.y,p.z),m.subVectors(p,x).normalize(),c.push(m.x,m.y,m.z),d.push(A/r),d.push(D/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;a.push(D,P,R),a.push(P,O,R)}this.setIndex(a),this.setAttribute("position",new Rn(l,3)),this.setAttribute("normal",new Rn(c,3)),this.setAttribute("uv",new Rn(d,2));function C(A,N,D,P,O){const R=Math.cos(A),L=Math.sin(A),V=D/N*A,F=Math.cos(V);O.x=P*(2+F)*.5*R,O.y=P*(2+F)*L*.5,O.z=P*Math.sin(V)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new LC(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class jC extends wr{constructor(e=new S9(new He(-1,-1,0),new He(-1,1,0),new He(1,1,0)),n=64,r=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:s};const o=e.computeFrenetFrames(n,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new He,l=new He,c=new Ht;let d=new He;const p=[],m=[],x=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new Rn(p,3)),this.setAttribute("normal",new Rn(m,3)),this.setAttribute("uv",new Rn(x,2));function _(){for(let A=0;A<n;A++)S(A);S(s===!1?n:0),C(),w()}function S(A){d=e.getPointAt(A/n,d);const N=o.normals[A],D=o.binormals[A];for(let P=0;P<=i;P++){const O=P/i*Math.PI*2,R=Math.sin(O),L=-Math.cos(O);l.x=L*N.x+R*D.x,l.y=L*N.y+R*D.y,l.z=L*N.z+R*D.z,l.normalize(),m.push(l.x,l.y,l.z),a.x=d.x+r*l.x,a.y=d.y+r*l.y,a.z=d.z+r*l.z,p.push(a.x,a.y,a.z)}}function w(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;b.push(D,P,R),b.push(P,O,R)}}function C(){for(let A=0;A<=n;A++)for(let N=0;N<=i;N++)c.x=A/n,c.y=N/i,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new jC(new j5[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class M9 extends wr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new He,s=new He;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const p=l[c],m=p.start,x=p.count;for(let b=m,_=m+x;b<_;b+=3)for(let S=0;S<3;S++){const w=a.getX(b+S),C=a.getX(b+(S+1)%3);i.fromBufferAttribute(o,w),s.fromBufferAttribute(o,C),Wj(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const d=3*a+c,p=3*a+(c+1)%3;i.fromBufferAttribute(o,d),s.fromBufferAttribute(o,p),Wj(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Wj(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var $j=Object.freeze({__proto__:null,BoxGeometry:Px,CapsuleGeometry:TC,CircleGeometry:CC,ConeGeometry:Aw,CylinderGeometry:Ew,DodecahedronGeometry:EC,EdgesGeometry:x9,ExtrudeGeometry:NC,IcosahedronGeometry:RC,LatheGeometry:kC,OctahedronGeometry:Nw,PlaneGeometry:Np,PolyhedronGeometry:Mm,RingGeometry:DC,ShapeGeometry:PC,SphereGeometry:Rw,TetrahedronGeometry:IC,TorusGeometry:OC,TorusKnotGeometry:LC,TubeGeometry:jC,WireframeGeometry:M9});class qY extends bl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Sn(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function py(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(gn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Ll(t){const e={};for(let n=0;n<t.length;n++){const r=py(t[n]);for(const i in r)e[i]=r[i]}return e}function b3e(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function XY(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ai.workingColorSpace}const PS={clone:py,merge:Ll};var _3e=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,S3e=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class uu extends bl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_3e,this.fragmentShader=S3e,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=py(e.uniforms),this.uniformsGroups=b3e(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class T9 extends uu{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class C9 extends bl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Sn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cu,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class YY extends C9{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ht(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return lr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Sn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Sn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Sn(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class KY extends bl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Sn(16777215),this.specular=new Sn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cu,this.combine=Mw,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ZY extends bl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Sn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class QY extends bl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class JY extends bl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Sn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cu,this.combine=Mw,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zC extends bl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=hY,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class FC extends bl{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class eK extends bl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Sn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wm,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tK extends Xl{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Bg(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function nK(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function ZR(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function E9(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push(...o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function w3e(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],d=c.getValueSize(),p=[],m=[];for(let x=0;x<c.times.length;++x){const b=c.times[x]*i;if(!(b<n||b>=r)){p.push(c.times[x]);for(let _=0;_<d;++_)m.push(c.values[x*d+_])}}p.length!==0&&(c.times=Bg(p,c.times.constructor),c.values=Bg(m,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function M3e(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const a=n.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(w){return w.name===a.name&&w.ValueTypeName===l});if(c===void 0)continue;let d=0;const p=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);let m=0;const x=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=x/3);const b=a.times.length-1;let _;if(s<=a.times[0]){const w=d,C=p-d;_=a.values.slice(w,C)}else if(s>=a.times[b]){const w=b*p+d,C=w+p-d;_=a.values.slice(w,C)}else{const w=a.createInterpolant(),C=d,A=p-d;w.evaluate(s),_=w.resultBuffer.slice(C,A)}l==="quaternion"&&new $a().fromArray(_).normalize().conjugate().toArray(_);const S=c.times.length;for(let w=0;w<S;++w){const C=w*x+m;if(l==="quaternion")$a.multiplyQuaternionsFlat(c.values,C,_,0,c.values,C);else{const A=x-m*2;for(let N=0;N<A;++N)c.values[C+N]-=_[N]}}}return t.blendMode=a9,t}class T3e{static convertArray(e,n){return Bg(e,n)}static isTypedArray(e){return SY(e)}static getKeyframeOrder(e){return nK(e)}static sortedArray(e,n,r){return ZR(e,n,r)}static flattenJSON(e,n,r,i){E9(e,n,r,i)}static subclip(e,n,r,i,s=30){return w3e(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return M3e(e,n,r,i)}}class Fy{constructor(e,n,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const n=this.parameterPositions;let r=this._cachedIndex,i=n[r],s=n[r-1];e:{t:{let o;n:{r:if(!(e<i)){for(let a=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(s=i,i=n[++r],e<i)break t}o=n.length;break n}if(!(e>=s)){const a=n[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(i=s,s=n[--r-1],e>=s)break t}o=r,r=0;break n}break e}for(;r<o;){const a=r+o>>>1;e<n[a]?o=a:r=a+1}if(i=n[r],s=n[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)n[o]=r[s+o];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class rK extends Fy{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Fg,endingEnd:Fg}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ug:s=e,a=2*n-r;break;case MS:s=i.length-2,a=n+i[s]-i[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Ug:o=e,l=2*r-n;break;case MS:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=this._offsetPrev,p=this._offsetNext,m=this._weightPrev,x=this._weightNext,b=(r-n)/(i-n),_=b*b,S=_*b,w=-m*S+2*m*_-m*b,C=(1+m)*S+(-1.5-2*m)*_+(-.5+m)*b+1,A=(-1-x)*S+(1.5+x)*_+.5*b,N=x*S-x*_;for(let D=0;D!==a;++D)s[D]=w*o[d+D]+C*o[c+D]+A*o[l+D]+N*o[p+D];return s}}class A9 extends Fy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=(r-n)/(i-n),p=1-d;for(let m=0;m!==a;++m)s[m]=o[c+m]*p+o[l+m]*d;return s}}class iK extends Fy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class sK extends Fy{interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=this.settings||this.DefaultSettings_,p=d.inTangents,m=d.outTangents;if(!p||!m){const _=(r-n)/(i-n),S=1-_;for(let w=0;w!==a;++w)s[w]=o[c+w]*S+o[l+w]*_;return s}const x=a*2,b=e-1;for(let _=0;_!==a;++_){const S=o[c+_],w=o[l+_],C=b*x+_*2,A=m[C],N=m[C+1],D=e*x+_*2,P=p[D],O=p[D+1];let R=(r-n)/(i-n),L,V,F,U,W;for(let Y=0;Y<8;Y++){L=R*R,V=L*R,F=1-R,U=F*F,W=U*F;const X=W*n+3*U*R*A+3*F*L*P+V*i-r;if(Math.abs(X)<1e-10)break;const Z=3*U*(A-n)+6*F*R*(P-A)+3*L*(i-P);if(Math.abs(Z)<1e-10)break;R=R-X/Z,R=Math.max(0,Math.min(1,R))}s[_]=W*S+3*U*R*N+3*F*L*O+V*w}return s}}class ud{constructor(e,n,r,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(n===void 0||n.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Bg(n,this.TimeBufferType),this.values=Bg(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const n=e.constructor;let r;if(n.toJSON!==this.toJSON)r=n.toJSON(e);else{r={name:e.name,times:Bg(e.times,Array),values:Bg(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new iK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new A9(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new rK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new sK(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case wS:n=this.InterpolantFactoryMethodDiscrete;break;case I5:n=this.InterpolantFactoryMethodLinear;break;case WM:n=this.InterpolantFactoryMethodSmooth;break;case WR:n=this.InterpolantFactoryMethodBezier;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return gn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return wS;case this.InterpolantFactoryMethodLinear:return I5;case this.InterpolantFactoryMethodSmooth:return WM;case this.InterpolantFactoryMethodBezier:return WR}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(Un("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(Un("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){Un("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Un("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&SY(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){Un("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===WM,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],d=e[a+1];if(c!==d&&(a!==1||c!==e[0]))if(i)l=!0;else{const p=a*r,m=p-r,x=p+r;for(let b=0;b!==r;++b){const _=n[p+b];if(_!==n[m+b]||_!==n[x+b]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const p=a*r,m=o*r;for(let x=0;x!==r;++x)n[m+x]=n[p+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}ud.prototype.ValueTypeName="";ud.prototype.TimeBufferType=Float32Array;ud.prototype.ValueBufferType=Float32Array;ud.prototype.DefaultInterpolation=I5;class Ix extends ud{constructor(e,n,r){super(e,n,r)}}Ix.prototype.ValueTypeName="bool";Ix.prototype.ValueBufferType=Array;Ix.prototype.DefaultInterpolation=wS;Ix.prototype.InterpolantFactoryMethodLinear=void 0;Ix.prototype.InterpolantFactoryMethodSmooth=void 0;class N9 extends ud{constructor(e,n,r,i){super(e,n,r,i)}}N9.prototype.ValueTypeName="color";class IS extends ud{constructor(e,n,r,i){super(e,n,r,i)}}IS.prototype.ValueTypeName="number";class oK extends Fy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)$a.slerpFlat(s,0,o,c-a,o,c,l);return s}}class kw extends ud{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new oK(this.times,this.values,this.getValueSize(),e)}}kw.prototype.ValueTypeName="quaternion";kw.prototype.InterpolantFactoryMethodSmooth=void 0;class Ox extends ud{constructor(e,n,r){super(e,n,r)}}Ox.prototype.ValueTypeName="string";Ox.prototype.ValueBufferType=Array;Ox.prototype.DefaultInterpolation=wS;Ox.prototype.InterpolantFactoryMethodLinear=void 0;Ox.prototype.InterpolantFactoryMethodSmooth=void 0;class OS extends ud{constructor(e,n,r,i){super(e,n,r,i)}}OS.prototype.ValueTypeName="vector";class LS{constructor(e="",n=-1,r=[],i=pC){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=au(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(E3e(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=r.length;s!==o;++s)n.push(ud.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const d=nK(l);l=ZR(l,1,d),c=ZR(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new IS(".morphTargetInfluences["+n[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,n){let r=e;if(!Array.isArray(e)){const i=e;r=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<r.length;i++)if(r[i].name===n)return r[i];return null}static CreateClipsFromMorphTargetSequences(e,n,r){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],d=c.name.match(s);if(d&&d.length>1){const p=d[1];let m=i[p];m||(i[p]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(gn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Un("AnimationClip: No animation in JSONLoader data."),null;const r=function(p,m,x,b,_){if(x.length!==0){const S=[],w=[];E9(x,S,w,b),S.length!==0&&_.push(new p(m,S,w))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let p=0;p<c.length;p++){const m=c[p].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const x={};let b;for(b=0;b<m.length;b++)if(m[b].morphTargets)for(let _=0;_<m[b].morphTargets.length;_++)x[m[b].morphTargets[_]]=-1;for(const _ in x){const S=[],w=[];for(let C=0;C!==m[b].morphTargets.length;++C){const A=m[b];S.push(A.time),w.push(A.morphTarget===_?1:0)}i.push(new IS(".morphTargetInfluence["+_+"]",S,w))}l=x.length*o}else{const x=".bones["+n[p].name+"]";r(OS,x+".position",m,"pos",i),r(kw,x+".quaternion",m,"rot",i),r(OS,x+".scale",m,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let n=0;for(let r=0,i=e.length;r!==i;++r){const s=this.tracks[r];n=Math.max(n,s.times[s.times.length-1])}return this.duration=n,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let n=0;n<this.tracks.length;n++)e=e&&this.tracks[n].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let r=0;r<this.tracks.length;r++)e.push(this.tracks[r].clone());const n=new this.constructor(this.name,this.duration,e,this.blendMode);return n.userData=JSON.parse(JSON.stringify(this.userData)),n}toJSON(){return this.constructor.toJSON(this)}}function C3e(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return IS;case"vector":case"vector2":case"vector3":case"vector4":return OS;case"color":return N9;case"quaternion":return kw;case"bool":case"boolean":return Ix;case"string":return Ox}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function E3e(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=C3e(t.type);if(t.times===void 0){const n=[],r=[];E9(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const eh={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(qj(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!qj(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function qj(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class R9{constructor(e,n,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this._abortController=null,this.itemStart=function(d){a++,s===!1&&i.onStart!==void 0&&i.onStart(d,o,a),s=!0},this.itemEnd=function(d){o++,i.onProgress!==void 0&&i.onProgress(d,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,p){return c.push(d,p),this},this.removeHandler=function(d){const p=c.indexOf(d);return p!==-1&&c.splice(p,2),this},this.getHandler=function(d){for(let p=0,m=c.length;p<m;p+=2){const x=c[p],b=c[p+1];if(x.global&&(x.lastIndex=0),x.test(d))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const aK=new R9;class Pc{constructor(e){this.manager=e!==void 0?e:aK,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,n){const r=this;return new Promise(function(i,s){r.load(e,i,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Pc.DEFAULT_MATERIAL_NAME="__DEFAULT";const Jh={};class A3e extends Error{constructor(e,n){super(e),this.response=n}}class Sp extends Pc{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=eh.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Jh[e]!==void 0){Jh[e].push({onLoad:n,onProgress:r,onError:i});return}Jh[e]=[],Jh[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&gn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Jh[e],p=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),x=m?parseInt(m):0,b=x!==0;let _=0;const S=new ReadableStream({start(w){C();function C(){p.read().then(({done:A,value:N})=>{if(A)w.close();else{_+=N.byteLength;const D=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:x});for(let P=0,O=d.length;P<O;P++){const R=d[P];R.onProgress&&R.onProgress(D)}w.enqueue(N),C()}},A=>{w.error(A)})}}});return new Response(S)}else throw new A3e(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a==="")return c.text();{const p=/charset="?([^;"\s]*)"?/i.exec(a),m=p&&p[1]?p[1].toLowerCase():void 0,x=new TextDecoder(m);return c.arrayBuffer().then(b=>x.decode(b))}}}).then(c=>{eh.add(`file:${e}`,c);const d=Jh[e];delete Jh[e];for(let p=0,m=d.length;p<m;p++){const x=d[p];x.onLoad&&x.onLoad(c)}}).catch(c=>{const d=Jh[e];if(d===void 0)throw this.manager.itemError(e),c;delete Jh[e];for(let p=0,m=d.length;p<m;p++){const x=d[p];x.onError&&x.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class N3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Sp(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=LS.parse(e[r]);n.push(i)}return n}}class R3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new MC,l=new Sp(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function d(p){l.load(e[p],function(m){const x=s.parse(m,!0);o[p]={width:x.width,height:x.height,format:x.format,mipmaps:x.mipmaps},c+=1,c===6&&(x.mipmapCount===1&&(a.minFilter=rs),a.image=o,a.format=x.format,a.needsUpdate=!0,n&&n(a))},r,i)}if(Array.isArray(e))for(let p=0,m=e.length;p<m;++p)d(p);else l.load(e,function(p){const m=s.parse(p,!0);if(m.isCubemap){const x=m.mipmaps.length/m.mipmapCount;for(let b=0;b<x;b++){o[b]={mipmaps:[]};for(let _=0;_<m.mipmapCount;_++)o[b].mipmaps.push(m.mipmaps[b*m.mipmapCount+_]),o[b].format=m.format,o[b].width=m.width,o[b].height=m.height}a.image=o}else a.image.width=m.width,a.image.height=m.height,a.mipmaps=m.mipmaps;m.mipmapCount===1&&(a.minFilter=rs),a.format=m.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}const Kv=new WeakMap;class jS extends Pc{constructor(e){super(e)}load(e,n,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=eh.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0);else{let p=Kv.get(o);p===void 0&&(p=[],Kv.set(o,p)),p.push({onLoad:n,onError:i})}return o}const a=ES("img");function l(){d(),n&&n(this);const p=Kv.get(this)||[];for(let m=0;m<p.length;m++){const x=p[m];x.onLoad&&x.onLoad(this)}Kv.delete(this),s.manager.itemEnd(e)}function c(p){d(),i&&i(p),eh.remove(`image:${e}`);const m=Kv.get(this)||[];for(let x=0;x<m.length;x++){const b=m[x];b.onError&&b.onError(p)}Kv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),eh.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class k3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=new Cw;s.colorSpace=pl;const o=new jS(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(d){s.images[c]=d,a++,a===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class D3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Yd,a=new Sp(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(d){if(i!==void 0)i(d);else{d(d);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Ec,o.wrapT=c.wrapT!==void 0?c.wrapT:Ec,o.magFilter=c.magFilter!==void 0?c.magFilter:rs,o.minFilter=c.minFilter!==void 0?c.minFilter:rs,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Jf),c.mipmapCount===1&&(o.minFilter=rs),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class P3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=new ro,o=new jS(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class Tm extends _i{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Sn(e),this.intensity=n}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,n}}class lK extends Tm{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(_i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Sn(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}toJSON(e){const n=super.toJSON(e);return n.object.groundColor=this.groundColor.getHex(),n}}const R6=new sr,Xj=new He,Yj=new He;class k9{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ht(512,512),this.mapType=Bl,this.map=null,this.mapPass=null,this.matrix=new sr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zy,this._frameExtents=new Ht(1,1),this._viewportCount=1,this._viewports=[new fi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;Xj.setFromMatrixPosition(e.matrixWorld),n.position.copy(Xj),Yj.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(Yj),n.updateMatrixWorld(),R6.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(R6,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===gx||n.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(R6)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const dM=new He,fM=new $a,If=new He;class UC extends _i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new sr,this.projectionMatrix=new sr,this.projectionMatrixInverse=new sr,this.coordinateSystem=tu,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(dM,fM,If),If.x===1&&If.y===1&&If.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(dM,fM,If.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(dM,fM,If),If.x===1&&If.y===1&&If.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(dM,fM,If.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const T0=new He,Kj=new Ht,Zj=new Ht;class Js extends UC{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=uy*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(tx*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return uy*2*Math.atan(Math.tan(tx*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){T0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(T0.x,T0.y).multiplyScalar(-e/T0.z),T0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(T0.x,T0.y).multiplyScalar(-e/T0.z)}getViewSize(e,n){return this.getViewBounds(e,Kj,Zj),n.subVectors(Zj,Kj)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(tx*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class I3e extends k9{constructor(){super(new Js(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=uy*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||n.far;(r!==n.fov||i!==n.aspect||s!==n.far)&&(n.fov=r,n.aspect=i,n.far=s,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class cK extends Tm{constructor(e,n,r=0,i=Math.PI/3,s=0,o=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(_i.DEFAULT_UP),this.updateMatrix(),this.target=new _i,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new I3e}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.distance=this.distance,n.object.angle=this.angle,n.object.decay=this.decay,n.object.penumbra=this.penumbra,n.object.target=this.target.uuid,this.map&&this.map.isTexture&&(n.object.map=this.map.toJSON(e).uuid),n.object.shadow=this.shadow.toJSON(),n}}class O3e extends k9{constructor(){super(new Js(90,1,.5,500)),this.isPointLightShadow=!0}}class uK extends Tm{constructor(e,n,r=0,i=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new O3e}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.distance=this.distance,n.object.decay=this.decay,n.object.shadow=this.shadow.toJSON(),n}}class Kd extends UC{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class L3e extends k9{constructor(){super(new Kd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class dK extends Tm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(_i.DEFAULT_UP),this.updateMatrix(),this.target=new _i,this.shadow=new L3e}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class fK extends Tm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class hK extends Tm{constructor(e,n,r=10,i=10){super(e,n),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const n=super.toJSON(e);return n.object.width=this.width,n.object.height=this.height,n}}class D9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new He)}set(e){for(let n=0;n<9;n++)this.coefficients[n].copy(e[n]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.282095),n.addScaledVector(o[1],.488603*i),n.addScaledVector(o[2],.488603*s),n.addScaledVector(o[3],.488603*r),n.addScaledVector(o[4],1.092548*(r*i)),n.addScaledVector(o[5],1.092548*(i*s)),n.addScaledVector(o[6],.315392*(3*s*s-1)),n.addScaledVector(o[7],1.092548*(r*s)),n.addScaledVector(o[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.886227),n.addScaledVector(o[1],2*.511664*i),n.addScaledVector(o[2],2*.511664*s),n.addScaledVector(o[3],2*.511664*r),n.addScaledVector(o[4],2*.429043*r*i),n.addScaledVector(o[5],2*.429043*i*s),n.addScaledVector(o[6],.743125*s*s-.247708),n.addScaledVector(o[7],2*.429043*r*s),n.addScaledVector(o[8],.429043*(r*r-i*i)),n}add(e){for(let n=0;n<9;n++)this.coefficients[n].add(e.coefficients[n]);return this}addScaledSH(e,n){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],n);return this}scale(e){for(let n=0;n<9;n++)this.coefficients[n].multiplyScalar(e);return this}lerp(e,n){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],n);return this}equals(e){for(let n=0;n<9;n++)if(!this.coefficients[n].equals(e.coefficients[n]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,n+i*3);return this}toArray(e=[],n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,n+i*3);return e}static getBasisAt(e,n){const r=e.x,i=e.y,s=e.z;n[0]=.282095,n[1]=.488603*i,n[2]=.488603*s,n[3]=.488603*r,n[4]=1.092548*r*i,n[5]=1.092548*i*s,n[6]=.315392*(3*s*s-1),n[7]=1.092548*r*s,n[8]=.546274*(r*r-i*i)}}class pK extends Tm{constructor(e=new D9,n=1){super(void 0,n),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const n=super.toJSON(e);return n.object.sh=this.sh.toArray(),n}}class BC extends Pc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new Sp(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&gn("MaterialLoader: Undefined texture",s),n[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Sn().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new Sn().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ht().fromArray(o.value);break;case"v3":i.uniforms[s].value=new He().fromArray(o.value);break;case"v4":i.uniforms[s].value=new fi().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Sr().fromArray(o.value);break;case"m4":i.uniforms[s].value=new sr().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ht().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ht().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return BC.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:qY,SpriteMaterial:h9,RawShaderMaterial:T9,ShaderMaterial:uu,PointsMaterial:m9,MeshPhysicalMaterial:YY,MeshStandardMaterial:C9,MeshPhongMaterial:KY,MeshToonMaterial:ZY,MeshNormalMaterial:QY,MeshLambertMaterial:JY,MeshDepthMaterial:zC,MeshDistanceMaterial:FC,MeshBasicMaterial:Ap,MeshMatcapMaterial:eK,LineDashedMaterial:tK,LineBasicMaterial:Xl,Material:bl};return new n[e]}}class QR{static extractUrlBase(e){const n=e.lastIndexOf("/");return n===-1?"./":e.slice(0,n+1)}static resolveURL(e,n){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(n)&&/^\//.test(e)&&(n=n.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:n+e)}}class HC extends wr{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class mK extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Sp(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(x,b){if(n[b]!==void 0)return n[b];const S=x.interleavedBuffers[b],w=s(x,S.buffer),C=f1(S.type,w),A=new _C(C,S.stride);return A.uuid=S.uuid,n[b]=A,A}function s(x,b){if(r[b]!==void 0)return r[b];const S=x.arrayBuffers[b],w=new Uint32Array(S).buffer;return r[b]=w,w}const o=e.isInstancedBufferGeometry?new HC:new wr,a=e.data.index;if(a!==void 0){const x=f1(a.type,a.array);o.setIndex(new Wi(x,1))}const l=e.data.attributes;for(const x in l){const b=l[x];let _;if(b.isInterleavedBufferAttribute){const S=i(e.data,b.data);_=new nu(S,b.itemSize,b.offset,b.normalized)}else{const S=f1(b.type,b.array),w=b.isInstancedBufferAttribute?xx:Wi;_=new w(S,b.itemSize,b.normalized)}b.name!==void 0&&(_.name=b.name),b.usage!==void 0&&_.setUsage(b.usage),o.setAttribute(x,_)}const c=e.data.morphAttributes;if(c)for(const x in c){const b=c[x],_=[];for(let S=0,w=b.length;S<w;S++){const C=b[S];let A;if(C.isInterleavedBufferAttribute){const N=i(e.data,C.data);A=new nu(N,C.itemSize,C.offset,C.normalized)}else{const N=f1(C.type,C.array);A=new Wi(N,C.itemSize,C.normalized)}C.name!==void 0&&(A.name=C.name),_.push(A)}o.morphAttributes[x]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(let x=0,b=p.length;x!==b;++x){const _=p[x];o.addGroup(_.start,_.count,_.materialIndex)}const m=e.data.boundingSphere;return m!==void 0&&(o.boundingSphere=new Wo().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class j3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?QR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Sp(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(p){i!==void 0&&i(p),p("ObjectLoader: Can't parse "+e+".",p.message);return}const d=c.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Un("ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?QR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Sp(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,n);let a;try{a=JSON.parse(o)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(a)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){n!==void 0&&n(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,r),d=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,d),this.bindLightTargets(c),n!==void 0){let p=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){p=!0;break}p===!1&&n(c)}return c}async parseAsync(e){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,n),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const n={};if(e!==void 0)for(let r=0,i=e.length;r<i;r++){const s=new Y0().fromJSON(e[r]);n[s.uuid]=s}return n}parseSkeletons(e,n){const r={},i={};if(n.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new SC().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new mK;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;default:l.type in $j?a=$j[l.type].fromJSON(l,n):gn(`ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),r[l.uuid]=a}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new BC;s.setTextures(n);for(let o=0,a=e.length;o<a;o++){const l=e[o];r[l.uuid]===void 0&&(r[l.uuid]=s.parse(l)),i[l.uuid]=r[l.uuid]}}return i}parseAnimations(e){const n={};if(e!==void 0)for(let r=0;r<e.length;r++){const i=e[r],s=LS.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function o(l){return r.manager.itemStart(l),s.load(l,function(){r.manager.itemEnd(l)},void 0,function(){r.manager.itemError(l),r.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(d)}else return l.data?{data:f1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new R9(n);s=new jS(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c<d;c++){const p=e[c],m=p.url;if(Array.isArray(m)){const x=[];for(let b=0,_=m.length;b<_;b++){const S=m[b],w=a(S);w!==null&&(w instanceof HTMLImageElement?x.push(w):x.push(new Yd(w.data,w.width,w.height)))}i[p.uuid]=new $0(x)}else{const x=a(p.url);i[p.uuid]=new $0(x)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:n.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:f1(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new jS(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const d=[];for(let p=0,m=c.length;p<m;p++){const x=c[p],b=await s(x);b!==null&&(b instanceof HTMLImageElement?d.push(b):d.push(new Yd(b.data,b.width,b.height)))}r[l.uuid]=new $0(d)}else{const d=await s(l.url);r[l.uuid]=new $0(d)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(gn("ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&gn('ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&gn("ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let d;Array.isArray(c)?(d=new Cw,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Yd:d=new ro,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=a.uuid,a.name!==void 0&&(d.name=a.name),a.mapping!==void 0&&(d.mapping=r(a.mapping,z3e)),a.channel!==void 0&&(d.channel=a.channel),a.offset!==void 0&&d.offset.fromArray(a.offset),a.repeat!==void 0&&d.repeat.fromArray(a.repeat),a.center!==void 0&&d.center.fromArray(a.center),a.rotation!==void 0&&(d.rotation=a.rotation),a.wrap!==void 0&&(d.wrapS=r(a.wrap[0],Qj),d.wrapT=r(a.wrap[1],Qj)),a.format!==void 0&&(d.format=a.format),a.internalFormat!==void 0&&(d.internalFormat=a.internalFormat),a.type!==void 0&&(d.type=a.type),a.colorSpace!==void 0&&(d.colorSpace=a.colorSpace),a.minFilter!==void 0&&(d.minFilter=r(a.minFilter,Jj)),a.magFilter!==void 0&&(d.magFilter=r(a.magFilter,Jj)),a.anisotropy!==void 0&&(d.anisotropy=a.anisotropy),a.flipY!==void 0&&(d.flipY=a.flipY),a.generateMipmaps!==void 0&&(d.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(d.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(d.compareFunction=a.compareFunction),a.userData!==void 0&&(d.userData=a.userData),i[a.uuid]=d}return i}parseObject(e,n,r,i,s){let o;function a(m){return n[m]===void 0&&gn("ObjectLoader: Undefined geometry",m),n[m]}function l(m){if(m!==void 0){if(Array.isArray(m)){const x=[];for(let b=0,_=m.length;b<_;b++){const S=m[b];r[S]===void 0&&gn("ObjectLoader: Undefined material",S),x.push(r[S])}return x}return r[m]===void 0&&gn("ObjectLoader: Undefined material",m),r[m]}}function c(m){return i[m]===void 0&&gn("ObjectLoader: Undefined texture",m),i[m]}let d,p;switch(e.type){case"Scene":o=new u9,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Sn(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new bC(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new yC(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Js(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Kd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new fK(e.color,e.intensity);break;case"DirectionalLight":o=new dK(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new uK(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new hK(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new cK(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new lK(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new D9().fromArray(e.sh);o=new pK(m,e.intensity);break;case"SkinnedMesh":d=a(e.geometry),p=l(e.material),o=new kY(d,p),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=a(e.geometry),p=l(e.material),o=new Fs(d,p);break;case"InstancedMesh":d=a(e.geometry),p=l(e.material);const x=e.count,b=e.instanceMatrix,_=e.instanceColor;o=new DY(d,p,x),o.instanceMatrix=new xx(new Float32Array(b.array),16),_!==void 0&&(o.instanceColor=new xx(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":d=a(e.geometry),p=l(e.material),o=new PY(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,p),o.geometry=d,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(S=>{let w=null,C=null;return S.boundingBox!==void 0&&(w=new Eo().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(C=new Wo().fromJSON(S.boundingSphere)),{...S,boundingBox:w,boundingSphere:C}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=c(e.matricesTexture.uuid),o._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Wo().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Eo().fromJSON(e.boundingBox));break;case"LOD":o=new RY;break;case"Line":o=new cm(a(e.geometry),l(e.material));break;case"LineLoop":o=new IY(a(e.geometry),l(e.material));break;case"LineSegments":o=new bh(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new OY(a(e.geometry),l(e.material));break;case"Sprite":o=new NY(l(e.material));break;case"Group":o=new h1;break;case"Bone":o=new p9;break;default:o=new _i}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.pivot!==void 0&&(o.pivot=new He().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.static!==void 0&&(o.static=e.static),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let x=0;x<m.length;x++)o.add(this.parseObject(m[x],n,r,i,s))}if(e.animations!==void 0){const m=e.animations;for(let x=0;x<m.length;x++){const b=m[x];o.animations.push(s[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let x=0;x<m.length;x++){const b=m[x],_=o.getObjectByProperty("uuid",b.object);_!==void 0&&o.addLevel(_,b.distance,b.hysteresis)}}return o}bindSkeletons(e,n){Object.keys(n).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const i=n[r.skeleton];i===void 0?gn("ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(i,r.bindMatrix)}})}bindLightTargets(e){e.traverse(function(n){if(n.isDirectionalLight||n.isSpotLight){const r=n.target,i=e.getObjectByProperty("uuid",r);i!==void 0?n.target=i:n.target=new _i}})}}const z3e={UVMapping:aC,CubeReflectionMapping:ch,CubeRefractionMapping:om,EquirectangularReflectionMapping:B_,EquirectangularRefractionMapping:H_,CubeUVReflectionMapping:jy},Qj={RepeatWrapping:_S,ClampToEdgeWrapping:Ec,MirroredRepeatWrapping:SS},Jj={NearestFilter:Co,NearestMipmapNearestFilter:e9,NearestMipmapLinearFilter:d1,LinearFilter:rs,LinearMipmapNearestFilter:V_,LinearMipmapLinearFilter:Jf},k6=new WeakMap;class F3e extends Pc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&gn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&gn("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=eh.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{if(k6.has(o)===!0)i&&i(k6.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return n&&n(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return eh.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),k6.set(l,c),eh.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});eh.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let hM;class P9{static getContext(){return hM===void 0&&(hM=new(window.AudioContext||window.webkitAudioContext)),hM}static setContext(e){hM=e}}class U3e extends Pc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Sp(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);P9.getContext().decodeAudioData(c,function(p){n(p)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):Un(l),s.manager.itemError(e)}}}const ez=new sr,tz=new sr,yg=new sr;class B3e{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Js,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Js,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,yg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(tx*n.fov*.5)/n.zoom;let a,l;tz.elements[12]=-i,ez.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,yg.elements[0]=2*n.near/(l-a),yg.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(yg),a=-o*n.aspect-s,l=o*n.aspect-s,yg.elements[0]=2*n.near/(l-a),yg.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(yg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(tz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(ez)}}const Zv=-90,Qv=1;class gK extends _i{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Js(Zv,Qv,e,n);i.layers=this.layers,this.add(i);const s=new Js(Zv,Qv,e,n);s.layers=this.layers,this.add(s);const o=new Js(Zv,Qv,e,n);o.layers=this.layers,this.add(o);const a=new Js(Zv,Qv,e,n);a.layers=this.layers,this.add(a);const l=new Js(Zv,Qv,e,n);l.layers=this.layers,this.add(l);const c=new Js(Zv,Qv,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===tu)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===gx)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,p=e.getRenderTarget(),m=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(r,0,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,s),e.setRenderTarget(r,1,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(r,2,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(r,3,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),e.setRenderTarget(r,4,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,d),e.setRenderTarget(p,m,x),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class xK extends Js{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class vK{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=H3e.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function H3e(){this._document.hidden===!1&&this.reset()}const bg=new He,D6=new $a,V3e=new He,_g=new He,Sg=new He;class G3e extends _i{constructor(){super(),this.type="AudioListener",this.context=P9.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new vK}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const n=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(bg,D6,V3e),_g.set(0,0,-1).applyQuaternion(D6),Sg.set(0,1,0).applyQuaternion(D6),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(bg.x,r),n.positionY.linearRampToValueAtTime(bg.y,r),n.positionZ.linearRampToValueAtTime(bg.z,r),n.forwardX.linearRampToValueAtTime(_g.x,r),n.forwardY.linearRampToValueAtTime(_g.y,r),n.forwardZ.linearRampToValueAtTime(_g.z,r),n.upX.linearRampToValueAtTime(Sg.x,r),n.upY.linearRampToValueAtTime(Sg.y,r),n.upZ.linearRampToValueAtTime(Sg.z,r)}else n.setPosition(bg.x,bg.y,bg.z),n.setOrientation(_g.x,_g.y,_g.z,Sg.x,Sg.y,Sg.z)}}class yK extends _i{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){gn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){gn("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){gn("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){gn("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){gn("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(gn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){gn("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,n){return super.copy(e,n),e.sourceType!=="buffer"?(gn("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const wg=new He,nz=new $a,W3e=new He,Mg=new He;class $3e extends yK{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,n,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=n,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(wg,nz,W3e),Mg.set(0,0,1).applyQuaternion(nz);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(wg.x,r),n.positionY.linearRampToValueAtTime(wg.y,r),n.positionZ.linearRampToValueAtTime(wg.z,r),n.orientationX.linearRampToValueAtTime(Mg.x,r),n.orientationY.linearRampToValueAtTime(Mg.y,r),n.orientationZ.linearRampToValueAtTime(Mg.z,r)}else n.setPosition(wg.x,wg.y,wg.z),n.setOrientation(Mg.x,Mg.y,Mg.z)}}class q3e{constructor(e,n=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const n=this.getFrequencyData();for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}}class bK{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,o;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,n){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=n}else{o+=n;const a=n/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const n=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(n,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const n=this.valueSize,r=this.buffer,i=e*n+n,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r<n;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,n=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[n+r]=this.buffer[e+r]}_select(e,n,r,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){$a.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;$a.multiplyQuaternionsFlat(e,o,e,n,e,r),$a.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const I9="\\[\\]\\.:\\/",X3e=new RegExp("["+I9+"]","g"),O9="[^"+I9+"]",Y3e="[^"+I9.replace("\\.","")+"]",K3e=/((?:WC+[\/:])*)/.source.replace("WC",O9),Z3e=/(WCOD+)?/.source.replace("WCOD",Y3e),Q3e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",O9),J3e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",O9),e4e=new RegExp("^"+K3e+Z3e+Q3e+J3e+"$"),t4e=["material","materials","bones","map"];class n4e{constructor(e,n,r){const i=r||yi.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class yi{constructor(e,n,r){this.path=n,this.parsedPath=r||yi.parseTrackName(n),this.node=yi.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new yi.Composite(e,n,r):new yi(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(X3e,"")}static parseTrackName(e){const n=e4e.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);t4e.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===n||a.uuid===n)return a;const l=r(a.children);if(l)return l}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)e[n++]=r[i]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++]}_setValue_array_setNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node;const n=this.parsedPath,r=n.objectName,i=n.propertyName;let s=n.propertyIndex;if(e||(e=yi.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){gn("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){Un("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Un("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Un("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===c){c=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Un("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Un("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){Un("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){Un("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=n.nodeName;Un("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Un("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Un("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}yi.Composite=n4e;yi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};yi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};yi.prototype.GetterByBindingType=[yi.prototype._getValue_direct,yi.prototype._getValue_array,yi.prototype._getValue_arrayElement,yi.prototype._getValue_toArray];yi.prototype.SetterByBindingTypeAndVersioning=[[yi.prototype._setValue_direct,yi.prototype._setValue_direct_setNeedsUpdate,yi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_array,yi.prototype._setValue_array_setNeedsUpdate,yi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_arrayElement,yi.prototype._setValue_arrayElement_setNeedsUpdate,yi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_fromArray,yi.prototype._setValue_fromArray_setNeedsUpdate,yi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class r4e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=au(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}add(){const e=this._objects,n=this._indicesByUUID,r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let d=0,p=arguments.length;d!==p;++d){const m=arguments[d],x=m.uuid;let b=n[x];if(b===void 0){b=l++,n[x]=b,e.push(m);for(let _=0,S=o;_!==S;++_)s[_].push(new yi(m,r[_],i[_]))}else if(b<c){a=e[b];const _=--c,S=e[_];n[S.uuid]=b,e[b]=S,n[x]=_,e[_]=m;for(let w=0,C=o;w!==C;++w){const A=s[w],N=A[_];let D=A[b];A[b]=N,D===void 0&&(D=new yi(m,r[w],i[w])),A[_]=D}}else e[b]!==a&&Un("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,d=n[c];if(d!==void 0&&d>=s){const p=s++,m=e[p];n[m.uuid]=d,e[d]=m,n[c]=p,e[p]=l;for(let x=0,b=i;x!==b;++x){const _=r[x],S=_[p],w=_[d];_[d]=S,_[p]=w}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,p=n[d];if(p!==void 0)if(delete n[d],p<s){const m=--s,x=e[m],b=--o,_=e[b];n[x.uuid]=p,e[p]=x,n[_.uuid]=m,e[m]=_,e.pop();for(let S=0,w=i;S!==w;++S){const C=r[S],A=C[m],N=C[b];C[p]=A,C[m]=N,C.pop()}}else{const m=--o,x=e[m];m>0&&(n[x.uuid]=p),e[p]=x,e.pop();for(let b=0,_=i;b!==_;++b){const S=r[b];S[p]=S[m],S.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,p=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(p);for(let m=d,x=l.length;m!==x;++m){const b=l[m];p[m]=new yi(b,e,n)}return p}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class _K{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:Fg,endingEnd:Fg};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=dY,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r=!1){if(e.fadeOut(n),this.fadeIn(n),r===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r=!1){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case a9:for(let d=0,p=l.length;d!==p;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case pC:default:for(let d=0,p=l.length;d!==p;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===fY;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===uY){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=Ug,i.endingEnd=Ug):(e?i.endingStart=this.zeroSlopeAtStart?Ug:Fg:i.endingStart=MS,n?i.endingEnd=this.zeroSlopeAtEnd?Ug:Fg:i.endingEnd=MS)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const i4e=new Float32Array(1);class s4e extends yh{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let p=0;p!==s;++p){const m=i[p],x=m.name;let b=d[x];if(b!==void 0)++b.referenceCount,o[p]=b;else{if(b=o[p],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,x));continue}const _=n&&n._propertyBindings[p].binding.parsedPath;b=new bK(yi.create(r,x,_),m.ValueTypeName,m.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,x),o[p]=b}a[p].resultBuffer=b.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n<this._nActiveActions}_addInactiveAction(e,n,r){const i=this._actions,s=this._actionsByClip;let o=s[n];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){const n=this._actions,r=n[n.length-1],i=e._cacheIndex;r._cacheIndex=i,n[i]=r,n.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const p=a.actionByRoot,m=(e._localRoot||this._root).uuid;delete p[m],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const n=this._actions,r=e._cacheIndex,i=this._nActiveActions++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackAction(e){const n=this._actions,r=e._cacheIndex,i=--this._nActiveActions,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_addInactiveBinding(e,n,r){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[n];o===void 0&&(o={},i[n]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const n=this._bindings,r=e.binding,i=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const n=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackBinding(e){const n=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_lendControlInterpolant(){const e=this._controlInterpolants,n=this._nActiveControlInterpolants++;let r=e[n];return r===void 0&&(r=new A9(new Float32Array(2),new Float32Array(2),1,i4e),r.__cacheIndex=n,e[n]=r),r}_takeBackControlInterpolant(e){const n=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=n[i];e.__cacheIndex=i,n[i]=e,s.__cacheIndex=r,n[r]=s}clipAction(e,n,r){const i=n||this._root,s=i.uuid;let o=typeof e=="string"?LS.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=pC),l!==void 0){const p=l.actionByRoot[s];if(p!==void 0&&p.blendMode===r)return p;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const d=new _K(this,o,n,r);return this._bindAction(d,c),this._addInactiveAction(d,a,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?LS.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,n=this._nActiveActions;for(let r=n-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n<this._actions.length;n++)this._actions[n].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const n=this._actions,r=e.uuid,i=this._actionsByClip,s=i[r];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const d=c._cacheIndex,p=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,p._cacheIndex=d,n[d]=p,n.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}}uncacheRoot(e){const n=e.uuid,r=this._actionsByClip;for(const o in r){const a=r[o].actionByRoot,l=a[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class o4e extends c9{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new vC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class L9{constructor(e){this.value=e}clone(){return new L9(this.value.clone===void 0?this.value:this.value.clone())}}let a4e=0;class l4e extends yh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:a4e++}),this.name="",this.usage=CS,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const n=this.uniforms.indexOf(e);return n!==-1&&this.uniforms.splice(n,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const n=e.uniforms;this.uniforms.length=0;for(let r=0,i=n.length;r<i;r++){const s=Array.isArray(n[r])?n[r]:[n[r]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class F5 extends _C{constructor(e,n,r=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const n=super.clone(e);return n.meshPerAttribute=this.meshPerAttribute,n}toJSON(e){const n=super.toJSON(e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}class c4e{constructor(e,n,r,i,s,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.normalized=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,n){return this.type=e,this.elementSize=n,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const rz=new sr;class SK{constructor(e,n,r=0,i=1/0){this.ray=new Dx(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new dy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):Un("Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return rz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(rz),this}intersectObject(e,n=!0,r=[]){return JR(e,this,r,n),r.sort(iz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)JR(e[i],this,r,n);return r.sort(iz),r}}function iz(t,e){return t.distance-e.distance}function JR(t,e,n,r){let i=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(i=!1),i===!0&&r===!0){const s=t.children;for(let o=0,a=s.length;o<a;o++)JR(s[o],e,n,!0)}}class wK{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,gn("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=performance.now();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}class ek{constructor(e=1,n=0,r=0){this.radius=e,this.phi=n,this.theta=r}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=lr(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(lr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class u4e{constructor(e=1,n=0,r=0){this.radius=e,this.theta=n,this.y=r}set(e,n,r){return this.radius=e,this.theta=n,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=n,this}clone(){return new this.constructor().copy(this)}}class j9{constructor(e,n,r,i){j9.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let r=0;r<4;r++)this.elements[r]=e[r+n];return this}set(e,n,r,i){const s=this.elements;return s[0]=e,s[2]=n,s[1]=r,s[3]=i,this}}const sz=new Ht;class d4e{constructor(e=new Ht(1/0,1/0),n=new Ht(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=sz.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,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))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sz).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const oz=new He,pM=new He,Jv=new He,e1=new He,P6=new He,f4e=new He,h4e=new He;class MK{constructor(e=new He,n=new He){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){oz.subVectors(e,this.start),pM.subVectors(this.end,this.start);const r=pM.dot(pM);let s=pM.dot(oz)/r;return n&&(s=lr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,n=f4e,r=h4e){const i=10000000000000001e-32;let s,o;const a=this.start,l=e.start,c=this.end,d=e.end;Jv.subVectors(c,a),e1.subVectors(d,l),P6.subVectors(a,l);const p=Jv.dot(Jv),m=e1.dot(e1),x=e1.dot(P6);if(p<=i&&m<=i)return n.copy(a),r.copy(l),n.sub(r),n.dot(n);if(p<=i)s=0,o=x/m,o=lr(o,0,1);else{const b=Jv.dot(P6);if(m<=i)o=0,s=lr(-b/p,0,1);else{const _=Jv.dot(e1),S=p*m-_*_;S!==0?s=lr((_*x-b*m)/S,0,1):s=0,o=(_*s+x)/m,o<0?(o=0,s=lr(-b/p,0,1)):o>1&&(o=1,s=lr((_-b)/p,0,1))}}return n.copy(a).addScaledVector(Jv,s),r.copy(l).addScaledVector(e1,o),n.distanceToSquared(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const az=new He;class p4e extends _i{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new wr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,d=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new Rn(i,3));const s=new Xl({fog:!1,toneMapped:!1});this.cone=new bh(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,n=e*Math.tan(this.light.angle);this.cone.scale.set(n,n,e),az.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(az),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const C0=new He,mM=new sr,I6=new sr;class m4e extends bh{constructor(e){const n=TK(e),r=new wr,i=[],s=[];for(let c=0;c<n.length;c++){const d=n[c];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}r.setAttribute("position",new Rn(i,3)),r.setAttribute("color",new Rn(s,3));const o=new Xl({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const a=new Sn(255),l=new Sn(65280);this.setColors(a,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");I6.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(mM.multiplyMatrices(I6,a.matrixWorld),C0.setFromMatrixPosition(mM),i.setXYZ(o,C0.x,C0.y,C0.z),mM.multiplyMatrices(I6,a.parent.matrixWorld),C0.setFromMatrixPosition(mM),i.setXYZ(o+1,C0.x,C0.y,C0.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,n){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,n.r,n.g,n.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function TK(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...TK(t.children[n]));return e}class g4e extends Fs{constructor(e,n,r){const i=new Rw(n,4,2),s=new Ap({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const x4e=new He,lz=new Sn,cz=new Sn;class v4e extends _i{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new Nw(n);i.rotateY(Math.PI*.5),this.material=new Ap({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Wi(o,3)),this.add(new Fs(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const n=e.geometry.getAttribute("color");lz.copy(this.light.color),cz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?lz:cz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(x4e.setFromMatrixPosition(this.light.matrixWorld).negate())}}class y4e extends bh{constructor(e=10,n=10,r=4473924,i=8947848){r=new Sn(r),i=new Sn(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let m=0,x=0,b=-a;m<=n;m++,b+=o){l.push(-a,0,b,a,0,b),l.push(b,0,-a,b,0,a);const _=m===s?r:i;_.toArray(c,x),x+=3,_.toArray(c,x),x+=3,_.toArray(c,x),x+=3,_.toArray(c,x),x+=3}const d=new wr;d.setAttribute("position",new Rn(l,3)),d.setAttribute("color",new Rn(c,3));const p=new Xl({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class b4e extends bh{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new Sn(s),o=new Sn(o);const a=[],l=[];if(n>1)for(let p=0;p<n;p++){const m=p/n*(Math.PI*2),x=Math.sin(m)*e,b=Math.cos(m)*e;a.push(0,0,0),a.push(x,0,b);const _=p&1?s:o;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let p=0;p<r;p++){const m=p&1?s:o,x=e-e/r*p;for(let b=0;b<i;b++){let _=b/i*(Math.PI*2),S=Math.sin(_)*x,w=Math.cos(_)*x;a.push(S,0,w),l.push(m.r,m.g,m.b),_=(b+1)/i*(Math.PI*2),S=Math.sin(_)*x,w=Math.cos(_)*x,a.push(S,0,w),l.push(m.r,m.g,m.b)}}const c=new wr;c.setAttribute("position",new Rn(a,3)),c.setAttribute("color",new Rn(l,3));const d=new Xl({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const uz=new He,gM=new He,dz=new He;class _4e extends _i{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",n===void 0&&(n=1);let i=new wr;i.setAttribute("position",new Rn([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new Xl({fog:!1,toneMapped:!1});this.lightPlane=new cm(i,s),this.add(this.lightPlane),i=new wr,i.setAttribute("position",new Rn([0,0,0,0,0,1],3)),this.targetLine=new cm(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),uz.setFromMatrixPosition(this.light.matrixWorld),gM.setFromMatrixPosition(this.light.target.matrixWorld),dz.subVectors(gM,uz),this.lightPlane.lookAt(gM),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(gM),this.targetLine.scale.z=dz.length()}}const xM=new He,ho=new UC;class S4e extends bh{constructor(e){const n=new wr,r=new Xl({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(b,_){l(b),l(_)}function l(b){i.push(0,0,0),s.push(0,0,0),o[b]===void 0&&(o[b]=[]),o[b].push(i.length/3-1)}n.setAttribute("position",new Rn(i,3)),n.setAttribute("color",new Rn(s,3)),super(n,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new Sn(16755200),d=new Sn(16711680),p=new Sn(43775),m=new Sn(16777215),x=new Sn(3355443);this.setColors(c,d,p,m,x)}setColors(e,n,r,i,s){const a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,n.r,n.g,n.b),a.setXYZ(25,n.r,n.g,n.b),a.setXYZ(26,n.r,n.g,n.b),a.setXYZ(27,n.r,n.g,n.b),a.setXYZ(28,n.r,n.g,n.b),a.setXYZ(29,n.r,n.g,n.b),a.setXYZ(30,n.r,n.g,n.b),a.setXYZ(31,n.r,n.g,n.b),a.setXYZ(32,r.r,r.g,r.b),a.setXYZ(33,r.r,r.g,r.b),a.setXYZ(34,r.r,r.g,r.b),a.setXYZ(35,r.r,r.g,r.b),a.setXYZ(36,r.r,r.g,r.b),a.setXYZ(37,r.r,r.g,r.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0,this}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;let s,o;if(ho.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===tu)s=-1,o=1;else if(this.camera.coordinateSystem===gx)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Mo("c",n,e,ho,0,0,s),Mo("t",n,e,ho,0,0,o),Mo("n1",n,e,ho,-r,-i,s),Mo("n2",n,e,ho,r,-i,s),Mo("n3",n,e,ho,-r,i,s),Mo("n4",n,e,ho,r,i,s),Mo("f1",n,e,ho,-r,-i,o),Mo("f2",n,e,ho,r,-i,o),Mo("f3",n,e,ho,-r,i,o),Mo("f4",n,e,ho,r,i,o),Mo("u1",n,e,ho,r*.7,i*1.1,s),Mo("u2",n,e,ho,-r*.7,i*1.1,s),Mo("u3",n,e,ho,0,i*2,s),Mo("cf1",n,e,ho,-r,0,o),Mo("cf2",n,e,ho,r,0,o),Mo("cf3",n,e,ho,0,-i,o),Mo("cf4",n,e,ho,0,i,o),Mo("cn1",n,e,ho,-r,0,s),Mo("cn2",n,e,ho,r,0,s),Mo("cn3",n,e,ho,0,-i,s),Mo("cn4",n,e,ho,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mo(t,e,n,r,i,s,o){xM.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,d=a.length;c<d;c++)l.setXYZ(a[c],xM.x,xM.y,xM.z)}}const vM=new Eo;class w4e extends bh{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new wr;s.setIndex(new Wi(r,1)),s.setAttribute("position",new Wi(i,3)),super(s,new Xl({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&vM.setFromObject(this.object),vM.isEmpty())return;const e=vM.min,n=vM.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,n){return super.copy(e,n),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class M4e extends bh{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new wr;s.setIndex(new Wi(r,1)),s.setAttribute("position",new Rn(i,3)),super(s,new Xl({color:n,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class T4e extends cm{constructor(e,n=1,r=16776960){const i=r,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new wr;o.setAttribute("position",new Rn(s,3)),o.computeBoundingSphere(),super(o,new Xl({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new wr;l.setAttribute("position",new Rn(a,3)),l.computeBoundingSphere(),this.add(new Fs(l,new Ap({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const fz=new He;let yM,O6;class C4e extends _i{constructor(e=new He(0,0,1),n=new He(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",yM===void 0&&(yM=new wr,yM.setAttribute("position",new Rn([0,0,0,0,1,0],3)),O6=new Aw(.5,1,5,1),O6.translate(0,-.5,0)),this.position.copy(n),this.line=new cm(yM,new Xl({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Fs(O6,new Ap({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{fz.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(fz,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class E4e extends bh{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new wr;i.setAttribute("position",new Rn(n,3)),i.setAttribute("color",new Rn(r,3));const s=new Xl({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new Sn,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class A4e{constructor(){this.type="ShapePath",this.color=new Sn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new z5,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(w){const C=[];for(let A=0,N=w.length;A<N;A++){const D=w[A],P=new Y0;P.curves=D.curves,C.push(P)}return C}function r(w,C){const A=C.length;let N=!1;for(let D=A-1,P=0;P<A;D=P++){let O=C[D],R=C[P],L=R.x-O.x,V=R.y-O.y;if(Math.abs(V)>Number.EPSILON){if(V<0&&(O=C[P],L=-L,R=C[D],V=-V),w.y<O.y||w.y>R.y)continue;if(w.y===O.y){if(w.x===O.x)return!0}else{const F=V*(w.x-O.x)-L*(w.y-O.y);if(F===0)return!0;if(F<0)continue;N=!N}}else{if(w.y!==O.y)continue;if(R.x<=w.x&&w.x<=O.x||O.x<=w.x&&w.x<=R.x)return!0}}return N}const i=Xd.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Y0,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const p=[],m=[];let x=[],b=0,_;m[b]=void 0,x[b]=[];for(let w=0,C=s.length;w<C;w++)a=s[w],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!d&&m[b]&&b++,m[b]={s:new Y0,p:_},m[b].s.curves=a.curves,d&&b++,x[b]=[]):x[b].push({h:a,p:_[0]});if(!m[0])return n(s);if(m.length>1){let w=!1,C=0;for(let A=0,N=m.length;A<N;A++)p[A]=[];for(let A=0,N=m.length;A<N;A++){const D=x[A];for(let P=0;P<D.length;P++){const O=D[P];let R=!0;for(let L=0;L<m.length;L++)r(O.p,m[L].p)&&(A!==L&&C++,R?(R=!1,p[L].push(O)):w=!0);R&&p[A].push(O)}}C>0&&w===!1&&(x=p)}let S;for(let w=0,C=m.length;w<C;w++){l=m[w].s,c.push(l),S=x[w];for(let A=0,N=S.length;A<N;A++)l.holes.push(S[A].h)}return c}}class N4e extends yh{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){gn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function R4e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function k4e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function D4e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function tk(t,e,n,r){const i=P4e(r);switch(n){case s9:return t*e;case dC:return t*e/i.components*i.byteLength;case Tw:return t*e/i.components*i.byteLength;case mx:return t*e*2/i.components*i.byteLength;case fC:return t*e*2/i.components*i.byteLength;case o9:return t*e*3/i.components*i.byteLength;case ml:return t*e*4/i.components*i.byteLength;case hC:return t*e*4/i.components*i.byteLength;case G_:case W_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case $_:case q_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case r5:case s5:return Math.max(t,16)*Math.max(e,8)/4;case n5:case i5:return Math.max(t,8)*Math.max(e,8)/2;case o5:case a5:case c5:case u5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case l5:case d5:case f5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p5:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case m5:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case g5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case x5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case v5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case y5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case b5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case _5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case S5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case w5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case M5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case T5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case C5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case E5:case A5:case N5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case R5:case k5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case D5:case P5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function P4e(t){switch(t){case Bl:case t9:return{byteLength:1,components:1};case ly:case n9:case uh:return{byteLength:2,components:1};case cC:case uC:return{byteLength:2,components:4};case id:case lC:case Wl:return{byteLength:4,components:1};case r9:case i9:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class I4e{static contain(e,n){return R4e(e,n)}static cover(e,n){return k4e(e,n)}static fill(e){return D4e(e)}static getByteLength(e,n,r,i){return tk(e,n,r,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ww}}));typeof window<"u"&&(window.__THREE__?gn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ww);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function CK(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function O4e(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,p=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let x;if(c instanceof Float32Array)x=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=t.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=t.HALF_FLOAT:x=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=t.SHORT;else if(c instanceof Uint32Array)x=t.UNSIGNED_INT;else if(c instanceof Int32Array)x=t.INT;else if(c instanceof Int8Array)x=t.BYTE;else if(c instanceof Uint8Array)x=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:p}}function r(a,l,c){const d=l.array,p=l.updateRanges;if(t.bindBuffer(c,a),p.length===0)t.bufferSubData(c,0,d);else{p.sort((x,b)=>x.start-b.start);let m=0;for(let x=1;x<p.length;x++){const b=p[m],_=p[x];_.start<=b.start+b.count+1?b.count=Math.max(b.count,_.start+_.count-b.start):(++m,p[m]=_)}p.length=m+1;for(let x=0,b=p.length;x<b;x++){const _=p[x];t.bufferSubData(c,_.start*d.BYTES_PER_ELEMENT,d,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const d=e.get(a);(!d||d.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,n(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}var L4e=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,j4e=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,z4e=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,F4e=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,U4e=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,B4e=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,H4e=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,V4e=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,G4e=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec4 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
	}
#endif`,W4e=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,$4e=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,q4e=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,X4e=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,Y4e=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,K4e=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Z4e=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Q4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,J4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,eMe=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,tMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,nMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,rMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,iMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
	vColor *= color;
#elif defined( USE_COLOR )
	vColor.rgb *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.rgb *= instanceColor.rgb;
#endif
#ifdef USE_BATCHING_COLOR
	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
#endif`,sMe=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,oMe=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,aMe=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,lMe=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,cMe=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,uMe=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,dMe=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,fMe="gl_FragColor = linearToOutputTexel( gl_FragColor );",hMe=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,pMe=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
		#ifdef ENVMAP_BLENDING_MULTIPLY
			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
		#elif defined( ENVMAP_BLENDING_MIX )
			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
		#elif defined( ENVMAP_BLENDING_ADD )
			outgoingLight += envColor.xyz * specularStrength * reflectivity;
		#endif
	#endif
#endif`,mMe=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
#endif`,gMe=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,xMe=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,vMe=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,yMe=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,bMe=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,_Me=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,SMe=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,wMe=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,MMe=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,TMe=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,CMe=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,EMe=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,AMe=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,NMe=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,RMe=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,kMe=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,DMe=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,PMe=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = vec3( 0.04 );
	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,IMe=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
	vec3 diffuseColor;
	vec3 diffuseContribution;
	vec3 specularColor;
	vec3 specularColorBlended;
	float roughness;
	float metalness;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
		vec3 iridescenceFresnelDielectric;
		vec3 iridescenceFresnelMetallic;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return v;
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColorBlended;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float rInv = 1.0 / ( roughness + 0.1 );
	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
	float DG = exp( a * dotNV + b );
	return saturate( DG );
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
	float Ess_V = dfgV.x + dfgV.y;
	float Ess_L = dfgL.x + dfgL.y;
	float Ems_V = 1.0 - Ess_V;
	float Ems_L = 1.0 - Ess_L;
	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
	float compensationFactor = Ems_V * Ems_L;
	vec3 multiScatter = Fms * compensationFactor;
	return singleScatter + multiScatter;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
		#ifdef USE_CLEARCOAT
			vec3 Ncc = geometryClearcoatNormal;
			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
			mat3 mInvClearcoat = mat3(
				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
				vec3(             0, 1,             0 ),
				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
			);
			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
		#endif
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
 
 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
 
 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
 
 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
 
 		irradiance *= sheenEnergyComp;
 
 	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		diffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectDiffuse += diffuse;
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
 	#endif
	vec3 singleScatteringDielectric = vec3( 0.0 );
	vec3 multiScatteringDielectric = vec3( 0.0 );
	vec3 singleScatteringMetallic = vec3( 0.0 );
	vec3 multiScatteringMetallic = vec3( 0.0 );
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
	#endif
	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	vec3 indirectSpecular = radiance * singleScattering;
	indirectSpecular += multiScattering * cosineWeightedIrradiance;
	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		indirectSpecular *= sheenEnergyComp;
		indirectDiffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectSpecular += indirectSpecular;
	reflectedLight.indirectDiffuse += indirectDiffuse;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,OMe=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,LMe=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
			iblIrradiance += getIBLIrradiance( geometryNormal );
		#endif
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,jMe=`#if defined( RE_IndirectDiffuse )
	#if defined( LAMBERT ) || defined( PHONG )
		irradiance += iblIrradiance;
	#endif
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,zMe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,FMe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,UMe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,BMe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,HMe=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,VMe=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,GMe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,WMe=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,$Me=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,qMe=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,XMe=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,YMe=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,KMe=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,ZMe=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,QMe=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,JMe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,e2e=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,t2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,n2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,r2e=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,i2e=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,s2e=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,o2e=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,a2e=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,l2e=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,c2e=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,u2e=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	#ifdef USE_REVERSED_DEPTH_BUFFER
	
		return depth * ( far - near ) - far;
	#else
		return depth * ( near - far ) - near;
	#endif
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	
	#ifdef USE_REVERSED_DEPTH_BUFFER
		return ( near * far ) / ( ( near - far ) * depth - near );
	#else
		return ( near * far ) / ( ( far - near ) * depth - far );
	#endif
}`,d2e=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,f2e=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,h2e=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,p2e=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,m2e=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,g2e=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,x2e=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#else
			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#endif
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#else
			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#endif
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#elif defined( SHADOWMAP_TYPE_BASIC )
			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#endif
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float interleavedGradientNoise( vec2 position ) {
			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
		}
		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
			const float goldenAngle = 2.399963229728653;
			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
			float theta = float( sampleIndex ) * goldenAngle + phi;
			return vec2( cos( theta ), sin( theta ) ) * r;
		}
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			shadowCoord.z += shadowBias;
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
				float radius = shadowRadius * texelSize.x;
				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
				shadow = (
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
				) * 0.2;
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#elif defined( SHADOWMAP_TYPE_VSM )
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
				float mean = distribution.x;
				float variance = distribution.y * distribution.y;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					float hard_shadow = step( mean, shadowCoord.z );
				#else
					float hard_shadow = step( shadowCoord.z, mean );
				#endif
				
				if ( hard_shadow == 1.0 ) {
					shadow = 1.0;
				} else {
					variance = max( variance, 0.0000001 );
					float d = shadowCoord.z - mean;
					float p_max = variance / ( variance + d * d );
					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
					shadow = max( hard_shadow, p_max );
				}
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#else
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					shadow = step( depth, shadowCoord.z );
				#else
					shadow = step( shadowCoord.z, depth );
				#endif
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#if defined( SHADOWMAP_TYPE_PCF )
	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 bd3D = normalize( lightToPosition );
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			#ifdef USE_REVERSED_DEPTH_BUFFER
				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
				dp -= shadowBias;
			#else
				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
				dp += shadowBias;
			#endif
			float texelSize = shadowRadius / shadowMapSize.x;
			vec3 absDir = abs( bd3D );
			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
			tangent = normalize( cross( bd3D, tangent ) );
			vec3 bitangent = cross( bd3D, tangent );
			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
			vec2 sample0 = vogelDiskSample( 0, 5, phi );
			vec2 sample1 = vogelDiskSample( 1, 5, phi );
			vec2 sample2 = vogelDiskSample( 2, 5, phi );
			vec2 sample3 = vogelDiskSample( 3, 5, phi );
			vec2 sample4 = vogelDiskSample( 4, 5, phi );
			shadow = (
				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
			) * 0.2;
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#elif defined( SHADOWMAP_TYPE_BASIC )
	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			float depth = textureCube( shadowMap, bd3D ).r;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				depth = 1.0 - depth;
			#endif
			shadow = step( dp, depth );
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#endif
	#endif
#endif`,v2e=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,y2e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,b2e=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,_2e=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,S2e=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,w2e=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,M2e=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,T2e=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,C2e=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,E2e=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,A2e=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,N2e=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,R2e=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,k2e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,D2e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,P2e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,I2e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const O2e=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,L2e=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,j2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,z2e=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,F2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,U2e=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,B2e=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,H2e=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	#ifdef USE_REVERSED_DEPTH_BUFFER
		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
	#else
		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
	#endif
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,V2e=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,G2e=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,W2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,$2e=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,q2e=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,X2e=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Y2e=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,K2e=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Z2e=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Q2e=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,J2e=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,e5e=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,t5e=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,n5e=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,r5e=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,i5e=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,s5e=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,o5e=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
 
		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
 
 	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,a5e=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,l5e=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,c5e=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,u5e=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,d5e=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,f5e=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,h5e=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,p5e=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,Ar={alphahash_fragment:L4e,alphahash_pars_fragment:j4e,alphamap_fragment:z4e,alphamap_pars_fragment:F4e,alphatest_fragment:U4e,alphatest_pars_fragment:B4e,aomap_fragment:H4e,aomap_pars_fragment:V4e,batching_pars_vertex:G4e,batching_vertex:W4e,begin_vertex:$4e,beginnormal_vertex:q4e,bsdfs:X4e,iridescence_fragment:Y4e,bumpmap_pars_fragment:K4e,clipping_planes_fragment:Z4e,clipping_planes_pars_fragment:Q4e,clipping_planes_pars_vertex:J4e,clipping_planes_vertex:eMe,color_fragment:tMe,color_pars_fragment:nMe,color_pars_vertex:rMe,color_vertex:iMe,common:sMe,cube_uv_reflection_fragment:oMe,defaultnormal_vertex:aMe,displacementmap_pars_vertex:lMe,displacementmap_vertex:cMe,emissivemap_fragment:uMe,emissivemap_pars_fragment:dMe,colorspace_fragment:fMe,colorspace_pars_fragment:hMe,envmap_fragment:pMe,envmap_common_pars_fragment:mMe,envmap_pars_fragment:gMe,envmap_pars_vertex:xMe,envmap_physical_pars_fragment:AMe,envmap_vertex:vMe,fog_vertex:yMe,fog_pars_vertex:bMe,fog_fragment:_Me,fog_pars_fragment:SMe,gradientmap_pars_fragment:wMe,lightmap_pars_fragment:MMe,lights_lambert_fragment:TMe,lights_lambert_pars_fragment:CMe,lights_pars_begin:EMe,lights_toon_fragment:NMe,lights_toon_pars_fragment:RMe,lights_phong_fragment:kMe,lights_phong_pars_fragment:DMe,lights_physical_fragment:PMe,lights_physical_pars_fragment:IMe,lights_fragment_begin:OMe,lights_fragment_maps:LMe,lights_fragment_end:jMe,logdepthbuf_fragment:zMe,logdepthbuf_pars_fragment:FMe,logdepthbuf_pars_vertex:UMe,logdepthbuf_vertex:BMe,map_fragment:HMe,map_pars_fragment:VMe,map_particle_fragment:GMe,map_particle_pars_fragment:WMe,metalnessmap_fragment:$Me,metalnessmap_pars_fragment:qMe,morphinstance_vertex:XMe,morphcolor_vertex:YMe,morphnormal_vertex:KMe,morphtarget_pars_vertex:ZMe,morphtarget_vertex:QMe,normal_fragment_begin:JMe,normal_fragment_maps:e2e,normal_pars_fragment:t2e,normal_pars_vertex:n2e,normal_vertex:r2e,normalmap_pars_fragment:i2e,clearcoat_normal_fragment_begin:s2e,clearcoat_normal_fragment_maps:o2e,clearcoat_pars_fragment:a2e,iridescence_pars_fragment:l2e,opaque_fragment:c2e,packing:u2e,premultiplied_alpha_fragment:d2e,project_vertex:f2e,dithering_fragment:h2e,dithering_pars_fragment:p2e,roughnessmap_fragment:m2e,roughnessmap_pars_fragment:g2e,shadowmap_pars_fragment:x2e,shadowmap_pars_vertex:v2e,shadowmap_vertex:y2e,shadowmask_pars_fragment:b2e,skinbase_vertex:_2e,skinning_pars_vertex:S2e,skinning_vertex:w2e,skinnormal_vertex:M2e,specularmap_fragment:T2e,specularmap_pars_fragment:C2e,tonemapping_fragment:E2e,tonemapping_pars_fragment:A2e,transmission_fragment:N2e,transmission_pars_fragment:R2e,uv_pars_fragment:k2e,uv_pars_vertex:D2e,uv_vertex:P2e,worldpos_vertex:I2e,background_vert:O2e,background_frag:L2e,backgroundCube_vert:j2e,backgroundCube_frag:z2e,cube_vert:F2e,cube_frag:U2e,depth_vert:B2e,depth_frag:H2e,distance_vert:V2e,distance_frag:G2e,equirect_vert:W2e,equirect_frag:$2e,linedashed_vert:q2e,linedashed_frag:X2e,meshbasic_vert:Y2e,meshbasic_frag:K2e,meshlambert_vert:Z2e,meshlambert_frag:Q2e,meshmatcap_vert:J2e,meshmatcap_frag:e5e,meshnormal_vert:t5e,meshnormal_frag:n5e,meshphong_vert:r5e,meshphong_frag:i5e,meshphysical_vert:s5e,meshphysical_frag:o5e,meshtoon_vert:a5e,meshtoon_frag:l5e,points_vert:c5e,points_frag:u5e,shadow_vert:d5e,shadow_frag:f5e,sprite_vert:h5e,sprite_frag:p5e},vn={common:{diffuse:{value:new Sn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sr},alphaMap:{value:null},alphaMapTransform:{value:new Sr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sr}},envmap:{envMap:{value:null},envMapRotation:{value:new Sr},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 Sr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sr},normalScale:{value:new Ht(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Sn(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 Sn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sr},alphaTest:{value:0},uvTransform:{value:new Sr}},sprite:{diffuse:{value:new Sn(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sr},alphaMap:{value:null},alphaMapTransform:{value:new Sr},alphaTest:{value:0}}},Vd={basic:{uniforms:Ll([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.fog]),vertexShader:Ar.meshbasic_vert,fragmentShader:Ar.meshbasic_frag},lambert:{uniforms:Ll([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.fog,vn.lights,{emissive:{value:new Sn(0)},envMapIntensity:{value:1}}]),vertexShader:Ar.meshlambert_vert,fragmentShader:Ar.meshlambert_frag},phong:{uniforms:Ll([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.fog,vn.lights,{emissive:{value:new Sn(0)},specular:{value:new Sn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ar.meshphong_vert,fragmentShader:Ar.meshphong_frag},standard:{uniforms:Ll([vn.common,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.roughnessmap,vn.metalnessmap,vn.fog,vn.lights,{emissive:{value:new Sn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ar.meshphysical_vert,fragmentShader:Ar.meshphysical_frag},toon:{uniforms:Ll([vn.common,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.gradientmap,vn.fog,vn.lights,{emissive:{value:new Sn(0)}}]),vertexShader:Ar.meshtoon_vert,fragmentShader:Ar.meshtoon_frag},matcap:{uniforms:Ll([vn.common,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.fog,{matcap:{value:null}}]),vertexShader:Ar.meshmatcap_vert,fragmentShader:Ar.meshmatcap_frag},points:{uniforms:Ll([vn.points,vn.fog]),vertexShader:Ar.points_vert,fragmentShader:Ar.points_frag},dashed:{uniforms:Ll([vn.common,vn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ar.linedashed_vert,fragmentShader:Ar.linedashed_frag},depth:{uniforms:Ll([vn.common,vn.displacementmap]),vertexShader:Ar.depth_vert,fragmentShader:Ar.depth_frag},normal:{uniforms:Ll([vn.common,vn.bumpmap,vn.normalmap,vn.displacementmap,{opacity:{value:1}}]),vertexShader:Ar.meshnormal_vert,fragmentShader:Ar.meshnormal_frag},sprite:{uniforms:Ll([vn.sprite,vn.fog]),vertexShader:Ar.sprite_vert,fragmentShader:Ar.sprite_frag},background:{uniforms:{uvTransform:{value:new Sr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ar.background_vert,fragmentShader:Ar.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sr}},vertexShader:Ar.backgroundCube_vert,fragmentShader:Ar.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ar.cube_vert,fragmentShader:Ar.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ar.equirect_vert,fragmentShader:Ar.equirect_frag},distance:{uniforms:Ll([vn.common,vn.displacementmap,{referencePosition:{value:new He},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ar.distance_vert,fragmentShader:Ar.distance_frag},shadow:{uniforms:Ll([vn.lights,vn.fog,{color:{value:new Sn(0)},opacity:{value:1}}]),vertexShader:Ar.shadow_vert,fragmentShader:Ar.shadow_frag}};Vd.physical={uniforms:Ll([Vd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sr},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sr},sheen:{value:0},sheenColor:{value:new Sn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sr},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sr},attenuationDistance:{value:0},attenuationColor:{value:new Sn(0)},specularColor:{value:new Sn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sr},anisotropyVector:{value:new Ht},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sr}}]),vertexShader:Ar.meshphysical_vert,fragmentShader:Ar.meshphysical_frag};const bM={r:0,b:0,g:0},Tg=new cu,m5e=new sr;function g5e(t,e,n,r,i,s){const o=new Sn(0);let a=i===!0?0:1,l,c,d=null,p=0,m=null;function x(C){let A=C.isScene===!0?C.background:null;if(A&&A.isTexture){const N=C.backgroundBlurriness>0;A=e.get(A,N)}return A}function b(C){let A=!1;const N=x(C);N===null?S(o,a):N&&N.isColor&&(S(N,1),A=!0);const D=t.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,s):D==="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 _(C,A){const N=x(A);N&&(N.isCubeTexture||N.mapping===jy)?(c===void 0&&(c=new Fs(new Px(1,1,1),new uu({name:"BackgroundCubeMaterial",uniforms:py(Vd.backgroundCube.uniforms),vertexShader:Vd.backgroundCube.vertexShader,fragmentShader:Vd.backgroundCube.fragmentShader,side:$l,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(D,P,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Tg.copy(A.backgroundRotation),Tg.x*=-1,Tg.y*=-1,Tg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Tg.y*=-1,Tg.z*=-1),c.material.uniforms.envMap.value=N,c.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(m5e.makeRotationFromEuler(Tg)),c.material.toneMapped=ai.getTransfer(N.colorSpace)!==zi,(d!==N||p!==N.version||m!==t.toneMapping)&&(c.material.needsUpdate=!0,d=N,p=N.version,m=t.toneMapping),c.layers.enableAll(),C.unshift(c,c.geometry,c.material,0,0,null)):N&&N.isTexture&&(l===void 0&&(l=new Fs(new Np(2,2),new uu({name:"BackgroundMaterial",uniforms:py(Vd.background.uniforms),vertexShader:Vd.background.vertexShader,fragmentShader:Vd.background.fragmentShader,side:_p,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=N,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.toneMapped=ai.getTransfer(N.colorSpace)!==zi,N.matrixAutoUpdate===!0&&N.updateMatrix(),l.material.uniforms.uvTransform.value.copy(N.matrix),(d!==N||p!==N.version||m!==t.toneMapping)&&(l.material.needsUpdate=!0,d=N,p=N.version,m=t.toneMapping),l.layers.enableAll(),C.unshift(l,l.geometry,l.material,0,0,null))}function S(C,A){C.getRGB(bM,XY(t)),n.buffers.color.setClear(bM.r,bM.g,bM.b,A,s)}function w(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(C,A=1){o.set(C),a=A,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(C){a=C,S(o,a)},render:b,addToRenderList:_,dispose:w}}function x5e(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(F,U,W,Y,$){let X=!1;const Z=p(F,Y,W,U);s!==Z&&(s=Z,c(s.object)),X=x(F,Y,W,$),X&&b(F,Y,W,$),$!==null&&e.update($,t.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,N(F,U,W,Y),$!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get($).buffer))}function l(){return t.createVertexArray()}function c(F){return t.bindVertexArray(F)}function d(F){return t.deleteVertexArray(F)}function p(F,U,W,Y){const $=Y.wireframe===!0;let X=r[U.id];X===void 0&&(X={},r[U.id]=X);const Z=F.isInstancedMesh===!0?F.id:0;let K=X[Z];K===void 0&&(K={},X[Z]=K);let ne=K[W.id];ne===void 0&&(ne={},K[W.id]=ne);let H=ne[$];return H===void 0&&(H=m(l()),ne[$]=H),H}function m(F){const U=[],W=[],Y=[];for(let $=0;$<n;$++)U[$]=0,W[$]=0,Y[$]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:W,attributeDivisors:Y,object:F,attributes:{},index:null}}function x(F,U,W,Y){const $=s.attributes,X=U.attributes;let Z=0;const K=W.getAttributes();for(const ne in K)if(K[ne].location>=0){const B=$[ne];let G=X[ne];if(G===void 0&&(ne==="instanceMatrix"&&F.instanceMatrix&&(G=F.instanceMatrix),ne==="instanceColor"&&F.instanceColor&&(G=F.instanceColor)),B===void 0||B.attribute!==G||G&&B.data!==G.data)return!0;Z++}return s.attributesNum!==Z||s.index!==Y}function b(F,U,W,Y){const $={},X=U.attributes;let Z=0;const K=W.getAttributes();for(const ne in K)if(K[ne].location>=0){let B=X[ne];B===void 0&&(ne==="instanceMatrix"&&F.instanceMatrix&&(B=F.instanceMatrix),ne==="instanceColor"&&F.instanceColor&&(B=F.instanceColor));const G={};G.attribute=B,B&&B.data&&(G.data=B.data),$[ne]=G,Z++}s.attributes=$,s.attributesNum=Z,s.index=Y}function _(){const F=s.newAttributes;for(let U=0,W=F.length;U<W;U++)F[U]=0}function S(F){w(F,0)}function w(F,U){const W=s.newAttributes,Y=s.enabledAttributes,$=s.attributeDivisors;W[F]=1,Y[F]===0&&(t.enableVertexAttribArray(F),Y[F]=1),$[F]!==U&&(t.vertexAttribDivisor(F,U),$[F]=U)}function C(){const F=s.newAttributes,U=s.enabledAttributes;for(let W=0,Y=U.length;W<Y;W++)U[W]!==F[W]&&(t.disableVertexAttribArray(W),U[W]=0)}function A(F,U,W,Y,$,X,Z){Z===!0?t.vertexAttribIPointer(F,U,W,$,X):t.vertexAttribPointer(F,U,W,Y,$,X)}function N(F,U,W,Y){_();const $=Y.attributes,X=W.getAttributes(),Z=U.defaultAttributeValues;for(const K in X){const ne=X[K];if(ne.location>=0){let H=$[K];if(H===void 0&&(K==="instanceMatrix"&&F.instanceMatrix&&(H=F.instanceMatrix),K==="instanceColor"&&F.instanceColor&&(H=F.instanceColor)),H!==void 0){const B=H.normalized,G=H.itemSize,j=e.get(H);if(j===void 0)continue;const ie=j.buffer,ce=j.type,te=j.bytesPerElement,se=ce===t.INT||ce===t.UNSIGNED_INT||H.gpuType===lC;if(H.isInterleavedBufferAttribute){const le=H.data,re=le.stride,pe=H.offset;if(le.isInstancedInterleavedBuffer){for(let be=0;be<ne.locationSize;be++)w(ne.location+be,le.meshPerAttribute);F.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let be=0;be<ne.locationSize;be++)S(ne.location+be);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let be=0;be<ne.locationSize;be++)A(ne.location+be,G/ne.locationSize,ce,B,re*te,(pe+G/ne.locationSize*be)*te,se)}else{if(H.isInstancedBufferAttribute){for(let le=0;le<ne.locationSize;le++)w(ne.location+le,H.meshPerAttribute);F.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=H.meshPerAttribute*H.count)}else for(let le=0;le<ne.locationSize;le++)S(ne.location+le);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let le=0;le<ne.locationSize;le++)A(ne.location+le,G/ne.locationSize,ce,B,G*te,G/ne.locationSize*le*te,se)}}else if(Z!==void 0){const B=Z[K];if(B!==void 0)switch(B.length){case 2:t.vertexAttrib2fv(ne.location,B);break;case 3:t.vertexAttrib3fv(ne.location,B);break;case 4:t.vertexAttrib4fv(ne.location,B);break;default:t.vertexAttrib1fv(ne.location,B)}}}}C()}function D(){L();for(const F in r){const U=r[F];for(const W in U){const Y=U[W];for(const $ in Y){const X=Y[$];for(const Z in X)d(X[Z].object),delete X[Z];delete Y[$]}}delete r[F]}}function P(F){if(r[F.id]===void 0)return;const U=r[F.id];for(const W in U){const Y=U[W];for(const $ in Y){const X=Y[$];for(const Z in X)d(X[Z].object),delete X[Z];delete Y[$]}}delete r[F.id]}function O(F){for(const U in r){const W=r[U];for(const Y in W){const $=W[Y];if($[F.id]===void 0)continue;const X=$[F.id];for(const Z in X)d(X[Z].object),delete X[Z];delete $[F.id]}}}function R(F){for(const U in r){const W=r[U],Y=F.isInstancedMesh===!0?F.id:0,$=W[Y];if($!==void 0){for(const X in $){const Z=$[X];for(const K in Z)d(Z[K].object),delete Z[K];delete $[X]}delete W[Y],Object.keys(W).length===0&&delete r[U]}}}function L(){V(),o=!0,s!==i&&(s=i,c(s.object))}function V(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:L,resetDefaultState:V,dispose:D,releaseStatesOfGeometry:P,releaseStatesOfObject:R,releaseStatesOfProgram:O,initAttributes:_,enableAttribute:S,disableUnusedAttributes:C}}function v5e(t,e,n){let r;function i(c){r=c}function s(c,d){t.drawArrays(r,c,d),n.update(d,r,1)}function o(c,d,p){p!==0&&(t.drawArraysInstanced(r,c,d,p),n.update(d,r,p))}function a(c,d,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,d,0,p);let x=0;for(let b=0;b<p;b++)x+=d[b];n.update(x,r,1)}function l(c,d,p,m){if(p===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let b=0;b<c.length;b++)o(c[b],d[b],m[b]);else{x.multiDrawArraysInstancedWEBGL(r,c,0,d,0,m,0,p);let b=0;for(let _=0;_<p;_++)b+=d[_]*m[_];n.update(b,r,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function y5e(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const O=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(O){return!(O!==ml&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(O){const R=O===uh&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(O!==Bl&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&O!==Wl&&!R)}function l(O){if(O==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(gn("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const p=n.logarithmicDepthBuffer===!0,m=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),x=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),S=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),w=t.getParameter(t.MAX_VERTEX_ATTRIBS),C=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),N=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),D=t.getParameter(t.MAX_SAMPLES),P=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:p,reversedDepthBuffer:m,maxTextures:x,maxVertexTextures:b,maxTextureSize:_,maxCubemapSize:S,maxAttributes:w,maxVertexUniforms:C,maxVaryings:A,maxFragmentUniforms:N,maxSamples:D,samples:P}}function b5e(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new rp,a=new Sr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const x=p.length!==0||m||r!==0||i;return i=m,r=p.length,x},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,m){n=d(p,m,0)},this.setState=function(p,m,x){const b=p.clippingPlanes,_=p.clipIntersection,S=p.clipShadows,w=t.get(p);if(!i||b===null||b.length===0||s&&!S)s?d(null):c();else{const C=s?0:r,A=C*4;let N=w.clippingState||null;l.value=N,N=d(b,m,A,x);for(let D=0;D!==A;++D)N[D]=n[D];w.clippingState=N,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=C}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(p,m,x,b){const _=p!==null?p.length:0;let S=null;if(_!==0){if(S=l.value,b!==!0||S===null){const w=x+_*4,C=m.matrixWorldInverse;a.getNormalMatrix(C),(S===null||S.length<w)&&(S=new Float32Array(w));for(let A=0,N=x;A!==_;++A,N+=4)o.copy(p[A]).applyMatrix4(C,a),o.normal.toArray(S,N),S[N+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,S}}const q0=4,hz=[.125,.215,.35,.446,.526,.582],Og=20,_5e=256,p_=new Kd,pz=new Sn;let L6=null,j6=0,z6=0,F6=!1;const S5e=new He;class nk{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,r=.1,i=100,s={}){const{size:o=256,position:a=S5e}=s;L6=this._renderer.getRenderTarget(),j6=this._renderer.getActiveCubeFace(),z6=this._renderer.getActiveMipmapLevel(),F6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,a),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=xz(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gz(),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(L6,j6,z6),this._renderer.xr.enabled=F6,e.scissorTest=!1,t1(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===ch||e.mapping===om?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),L6=this._renderer.getRenderTarget(),j6=this._renderer.getActiveCubeFace(),z6=this._renderer.getActiveMipmapLevel(),F6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:rs,minFilter:rs,generateMipmaps:!1,type:uh,format:ml,colorSpace:am,depthBuffer:!1},i=mz(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mz(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=w5e(s)),this._blurMaterial=T5e(s,e,n),this._ggxMaterial=M5e(s,e,n)}return i}_compileMaterial(e){const n=new Fs(new wr,e);this._renderer.compile(n,p_)}_sceneToCubeUV(e,n,r,i,s){const l=new Js(90,1,n,r),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,x=p.toneMapping;p.getClearColor(pz),p.toneMapping=ou,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(i),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Fs(new Px,new Ap({name:"PMREM.Background",side:$l,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,S=_.material;let w=!1;const C=e.background;C?C.isColor&&(S.color.copy(C),e.background=null,w=!0):(S.color.copy(pz),w=!0);for(let A=0;A<6;A++){const N=A%3;N===0?(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[A],s.y,s.z)):N===1?(l.up.set(0,0,c[A]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[A],s.z)):(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[A]));const D=this._cubeSize;t1(i,N*D,A>2?D:0,D,D),p.setRenderTarget(i),w&&p.render(_,l),p.render(e,l)}p.toneMapping=x,p.autoClear=m,e.background=C}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===ch||e.mapping===om;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=xz()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gz());const s=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;t1(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,p_)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=r}_applyGGXFilter(e,n,r){const i=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[r];a.material=o;const l=o.uniforms,c=r/(this._lodMeshes.length-1),d=n/(this._lodMeshes.length-1),p=Math.sqrt(c*c-d*d),m=0+c*1.25,x=p*m,{_lodMax:b}=this,_=this._sizeLods[r],S=3*_*(r>b-q0?r-b+q0:0),w=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=b-n,t1(s,S,w,3*_,2*_),i.setRenderTarget(s),i.render(a,p_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,t1(e,S,w,3*_,2*_),i.setRenderTarget(e),i.render(a,p_)}_blur(e,n,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Un("blur direction must be either latitudinal or longitudinal!");const d=3,p=this._lodMeshes[i];p.material=c;const m=c.uniforms,x=this._sizeLods[r]-1,b=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Og-1),_=s/b,S=isFinite(s)?1+Math.floor(d*_):Og;S>Og&&gn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Og}`);const w=[];let C=0;for(let O=0;O<Og;++O){const R=O/_,L=Math.exp(-R*R/2);w.push(L),O===0?C+=L:O<S&&(C+=2*L)}for(let O=0;O<w.length;O++)w[O]=w[O]/C;m.envMap.value=e.texture,m.samples.value=S,m.weights.value=w,m.latitudinal.value=o==="latitudinal",a&&(m.poleAxis.value=a);const{_lodMax:A}=this;m.dTheta.value=b,m.mipInt.value=A-r;const N=this._sizeLods[i],D=3*N*(i>A-q0?i-A+q0:0),P=4*(this._cubeSize-N);t1(n,D,P,3*N,2*N),l.setRenderTarget(n),l.render(p,p_)}}function w5e(t){const e=[],n=[],r=[];let i=t;const s=t-q0+1+hz.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let l=1/a;o>t-q0?l=hz[o-t+q0-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),d=-c,p=1+c,m=[d,d,p,d,p,p,d,d,p,p,d,p],x=6,b=6,_=3,S=2,w=1,C=new Float32Array(_*b*x),A=new Float32Array(S*b*x),N=new Float32Array(w*b*x);for(let P=0;P<x;P++){const O=P%3*2/3-1,R=P>2?0:-1,L=[O,R,0,O+2/3,R,0,O+2/3,R+1,0,O,R,0,O+2/3,R+1,0,O,R+1,0];C.set(L,_*b*P),A.set(m,S*b*P);const V=[P,P,P,P,P,P];N.set(V,w*b*P)}const D=new wr;D.setAttribute("position",new Wi(C,_)),D.setAttribute("uv",new Wi(A,S)),D.setAttribute("faceIndex",new Wi(N,w)),r.push(new Fs(D,null)),i>q0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function mz(t,e,n){const r=new lu(t,e,n);return r.texture.mapping=jy,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function t1(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function M5e(t,e,n){return new uu({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:_5e,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:VC(),fragmentShader:`

			precision highp float;
			precision highp int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform float roughness;
			uniform float mipInt;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			#define PI 3.14159265359

			// Van der Corput radical inverse
			float radicalInverse_VdC(uint bits) {
				bits = (bits << 16u) | (bits >> 16u);
				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
			}

			// Hammersley sequence
			vec2 hammersley(uint i, uint N) {
				return vec2(float(i) / float(N), radicalInverse_VdC(i));
			}

			// GGX VNDF importance sampling (Eric Heitz 2018)
			// "Sampling the GGX Distribution of Visible Normals"
			// https://jcgt.org/published/0007/04/01/
			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
				float alpha = roughness * roughness;

				// Section 4.1: Orthonormal basis
				vec3 T1 = vec3(1.0, 0.0, 0.0);
				vec3 T2 = cross(V, T1);

				// Section 4.2: Parameterization of projected area
				float r = sqrt(Xi.x);
				float phi = 2.0 * PI * Xi.y;
				float t1 = r * cos(phi);
				float t2 = r * sin(phi);
				float s = 0.5 * (1.0 + V.z);
				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;

				// Section 4.3: Reprojection onto hemisphere
				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;

				// Section 3.4: Transform back to ellipsoid configuration
				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
			}

			void main() {
				vec3 N = normalize(vOutputDirection);
				vec3 V = N; // Assume view direction equals normal for pre-filtering

				vec3 prefilteredColor = vec3(0.0);
				float totalWeight = 0.0;

				// For very low roughness, just sample the environment directly
				if (roughness < 0.001) {
					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
					return;
				}

				// Tangent space basis for VNDF sampling
				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
				vec3 tangent = normalize(cross(up, N));
				vec3 bitangent = cross(N, tangent);

				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));

					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);

					// Transform H back to world space
					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
					vec3 L = normalize(2.0 * dot(V, H) * H - V);

					float NdotL = max(dot(N, L), 0.0);

					if(NdotL > 0.0) {
						// Sample environment at fixed mip level
						// VNDF importance sampling handles the distribution filtering
						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);

						// Weight by NdotL for the split-sum approximation
						// VNDF PDF naturally accounts for the visible microfacet distribution
						prefilteredColor += sampleColor * NdotL;
						totalWeight += NdotL;
					}
				}

				if (totalWeight > 0.0) {
					prefilteredColor = prefilteredColor / totalWeight;
				}

				gl_FragColor = vec4(prefilteredColor, 1.0);
			}
		`,blending:sh,depthTest:!1,depthWrite:!1})}function T5e(t,e,n){const r=new Float32Array(Og),i=new He(0,1,0);return new uu({name:"SphericalGaussianBlur",defines:{n:Og,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:VC(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:sh,depthTest:!1,depthWrite:!1})}function gz(){return new uu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:VC(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:sh,depthTest:!1,depthWrite:!1})}function xz(){return new uu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:VC(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:sh,depthTest:!1,depthWrite:!1})}function VC(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}class z9 extends lu{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Cw(i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},i=new Px(5,5,5),s=new uu({name:"CubemapFromEquirect",uniforms:py(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:$l,blending:sh});s.uniforms.tEquirect.value=n;const o=new Fs(i,s),a=n.minFilter;return n.minFilter===Jf&&(n.minFilter=rs),new gK(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}function C5e(t){let e=new WeakMap,n=new WeakMap,r=null;function i(m,x=!1){return m==null?null:x?o(m):s(m)}function s(m){if(m&&m.isTexture){const x=m.mapping;if(x===B_||x===H_)if(e.has(m)){const b=e.get(m).texture;return a(b,m.mapping)}else{const b=m.image;if(b&&b.height>0){const _=new z9(b.height);return _.fromEquirectangularTexture(t,m),e.set(m,_),m.addEventListener("dispose",c),a(_.texture,m.mapping)}else return null}}return m}function o(m){if(m&&m.isTexture){const x=m.mapping,b=x===B_||x===H_,_=x===ch||x===om;if(b||_){let S=n.get(m);const w=S!==void 0?S.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==w)return r===null&&(r=new nk(t)),S=b?r.fromEquirectangular(m,S):r.fromCubemap(m,S),S.texture.pmremVersion=m.pmremVersion,n.set(m,S),S.texture;if(S!==void 0)return S.texture;{const C=m.image;return b&&C&&C.height>0||_&&C&&l(C)?(r===null&&(r=new nk(t)),S=b?r.fromEquirectangular(m):r.fromCubemap(m),S.texture.pmremVersion=m.pmremVersion,n.set(m,S),m.addEventListener("dispose",d),S.texture):null}}}return m}function a(m,x){return x===B_?m.mapping=ch:x===H_&&(m.mapping=om),m}function l(m){let x=0;const b=6;for(let _=0;_<b;_++)m[_]!==void 0&&x++;return x===b}function c(m){const x=m.target;x.removeEventListener("dispose",c);const b=e.get(x);b!==void 0&&(e.delete(x),b.dispose())}function d(m){const x=m.target;x.removeEventListener("dispose",d);const b=n.get(x);b!==void 0&&(n.delete(x),b.dispose())}function p(){e=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:p}}function E5e(t){const e={};function n(r){if(e[r]!==void 0)return e[r];const i=t.getExtension(r);return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&NS("WebGLRenderer: "+r+" extension not supported."),i}}}function A5e(t,e,n,r){const i={},s=new WeakMap;function o(p){const m=p.target;m.index!==null&&e.remove(m.index);for(const b in m.attributes)e.remove(m.attributes[b]);m.removeEventListener("dispose",o),delete i[m.id];const x=s.get(m);x&&(e.remove(x),s.delete(m)),r.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,n.memory.geometries--}function a(p,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,n.memory.geometries++),m}function l(p){const m=p.attributes;for(const x in m)e.update(m[x],t.ARRAY_BUFFER)}function c(p){const m=[],x=p.index,b=p.attributes.position;let _=0;if(b===void 0)return;if(x!==null){const C=x.array;_=x.version;for(let A=0,N=C.length;A<N;A+=3){const D=C[A+0],P=C[A+1],O=C[A+2];m.push(D,P,P,O,O,D)}}else{const C=b.array;_=b.version;for(let A=0,N=C.length/3-1;A<N;A+=3){const D=A+0,P=A+1,O=A+2;m.push(D,P,P,O,O,D)}}const S=new(b.count>=65535?f9:d9)(m,1);S.version=_;const w=s.get(p);w&&e.remove(w),s.set(p,S)}function d(p){const m=s.get(p);if(m){const x=p.index;x!==null&&m.version<x.version&&c(p)}else c(p);return s.get(p)}return{get:a,update:l,getWireframeAttribute:d}}function N5e(t,e,n){let r;function i(m){r=m}let s,o;function a(m){s=m.type,o=m.bytesPerElement}function l(m,x){t.drawElements(r,x,s,m*o),n.update(x,r,1)}function c(m,x,b){b!==0&&(t.drawElementsInstanced(r,x,s,m*o,b),n.update(x,r,b))}function d(m,x,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,x,0,s,m,0,b);let S=0;for(let w=0;w<b;w++)S+=x[w];n.update(S,r,1)}function p(m,x,b,_){if(b===0)return;const S=e.get("WEBGL_multi_draw");if(S===null)for(let w=0;w<m.length;w++)c(m[w]/o,x[w],_[w]);else{S.multiDrawElementsInstancedWEBGL(r,x,0,s,m,0,_,0,b);let w=0;for(let C=0;C<b;C++)w+=x[C]*_[C];n.update(w,r,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=p}function R5e(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(s/3);break;case t.LINES:n.lines+=a*(s/2);break;case t.LINE_STRIP:n.lines+=a*(s-1);break;case t.LINE_LOOP:n.lines+=a*s;break;case t.POINTS:n.points+=a*s;break;default:Un("WebGLInfo: Unknown draw mode:",o);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function k5e(t,e,n){const r=new WeakMap,i=new fi;function s(o,a,l){const c=o.morphTargetInfluences,d=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,p=d!==void 0?d.length:0;let m=r.get(a);if(m===void 0||m.count!==p){let V=function(){R.dispose(),r.delete(a),a.removeEventListener("dispose",V)};var x=V;m!==void 0&&m.texture.dispose();const b=a.morphAttributes.position!==void 0,_=a.morphAttributes.normal!==void 0,S=a.morphAttributes.color!==void 0,w=a.morphAttributes.position||[],C=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let N=0;b===!0&&(N=1),_===!0&&(N=2),S===!0&&(N=3);let D=a.attributes.position.count*N,P=1;D>e.maxTextureSize&&(P=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const O=new Float32Array(D*P*4*p),R=new xC(O,D,P,p);R.type=Wl,R.needsUpdate=!0;const L=N*4;for(let F=0;F<p;F++){const U=w[F],W=C[F],Y=A[F],$=D*P*4*F;for(let X=0;X<U.count;X++){const Z=X*L;b===!0&&(i.fromBufferAttribute(U,X),O[$+Z+0]=i.x,O[$+Z+1]=i.y,O[$+Z+2]=i.z,O[$+Z+3]=0),_===!0&&(i.fromBufferAttribute(W,X),O[$+Z+4]=i.x,O[$+Z+5]=i.y,O[$+Z+6]=i.z,O[$+Z+7]=0),S===!0&&(i.fromBufferAttribute(Y,X),O[$+Z+8]=i.x,O[$+Z+9]=i.y,O[$+Z+10]=i.z,O[$+Z+11]=Y.itemSize===4?i.w:1)}}m={count:p,texture:R,size:new Ht(D,P)},r.set(a,m),a.addEventListener("dispose",V)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let b=0;for(let S=0;S<c.length;S++)b+=c[S];const _=a.morphTargetsRelative?1:1-b;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}return{update:s}}function D5e(t,e,n,r,i){let s=new WeakMap;function o(c){const d=i.render.frame,p=c.geometry,m=e.get(c,p);if(s.get(m)!==d&&(e.update(m),s.set(m,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const x=c.skeleton;s.get(x)!==d&&(x.update(),s.set(x,d))}return m}function a(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),r.releaseStatesOfObject(d),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:o,dispose:a}}const P5e={[X8]:"LINEAR_TONE_MAPPING",[Y8]:"REINHARD_TONE_MAPPING",[K8]:"CINEON_TONE_MAPPING",[oC]:"ACES_FILMIC_TONE_MAPPING",[Q8]:"AGX_TONE_MAPPING",[J8]:"NEUTRAL_TONE_MAPPING",[Z8]:"CUSTOM_TONE_MAPPING"};function I5e(t,e,n,r,i){const s=new lu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),o=new lu(e,n,{type:uh,depthBuffer:!1,stencilBuffer:!1}),a=new wr;a.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new Rn([0,2,0,0,2,0],2));const l=new T9({uniforms:{tDiffuse:{value:null}},vertexShader:`
			precision highp float;

			uniform mat4 modelViewMatrix;
			uniform mat4 projectionMatrix;

			attribute vec3 position;
			attribute vec2 uv;

			varying vec2 vUv;

			void main() {
				vUv = uv;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
			}`,fragmentShader:`
			precision highp float;

			uniform sampler2D tDiffuse;

			varying vec2 vUv;

			#include <tonemapping_pars_fragment>
			#include <colorspace_pars_fragment>

			void main() {
				gl_FragColor = texture2D( tDiffuse, vUv );

				#ifdef LINEAR_TONE_MAPPING
					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
				#elif defined( REINHARD_TONE_MAPPING )
					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
				#elif defined( CINEON_TONE_MAPPING )
					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
				#elif defined( ACES_FILMIC_TONE_MAPPING )
					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
				#elif defined( AGX_TONE_MAPPING )
					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
				#elif defined( NEUTRAL_TONE_MAPPING )
					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
				#elif defined( CUSTOM_TONE_MAPPING )
					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
				#endif

				#ifdef SRGB_TRANSFER
					gl_FragColor = sRGBTransferOETF( gl_FragColor );
				#endif
			}`,depthTest:!1,depthWrite:!1}),c=new Fs(a,l),d=new Kd(-1,1,1,-1,0,1);let p=null,m=null,x=!1,b,_=null,S=[],w=!1;this.setSize=function(C,A){s.setSize(C,A),o.setSize(C,A);for(let N=0;N<S.length;N++){const D=S[N];D.setSize&&D.setSize(C,A)}},this.setEffects=function(C){S=C,w=S.length>0&&S[0].isRenderPass===!0;const A=s.width,N=s.height;for(let D=0;D<S.length;D++){const P=S[D];P.setSize&&P.setSize(A,N)}},this.begin=function(C,A){if(x||C.toneMapping===ou&&S.length===0)return!1;if(_=A,A!==null){const N=A.width,D=A.height;(s.width!==N||s.height!==D)&&this.setSize(N,D)}return w===!1&&C.setRenderTarget(s),b=C.toneMapping,C.toneMapping=ou,!0},this.hasRenderPass=function(){return w},this.end=function(C,A){C.toneMapping=b,x=!0;let N=s,D=o;for(let P=0;P<S.length;P++){const O=S[P];if(O.enabled!==!1&&(O.render(C,D,N,A),O.needsSwap!==!1)){const R=N;N=D,D=R}}if(p!==C.outputColorSpace||m!==C.toneMapping){p=C.outputColorSpace,m=C.toneMapping,l.defines={},ai.getTransfer(p)===zi&&(l.defines.SRGB_TRANSFER="");const P=P5e[m];P&&(l.defines[P]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,C.setRenderTarget(_),C.render(c,d),_=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){s.dispose(),o.dispose(),a.dispose(),l.dispose()}}const EK=new ro,rk=new fy(1,1),AK=new xC,NK=new vC,RK=new Cw,vz=[],yz=[],bz=new Float32Array(16),_z=new Float32Array(9),Sz=new Float32Array(4);function Uy(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=vz[i];if(s===void 0&&(s=new Float32Array(i),vz[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ha(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function pa(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function GC(t,e){let n=yz[e];n===void 0&&(n=new Int32Array(e),yz[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function O5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function L5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ha(n,e))return;t.uniform2fv(this.addr,e),pa(n,e)}}function j5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ha(n,e))return;t.uniform3fv(this.addr,e),pa(n,e)}}function z5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ha(n,e))return;t.uniform4fv(this.addr,e),pa(n,e)}}function F5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ha(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),pa(n,e)}else{if(ha(n,r))return;Sz.set(r),t.uniformMatrix2fv(this.addr,!1,Sz),pa(n,r)}}function U5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ha(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),pa(n,e)}else{if(ha(n,r))return;_z.set(r),t.uniformMatrix3fv(this.addr,!1,_z),pa(n,r)}}function B5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ha(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),pa(n,e)}else{if(ha(n,r))return;bz.set(r),t.uniformMatrix4fv(this.addr,!1,bz),pa(n,r)}}function H5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function V5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ha(n,e))return;t.uniform2iv(this.addr,e),pa(n,e)}}function G5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ha(n,e))return;t.uniform3iv(this.addr,e),pa(n,e)}}function W5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ha(n,e))return;t.uniform4iv(this.addr,e),pa(n,e)}}function $5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function q5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ha(n,e))return;t.uniform2uiv(this.addr,e),pa(n,e)}}function X5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ha(n,e))return;t.uniform3uiv(this.addr,e),pa(n,e)}}function Y5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ha(n,e))return;t.uniform4uiv(this.addr,e),pa(n,e)}}function K5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(rk.compareFunction=n.isReversedDepthBuffer()?gC:mC,s=rk):s=EK,n.setTexture2D(e||s,i)}function Z5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||NK,i)}function Q5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||RK,i)}function J5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||AK,i)}function eTe(t){switch(t){case 5126:return O5e;case 35664:return L5e;case 35665:return j5e;case 35666:return z5e;case 35674:return F5e;case 35675:return U5e;case 35676:return B5e;case 5124:case 35670:return H5e;case 35667:case 35671:return V5e;case 35668:case 35672:return G5e;case 35669:case 35673:return W5e;case 5125:return $5e;case 36294:return q5e;case 36295:return X5e;case 36296:return Y5e;case 35678:case 36198:case 36298:case 36306:case 35682:return K5e;case 35679:case 36299:case 36307:return Z5e;case 35680:case 36300:case 36308:case 36293:return Q5e;case 36289:case 36303:case 36311:case 36292:return J5e}}function tTe(t,e){t.uniform1fv(this.addr,e)}function nTe(t,e){const n=Uy(e,this.size,2);t.uniform2fv(this.addr,n)}function rTe(t,e){const n=Uy(e,this.size,3);t.uniform3fv(this.addr,n)}function iTe(t,e){const n=Uy(e,this.size,4);t.uniform4fv(this.addr,n)}function sTe(t,e){const n=Uy(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function oTe(t,e){const n=Uy(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function aTe(t,e){const n=Uy(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function lTe(t,e){t.uniform1iv(this.addr,e)}function cTe(t,e){t.uniform2iv(this.addr,e)}function uTe(t,e){t.uniform3iv(this.addr,e)}function dTe(t,e){t.uniform4iv(this.addr,e)}function fTe(t,e){t.uniform1uiv(this.addr,e)}function hTe(t,e){t.uniform2uiv(this.addr,e)}function pTe(t,e){t.uniform3uiv(this.addr,e)}function mTe(t,e){t.uniform4uiv(this.addr,e)}function gTe(t,e,n){const r=this.cache,i=e.length,s=GC(n,i);ha(r,s)||(t.uniform1iv(this.addr,s),pa(r,s));let o;this.type===t.SAMPLER_2D_SHADOW?o=rk:o=EK;for(let a=0;a!==i;++a)n.setTexture2D(e[a]||o,s[a])}function xTe(t,e,n){const r=this.cache,i=e.length,s=GC(n,i);ha(r,s)||(t.uniform1iv(this.addr,s),pa(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||NK,s[o])}function vTe(t,e,n){const r=this.cache,i=e.length,s=GC(n,i);ha(r,s)||(t.uniform1iv(this.addr,s),pa(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||RK,s[o])}function yTe(t,e,n){const r=this.cache,i=e.length,s=GC(n,i);ha(r,s)||(t.uniform1iv(this.addr,s),pa(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||AK,s[o])}function bTe(t){switch(t){case 5126:return tTe;case 35664:return nTe;case 35665:return rTe;case 35666:return iTe;case 35674:return sTe;case 35675:return oTe;case 35676:return aTe;case 5124:case 35670:return lTe;case 35667:case 35671:return cTe;case 35668:case 35672:return uTe;case 35669:case 35673:return dTe;case 5125:return fTe;case 36294:return hTe;case 36295:return pTe;case 36296:return mTe;case 35678:case 36198:case 36298:case 36306:case 35682:return gTe;case 35679:case 36299:case 36307:return xTe;case 35680:case 36300:case 36308:case 36293:return vTe;case 36289:case 36303:case 36311:case 36292:return yTe}}class _Te{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=eTe(n.type)}}class STe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=bTe(n.type)}}class wTe{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,n[a.id],r)}}}const U6=/(\w+)(\])?(\[|\.)?/g;function wz(t,e){t.seq.push(e),t.map[e.id]=e}function MTe(t,e,n){const r=t.name,i=r.length;for(U6.lastIndex=0;;){const s=U6.exec(r),o=U6.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){wz(n,c===void 0?new _Te(a,t,e):new STe(a,t,e));break}else{let p=n.map[a];p===void 0&&(p=new wTe(a),wz(n,p)),n=p}}}class qM{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let o=0;o<r;++o){const a=e.getActiveUniform(n,o),l=e.getUniformLocation(n,a.name);MTe(a,l,this)}const i=[],s=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(o):s.push(o);i.length>0&&(this.seq=i.concat(s))}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,o=n.length;s!==o;++s){const a=n[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in n&&r.push(o)}return r}}function Mz(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const TTe=37297;let CTe=0;function ETe(t,e){const n=t.split(`
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return r.join(`
`)}const Tz=new Sr;function ATe(t){ai._getMatrix(Tz,ai.workingColorSpace,t);const e=`mat3( ${Tz.elements.map(n=>n.toFixed(4))} )`;switch(ai.getTransfer(t)){case TS:return[e,"LinearTransferOETF"];case zi:return[e,"sRGBTransferOETF"];default:return gn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Cz(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),s=(t.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return n.toUpperCase()+`

`+s+`

`+ETe(t.getShaderSource(e),a)}else return s}function NTe(t,e){const n=ATe(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const RTe={[X8]:"Linear",[Y8]:"Reinhard",[K8]:"Cineon",[oC]:"ACESFilmic",[Q8]:"AgX",[J8]:"Neutral",[Z8]:"Custom"};function kTe(t,e){const n=RTe[e];return n===void 0?(gn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const _M=new He;function DTe(){ai.getLuminanceCoefficients(_M);const t=_M.x.toFixed(4),e=_M.y.toFixed(4),n=_M.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function PTe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(E_).join(`
`)}function ITe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function OTe(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),o=s.name;let a=1;s.type===t.FLOAT_MAT2&&(a=2),s.type===t.FLOAT_MAT3&&(a=3),s.type===t.FLOAT_MAT4&&(a=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function E_(t){return t!==""}function Ez(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Az(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const LTe=/^[ \t]*#include +<([\w\d./]+)>/gm;function ik(t){return t.replace(LTe,zTe)}const jTe=new Map;function zTe(t,e){let n=Ar[e];if(n===void 0){const r=jTe.get(e);if(r!==void 0)n=Ar[r],gn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return ik(n)}const FTe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Nz(t){return t.replace(FTe,UTe)}function UTe(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Rz(t){let e=`precision ${t.precision} float;
	precision ${t.precision} int;
	precision ${t.precision} sampler2D;
	precision ${t.precision} samplerCube;
	precision ${t.precision} sampler3D;
	precision ${t.precision} sampler2DArray;
	precision ${t.precision} sampler2DShadow;
	precision ${t.precision} samplerCubeShadow;
	precision ${t.precision} sampler2DArrayShadow;
	precision ${t.precision} isampler2D;
	precision ${t.precision} isampler3D;
	precision ${t.precision} isamplerCube;
	precision ${t.precision} isampler2DArray;
	precision ${t.precision} usampler2D;
	precision ${t.precision} usampler3D;
	precision ${t.precision} usamplerCube;
	precision ${t.precision} usampler2DArray;
	`;return t.precision==="highp"?e+=`
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}const BTe={[A1]:"SHADOWMAP_TYPE_PCF",[zg]:"SHADOWMAP_TYPE_VSM"};function HTe(t){return BTe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const VTe={[ch]:"ENVMAP_TYPE_CUBE",[om]:"ENVMAP_TYPE_CUBE",[jy]:"ENVMAP_TYPE_CUBE_UV"};function GTe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":VTe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const WTe={[om]:"ENVMAP_MODE_REFRACTION"};function $Te(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":WTe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const qTe={[Mw]:"ENVMAP_BLENDING_MULTIPLY",[aY]:"ENVMAP_BLENDING_MIX",[lY]:"ENVMAP_BLENDING_ADD"};function XTe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":qTe[t.combine]||"ENVMAP_BLENDING_NONE"}function YTe(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function KTe(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=HTe(n),c=GTe(n),d=$Te(n),p=XTe(n),m=YTe(n),x=PTe(n),b=ITe(s),_=i.createProgram();let S,w,C=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(E_).join(`
`),S.length>0&&(S+=`
`),w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(E_).join(`
`),w.length>0&&(w+=`
`)):(S=[Rz(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(E_).join(`
`),w=[Rz(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ou?"#define TONE_MAPPING":"",n.toneMapping!==ou?Ar.tonemapping_pars_fragment:"",n.toneMapping!==ou?kTe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ar.colorspace_pars_fragment,NTe("linearToOutputTexel",n.outputColorSpace),DTe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(E_).join(`
`)),o=ik(o),o=Ez(o,n),o=Az(o,n),a=ik(a),a=Ez(a,n),a=Az(a,n),o=Nz(o),a=Nz(a),n.isRawShaderMaterial!==!0&&(C=`#version 300 es
`,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+S,w=["#define varying in",n.glslVersion===qR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===qR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+w);const A=C+S+o,N=C+w+a,D=Mz(i,i.VERTEX_SHADER,A),P=Mz(i,i.FRAGMENT_SHADER,N);i.attachShader(_,D),i.attachShader(_,P),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function O(F){if(t.debug.checkShaderErrors){const U=i.getProgramInfoLog(_)||"",W=i.getShaderInfoLog(D)||"",Y=i.getShaderInfoLog(P)||"",$=U.trim(),X=W.trim(),Z=Y.trim();let K=!0,ne=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,D,P);else{const H=Cz(i,D,"vertex"),B=Cz(i,P,"fragment");Un("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

Program Info Log: `+$+`
`+H+`
`+B)}else $!==""?gn("WebGLProgram: Program Info Log:",$):(X===""||Z==="")&&(ne=!1);ne&&(F.diagnostics={runnable:K,programLog:$,vertexShader:{log:X,prefix:S},fragmentShader:{log:Z,prefix:w}})}i.deleteShader(D),i.deleteShader(P),R=new qM(i,_),L=OTe(i,_)}let R;this.getUniforms=function(){return R===void 0&&O(this),R};let L;this.getAttributes=function(){return L===void 0&&O(this),L};let V=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=i.getProgramParameter(_,TTe)),V},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=CTe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=P,this}let ZTe=0;class QTe{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new JTe(e),n.set(e,r)),r}}class JTe{constructor(e){this.id=ZTe++,this.code=e,this.usedTimes=0}}function eCe(t,e,n,r,i,s){const o=new dy,a=new QTe,l=new Set,c=[],d=new Map,p=r.logarithmicDepthBuffer;let m=r.precision;const x={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 b(R){return l.add(R),R===0?"uv":`uv${R}`}function _(R,L,V,F,U){const W=F.fog,Y=U.geometry,$=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?F.environment:null,X=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap,Z=e.get(R.envMap||$,X),K=Z&&Z.mapping===jy?Z.image.height:null,ne=x[R.type];R.precision!==null&&(m=r.getMaxPrecision(R.precision),m!==R.precision&&gn("WebGLProgram.getParameters:",R.precision,"not supported, using",m,"instead."));const H=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,B=H!==void 0?H.length:0;let G=0;Y.morphAttributes.position!==void 0&&(G=1),Y.morphAttributes.normal!==void 0&&(G=2),Y.morphAttributes.color!==void 0&&(G=3);let j,ie,ce,te;if(ne){const pt=Vd[ne];j=pt.vertexShader,ie=pt.fragmentShader}else j=R.vertexShader,ie=R.fragmentShader,a.update(R),ce=a.getVertexShaderID(R),te=a.getFragmentShaderID(R);const se=t.getRenderTarget(),le=t.state.buffers.depth.getReversed(),re=U.isInstancedMesh===!0,pe=U.isBatchedMesh===!0,be=!!R.map,xe=!!R.matcap,Pe=!!Z,me=!!R.aoMap,ke=!!R.lightMap,we=!!R.bumpMap,Te=!!R.normalMap,oe=!!R.displacementMap,_e=!!R.emissiveMap,Fe=!!R.metalnessMap,Ue=!!R.roughnessMap,Oe=R.anisotropy>0,ue=R.clearcoat>0,Q=R.dispersion>0,fe=R.iridescence>0,Se=R.sheen>0,Ae=R.transmission>0,ve=Oe&&!!R.anisotropyMap,qe=ue&&!!R.clearcoatMap,Ee=ue&&!!R.clearcoatNormalMap,Ce=ue&&!!R.clearcoatRoughnessMap,Ye=fe&&!!R.iridescenceMap,Ze=fe&&!!R.iridescenceThicknessMap,it=Se&&!!R.sheenColorMap,ut=Se&&!!R.sheenRoughnessMap,De=!!R.specularMap,Ve=!!R.specularColorMap,lt=!!R.specularIntensityMap,Le=Ae&&!!R.transmissionMap,Ne=Ae&&!!R.thicknessMap,$e=!!R.gradientMap,ft=!!R.alphaMap,nt=R.alphaTest>0,We=!!R.alphaHash,Ke=!!R.extensions;let je=ou;R.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(je=t.toneMapping);const et={shaderID:ne,shaderType:R.type,shaderName:R.name,vertexShader:j,fragmentShader:ie,defines:R.defines,customVertexShaderID:ce,customFragmentShaderID:te,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:m,batching:pe,batchingColor:pe&&U._colorsTexture!==null,instancing:re,instancingColor:re&&U.instanceColor!==null,instancingMorph:re&&U.morphTexture!==null,outputColorSpace:se===null?t.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:am,alphaToCoverage:!!R.alphaToCoverage,map:be,matcap:xe,envMap:Pe,envMapMode:Pe&&Z.mapping,envMapCubeUVHeight:K,aoMap:me,lightMap:ke,bumpMap:we,normalMap:Te,displacementMap:oe,emissiveMap:_e,normalMapObjectSpace:Te&&R.normalMapType===mY,normalMapTangentSpace:Te&&R.normalMapType===wm,metalnessMap:Fe,roughnessMap:Ue,anisotropy:Oe,anisotropyMap:ve,clearcoat:ue,clearcoatMap:qe,clearcoatNormalMap:Ee,clearcoatRoughnessMap:Ce,dispersion:Q,iridescence:fe,iridescenceMap:Ye,iridescenceThicknessMap:Ze,sheen:Se,sheenColorMap:it,sheenRoughnessMap:ut,specularMap:De,specularColorMap:Ve,specularIntensityMap:lt,transmission:Ae,transmissionMap:Le,thicknessMap:Ne,gradientMap:$e,opaque:R.transparent===!1&&R.blending===ex&&R.alphaToCoverage===!1,alphaMap:ft,alphaTest:nt,alphaHash:We,combine:R.combine,mapUv:be&&b(R.map.channel),aoMapUv:me&&b(R.aoMap.channel),lightMapUv:ke&&b(R.lightMap.channel),bumpMapUv:we&&b(R.bumpMap.channel),normalMapUv:Te&&b(R.normalMap.channel),displacementMapUv:oe&&b(R.displacementMap.channel),emissiveMapUv:_e&&b(R.emissiveMap.channel),metalnessMapUv:Fe&&b(R.metalnessMap.channel),roughnessMapUv:Ue&&b(R.roughnessMap.channel),anisotropyMapUv:ve&&b(R.anisotropyMap.channel),clearcoatMapUv:qe&&b(R.clearcoatMap.channel),clearcoatNormalMapUv:Ee&&b(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ce&&b(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ye&&b(R.iridescenceMap.channel),iridescenceThicknessMapUv:Ze&&b(R.iridescenceThicknessMap.channel),sheenColorMapUv:it&&b(R.sheenColorMap.channel),sheenRoughnessMapUv:ut&&b(R.sheenRoughnessMap.channel),specularMapUv:De&&b(R.specularMap.channel),specularColorMapUv:Ve&&b(R.specularColorMap.channel),specularIntensityMapUv:lt&&b(R.specularIntensityMap.channel),transmissionMapUv:Le&&b(R.transmissionMap.channel),thicknessMapUv:Ne&&b(R.thicknessMap.channel),alphaMapUv:ft&&b(R.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(Te||Oe),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!Y.attributes.uv&&(be||ft),fog:!!W,useFog:R.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:R.wireframe===!1&&(R.flatShading===!0||Y.attributes.normal===void 0&&Te===!1&&(R.isMeshLambertMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isMeshPhysicalMaterial)),sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:le,skinning:U.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:B,morphTextureStride:G,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&V.length>0,shadowMapType:t.shadowMap.type,toneMapping:je,decodeVideoTexture:be&&R.map.isVideoTexture===!0&&ai.getTransfer(R.map.colorSpace)===zi,decodeVideoTextureEmissive:_e&&R.emissiveMap.isVideoTexture===!0&&ai.getTransfer(R.emissiveMap.colorSpace)===zi,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===Kc,flipSided:R.side===$l,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionClipCullDistance:Ke&&R.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ke&&R.extensions.multiDraw===!0||pe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return et.vertexUv1s=l.has(1),et.vertexUv2s=l.has(2),et.vertexUv3s=l.has(3),l.clear(),et}function S(R){const L=[];if(R.shaderID?L.push(R.shaderID):(L.push(R.customVertexShaderID),L.push(R.customFragmentShaderID)),R.defines!==void 0)for(const V in R.defines)L.push(V),L.push(R.defines[V]);return R.isRawShaderMaterial===!1&&(w(L,R),C(L,R),L.push(t.outputColorSpace)),L.push(R.customProgramCacheKey),L.join()}function w(R,L){R.push(L.precision),R.push(L.outputColorSpace),R.push(L.envMapMode),R.push(L.envMapCubeUVHeight),R.push(L.mapUv),R.push(L.alphaMapUv),R.push(L.lightMapUv),R.push(L.aoMapUv),R.push(L.bumpMapUv),R.push(L.normalMapUv),R.push(L.displacementMapUv),R.push(L.emissiveMapUv),R.push(L.metalnessMapUv),R.push(L.roughnessMapUv),R.push(L.anisotropyMapUv),R.push(L.clearcoatMapUv),R.push(L.clearcoatNormalMapUv),R.push(L.clearcoatRoughnessMapUv),R.push(L.iridescenceMapUv),R.push(L.iridescenceThicknessMapUv),R.push(L.sheenColorMapUv),R.push(L.sheenRoughnessMapUv),R.push(L.specularMapUv),R.push(L.specularColorMapUv),R.push(L.specularIntensityMapUv),R.push(L.transmissionMapUv),R.push(L.thicknessMapUv),R.push(L.combine),R.push(L.fogExp2),R.push(L.sizeAttenuation),R.push(L.morphTargetsCount),R.push(L.morphAttributeCount),R.push(L.numDirLights),R.push(L.numPointLights),R.push(L.numSpotLights),R.push(L.numSpotLightMaps),R.push(L.numHemiLights),R.push(L.numRectAreaLights),R.push(L.numDirLightShadows),R.push(L.numPointLightShadows),R.push(L.numSpotLightShadows),R.push(L.numSpotLightShadowsWithMaps),R.push(L.numLightProbes),R.push(L.shadowMapType),R.push(L.toneMapping),R.push(L.numClippingPlanes),R.push(L.numClipIntersection),R.push(L.depthPacking)}function C(R,L){o.disableAll(),L.instancing&&o.enable(0),L.instancingColor&&o.enable(1),L.instancingMorph&&o.enable(2),L.matcap&&o.enable(3),L.envMap&&o.enable(4),L.normalMapObjectSpace&&o.enable(5),L.normalMapTangentSpace&&o.enable(6),L.clearcoat&&o.enable(7),L.iridescence&&o.enable(8),L.alphaTest&&o.enable(9),L.vertexColors&&o.enable(10),L.vertexAlphas&&o.enable(11),L.vertexUv1s&&o.enable(12),L.vertexUv2s&&o.enable(13),L.vertexUv3s&&o.enable(14),L.vertexTangents&&o.enable(15),L.anisotropy&&o.enable(16),L.alphaHash&&o.enable(17),L.batching&&o.enable(18),L.dispersion&&o.enable(19),L.batchingColor&&o.enable(20),L.gradientMap&&o.enable(21),R.push(o.mask),o.disableAll(),L.fog&&o.enable(0),L.useFog&&o.enable(1),L.flatShading&&o.enable(2),L.logarithmicDepthBuffer&&o.enable(3),L.reversedDepthBuffer&&o.enable(4),L.skinning&&o.enable(5),L.morphTargets&&o.enable(6),L.morphNormals&&o.enable(7),L.morphColors&&o.enable(8),L.premultipliedAlpha&&o.enable(9),L.shadowMapEnabled&&o.enable(10),L.doubleSided&&o.enable(11),L.flipSided&&o.enable(12),L.useDepthPacking&&o.enable(13),L.dithering&&o.enable(14),L.transmission&&o.enable(15),L.sheen&&o.enable(16),L.opaque&&o.enable(17),L.pointsUvs&&o.enable(18),L.decodeVideoTexture&&o.enable(19),L.decodeVideoTextureEmissive&&o.enable(20),L.alphaToCoverage&&o.enable(21),R.push(o.mask)}function A(R){const L=x[R.type];let V;if(L){const F=Vd[L];V=PS.clone(F.uniforms)}else V=R.uniforms;return V}function N(R,L){let V=d.get(L);return V!==void 0?++V.usedTimes:(V=new KTe(t,L,R,i),c.push(V),d.set(L,V)),V}function D(R){if(--R.usedTimes===0){const L=c.indexOf(R);c[L]=c[c.length-1],c.pop(),d.delete(R.cacheKey),R.destroy()}}function P(R){a.remove(R)}function O(){a.dispose()}return{getParameters:_,getProgramCacheKey:S,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:P,programs:c,dispose:O}}function tCe(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function r(o){t.delete(o)}function i(o,a,l){t.get(o)[a]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function nCe(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 kz(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 Dz(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function o(m){let x=0;return m.isInstancedMesh&&(x+=2),m.isSkinnedMesh&&(x+=1),x}function a(m,x,b,_,S,w){let C=t[e];return C===void 0?(C={id:m.id,object:m,geometry:x,material:b,materialVariant:o(m),groupOrder:_,renderOrder:m.renderOrder,z:S,group:w},t[e]=C):(C.id=m.id,C.object=m,C.geometry=x,C.material=b,C.materialVariant=o(m),C.groupOrder=_,C.renderOrder=m.renderOrder,C.z=S,C.group=w),e++,C}function l(m,x,b,_,S,w){const C=a(m,x,b,_,S,w);b.transmission>0?r.push(C):b.transparent===!0?i.push(C):n.push(C)}function c(m,x,b,_,S,w){const C=a(m,x,b,_,S,w);b.transmission>0?r.unshift(C):b.transparent===!0?i.unshift(C):n.unshift(C)}function d(m,x){n.length>1&&n.sort(m||nCe),r.length>1&&r.sort(x||kz),i.length>1&&i.sort(x||kz)}function p(){for(let m=e,x=t.length;m<x;m++){const b=t[m];if(b.id===null)break;b.id=null,b.object=null,b.geometry=null,b.material=null,b.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:l,unshift:c,finish:p,sort:d}}function rCe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new Dz,t.set(r,[o])):i>=s.length?(o=new Dz,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function iCe(){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 He,color:new Sn};break;case"SpotLight":n={position:new He,direction:new He,color:new Sn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new He,color:new Sn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new He,skyColor:new Sn,groundColor:new Sn};break;case"RectAreaLight":n={color:new Sn,position:new He,halfWidth:new He,halfHeight:new He};break}return t[e.id]=n,n}}}function sCe(){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 Ht};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let oCe=0;function aCe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function lCe(t){const e=new iCe,n=sCe(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new He);const i=new He,s=new sr,o=new sr;function a(c){let d=0,p=0,m=0;for(let L=0;L<9;L++)r.probe[L].set(0,0,0);let x=0,b=0,_=0,S=0,w=0,C=0,A=0,N=0,D=0,P=0,O=0;c.sort(aCe);for(let L=0,V=c.length;L<V;L++){const F=c[L],U=F.color,W=F.intensity,Y=F.distance;let $=null;if(F.shadow&&F.shadow.map&&(F.shadow.map.texture.format===mx?$=F.shadow.map.texture:$=F.shadow.map.depthTexture||F.shadow.map.texture),F.isAmbientLight)d+=U.r*W,p+=U.g*W,m+=U.b*W;else if(F.isLightProbe){for(let X=0;X<9;X++)r.probe[X].addScaledVector(F.sh.coefficients[X],W);O++}else if(F.isDirectionalLight){const X=e.get(F);if(X.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const Z=F.shadow,K=n.get(F);K.shadowIntensity=Z.intensity,K.shadowBias=Z.bias,K.shadowNormalBias=Z.normalBias,K.shadowRadius=Z.radius,K.shadowMapSize=Z.mapSize,r.directionalShadow[x]=K,r.directionalShadowMap[x]=$,r.directionalShadowMatrix[x]=F.shadow.matrix,C++}r.directional[x]=X,x++}else if(F.isSpotLight){const X=e.get(F);X.position.setFromMatrixPosition(F.matrixWorld),X.color.copy(U).multiplyScalar(W),X.distance=Y,X.coneCos=Math.cos(F.angle),X.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),X.decay=F.decay,r.spot[_]=X;const Z=F.shadow;if(F.map&&(r.spotLightMap[D]=F.map,D++,Z.updateMatrices(F),F.castShadow&&P++),r.spotLightMatrix[_]=Z.matrix,F.castShadow){const K=n.get(F);K.shadowIntensity=Z.intensity,K.shadowBias=Z.bias,K.shadowNormalBias=Z.normalBias,K.shadowRadius=Z.radius,K.shadowMapSize=Z.mapSize,r.spotShadow[_]=K,r.spotShadowMap[_]=$,N++}_++}else if(F.isRectAreaLight){const X=e.get(F);X.color.copy(U).multiplyScalar(W),X.halfWidth.set(F.width*.5,0,0),X.halfHeight.set(0,F.height*.5,0),r.rectArea[S]=X,S++}else if(F.isPointLight){const X=e.get(F);if(X.color.copy(F.color).multiplyScalar(F.intensity),X.distance=F.distance,X.decay=F.decay,F.castShadow){const Z=F.shadow,K=n.get(F);K.shadowIntensity=Z.intensity,K.shadowBias=Z.bias,K.shadowNormalBias=Z.normalBias,K.shadowRadius=Z.radius,K.shadowMapSize=Z.mapSize,K.shadowCameraNear=Z.camera.near,K.shadowCameraFar=Z.camera.far,r.pointShadow[b]=K,r.pointShadowMap[b]=$,r.pointShadowMatrix[b]=F.shadow.matrix,A++}r.point[b]=X,b++}else if(F.isHemisphereLight){const X=e.get(F);X.skyColor.copy(F.color).multiplyScalar(W),X.groundColor.copy(F.groundColor).multiplyScalar(W),r.hemi[w]=X,w++}}S>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=vn.LTC_FLOAT_1,r.rectAreaLTC2=vn.LTC_FLOAT_2):(r.rectAreaLTC1=vn.LTC_HALF_1,r.rectAreaLTC2=vn.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=p,r.ambient[2]=m;const R=r.hash;(R.directionalLength!==x||R.pointLength!==b||R.spotLength!==_||R.rectAreaLength!==S||R.hemiLength!==w||R.numDirectionalShadows!==C||R.numPointShadows!==A||R.numSpotShadows!==N||R.numSpotMaps!==D||R.numLightProbes!==O)&&(r.directional.length=x,r.spot.length=_,r.rectArea.length=S,r.point.length=b,r.hemi.length=w,r.directionalShadow.length=C,r.directionalShadowMap.length=C,r.pointShadow.length=A,r.pointShadowMap.length=A,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=C,r.pointShadowMatrix.length=A,r.spotLightMatrix.length=N+D-P,r.spotLightMap.length=D,r.numSpotLightShadowsWithMaps=P,r.numLightProbes=O,R.directionalLength=x,R.pointLength=b,R.spotLength=_,R.rectAreaLength=S,R.hemiLength=w,R.numDirectionalShadows=C,R.numPointShadows=A,R.numSpotShadows=N,R.numSpotMaps=D,R.numLightProbes=O,r.version=oCe++)}function l(c,d){let p=0,m=0,x=0,b=0,_=0;const S=d.matrixWorldInverse;for(let w=0,C=c.length;w<C;w++){const A=c[w];if(A.isDirectionalLight){const N=r.directional[p];N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(S),p++}else if(A.isSpotLight){const N=r.spot[x];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(S),x++}else if(A.isRectAreaLight){const N=r.rectArea[b];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),o.identity(),s.copy(A.matrixWorld),s.premultiply(S),o.extractRotation(s),N.halfWidth.set(A.width*.5,0,0),N.halfHeight.set(0,A.height*.5,0),N.halfWidth.applyMatrix4(o),N.halfHeight.applyMatrix4(o),b++}else if(A.isPointLight){const N=r.point[m];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),m++}else if(A.isHemisphereLight){const N=r.hemi[_];N.direction.setFromMatrixPosition(A.matrixWorld),N.direction.transformDirection(S),_++}}}return{setup:a,setupView:l,state:r}}function Pz(t){const e=new lCe(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function a(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function cCe(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Pz(t),e.set(i,[a])):s>=o.length?(a=new Pz(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}const uCe=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,dCe=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,fCe=[new He(1,0,0),new He(-1,0,0),new He(0,1,0),new He(0,-1,0),new He(0,0,1),new He(0,0,-1)],hCe=[new He(0,-1,0),new He(0,-1,0),new He(0,0,1),new He(0,0,-1),new He(0,-1,0),new He(0,-1,0)],Iz=new sr,m_=new He,B6=new He;function pCe(t,e,n){let r=new zy;const i=new Ht,s=new Ht,o=new fi,a=new zC,l=new FC,c={},d=n.maxTextureSize,p={[_p]:$l,[$l]:_p,[Kc]:Kc},m=new uu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:uCe,fragmentShader:dCe}),x=m.clone();x.defines.HORIZONTAL_PASS=1;const b=new wr;b.setAttribute("position",new Wi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Fs(b,m),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=A1;let w=this.type;this.render=function(P,O,R){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||P.length===0)return;this.type===U_&&(gn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=A1);const L=t.getRenderTarget(),V=t.getActiveCubeFace(),F=t.getActiveMipmapLevel(),U=t.state;U.setBlending(sh),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const W=w!==this.type;W&&O.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach($=>$.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,$=P.length;Y<$;Y++){const X=P[Y],Z=X.shadow;if(Z===void 0){gn("WebGLShadowMap:",X,"has no shadow.");continue}if(Z.autoUpdate===!1&&Z.needsUpdate===!1)continue;i.copy(Z.mapSize);const K=Z.getFrameExtents();i.multiply(K),s.copy(Z.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/K.x),i.x=s.x*K.x,Z.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/K.y),i.y=s.y*K.y,Z.mapSize.y=s.y));const ne=t.state.buffers.depth.getReversed();if(Z.camera._reversedDepth=ne,Z.map===null||W===!0){if(Z.map!==null&&(Z.map.depthTexture!==null&&(Z.map.depthTexture.dispose(),Z.map.depthTexture=null),Z.map.dispose()),this.type===zg){if(X.isPointLight){gn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Z.map=new lu(i.x,i.y,{format:mx,type:uh,minFilter:rs,magFilter:rs,generateMipmaps:!1}),Z.map.texture.name=X.name+".shadowMap",Z.map.depthTexture=new fy(i.x,i.y,Wl),Z.map.depthTexture.name=X.name+".shadowMapDepth",Z.map.depthTexture.format=dh,Z.map.depthTexture.compareFunction=null,Z.map.depthTexture.minFilter=Co,Z.map.depthTexture.magFilter=Co}else X.isPointLight?(Z.map=new z9(i.x),Z.map.depthTexture=new jY(i.x,id)):(Z.map=new lu(i.x,i.y),Z.map.depthTexture=new fy(i.x,i.y,id)),Z.map.depthTexture.name=X.name+".shadowMap",Z.map.depthTexture.format=dh,this.type===A1?(Z.map.depthTexture.compareFunction=ne?gC:mC,Z.map.depthTexture.minFilter=rs,Z.map.depthTexture.magFilter=rs):(Z.map.depthTexture.compareFunction=null,Z.map.depthTexture.minFilter=Co,Z.map.depthTexture.magFilter=Co);Z.camera.updateProjectionMatrix()}const H=Z.map.isWebGLCubeRenderTarget?6:1;for(let B=0;B<H;B++){if(Z.map.isWebGLCubeRenderTarget)t.setRenderTarget(Z.map,B),t.clear();else{B===0&&(t.setRenderTarget(Z.map),t.clear());const G=Z.getViewport(B);o.set(s.x*G.x,s.y*G.y,s.x*G.z,s.y*G.w),U.viewport(o)}if(X.isPointLight){const G=Z.camera,j=Z.matrix,ie=X.distance||G.far;ie!==G.far&&(G.far=ie,G.updateProjectionMatrix()),m_.setFromMatrixPosition(X.matrixWorld),G.position.copy(m_),B6.copy(G.position),B6.add(fCe[B]),G.up.copy(hCe[B]),G.lookAt(B6),G.updateMatrixWorld(),j.makeTranslation(-m_.x,-m_.y,-m_.z),Iz.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),Z._frustum.setFromProjectionMatrix(Iz,G.coordinateSystem,G.reversedDepth)}else Z.updateMatrices(X);r=Z.getFrustum(),N(O,R,Z.camera,X,this.type)}Z.isPointLightShadow!==!0&&this.type===zg&&C(Z,R),Z.needsUpdate=!1}w=this.type,S.needsUpdate=!1,t.setRenderTarget(L,V,F)};function C(P,O){const R=e.update(_);m.defines.VSM_SAMPLES!==P.blurSamples&&(m.defines.VSM_SAMPLES=P.blurSamples,x.defines.VSM_SAMPLES=P.blurSamples,m.needsUpdate=!0,x.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new lu(i.x,i.y,{format:mx,type:uh})),m.uniforms.shadow_pass.value=P.map.depthTexture,m.uniforms.resolution.value=P.mapSize,m.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(O,null,R,m,_,null),x.uniforms.shadow_pass.value=P.mapPass.texture,x.uniforms.resolution.value=P.mapSize,x.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(O,null,R,x,_,null)}function A(P,O,R,L){let V=null;const F=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(F!==void 0)V=F;else if(V=R.isPointLight===!0?l:a,t.localClippingEnabled&&O.clipShadows===!0&&Array.isArray(O.clippingPlanes)&&O.clippingPlanes.length!==0||O.displacementMap&&O.displacementScale!==0||O.alphaMap&&O.alphaTest>0||O.map&&O.alphaTest>0||O.alphaToCoverage===!0){const U=V.uuid,W=O.uuid;let Y=c[U];Y===void 0&&(Y={},c[U]=Y);let $=Y[W];$===void 0&&($=V.clone(),Y[W]=$,O.addEventListener("dispose",D)),V=$}if(V.visible=O.visible,V.wireframe=O.wireframe,L===zg?V.side=O.shadowSide!==null?O.shadowSide:O.side:V.side=O.shadowSide!==null?O.shadowSide:p[O.side],V.alphaMap=O.alphaMap,V.alphaTest=O.alphaToCoverage===!0?.5:O.alphaTest,V.map=O.map,V.clipShadows=O.clipShadows,V.clippingPlanes=O.clippingPlanes,V.clipIntersection=O.clipIntersection,V.displacementMap=O.displacementMap,V.displacementScale=O.displacementScale,V.displacementBias=O.displacementBias,V.wireframeLinewidth=O.wireframeLinewidth,V.linewidth=O.linewidth,R.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const U=t.properties.get(V);U.light=R}return V}function N(P,O,R,L,V){if(P.visible===!1)return;if(P.layers.test(O.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&V===zg)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const W=e.update(P),Y=P.material;if(Array.isArray(Y)){const $=W.groups;for(let X=0,Z=$.length;X<Z;X++){const K=$[X],ne=Y[K.materialIndex];if(ne&&ne.visible){const H=A(P,ne,L,V);P.onBeforeShadow(t,P,O,R,W,H,K),t.renderBufferDirect(R,null,W,H,P,K),P.onAfterShadow(t,P,O,R,W,H,K)}}}else if(Y.visible){const $=A(P,Y,L,V);P.onBeforeShadow(t,P,O,R,W,$,null),t.renderBufferDirect(R,null,W,$,P,null),P.onAfterShadow(t,P,O,R,W,$,null)}}const U=P.children;for(let W=0,Y=U.length;W<Y;W++)N(U[W],O,R,L,V)}function D(P){P.target.removeEventListener("dispose",D);for(const R in c){const L=c[R],V=P.target.uuid;V in L&&(L[V].dispose(),delete L[V])}}}function mCe(t,e){function n(){let Le=!1;const Ne=new fi;let $e=null;const ft=new fi(0,0,0,0);return{setMask:function(nt){$e!==nt&&!Le&&(t.colorMask(nt,nt,nt,nt),$e=nt)},setLocked:function(nt){Le=nt},setClear:function(nt,We,Ke,je,et){et===!0&&(nt*=je,We*=je,Ke*=je),Ne.set(nt,We,Ke,je),ft.equals(Ne)===!1&&(t.clearColor(nt,We,Ke,je),ft.copy(Ne))},reset:function(){Le=!1,$e=null,ft.set(-1,0,0,0)}}}function r(){let Le=!1,Ne=!1,$e=null,ft=null,nt=null;return{setReversed:function(We){if(Ne!==We){const Ke=e.get("EXT_clip_control");We?Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.ZERO_TO_ONE_EXT):Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.NEGATIVE_ONE_TO_ONE_EXT),Ne=We;const je=nt;nt=null,this.setClear(je)}},getReversed:function(){return Ne},setTest:function(We){We?se(t.DEPTH_TEST):le(t.DEPTH_TEST)},setMask:function(We){$e!==We&&!Le&&(t.depthMask(We),$e=We)},setFunc:function(We){if(Ne&&(We=USe[We]),ft!==We){switch(We){case Y2:t.depthFunc(t.NEVER);break;case K2:t.depthFunc(t.ALWAYS);break;case Z2:t.depthFunc(t.LESS);break;case px:t.depthFunc(t.LEQUAL);break;case Q2:t.depthFunc(t.EQUAL);break;case J2:t.depthFunc(t.GEQUAL);break;case e5:t.depthFunc(t.GREATER);break;case t5:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ft=We}},setLocked:function(We){Le=We},setClear:function(We){nt!==We&&(nt=We,Ne&&(We=1-We),t.clearDepth(We))},reset:function(){Le=!1,$e=null,ft=null,nt=null,Ne=!1}}}function i(){let Le=!1,Ne=null,$e=null,ft=null,nt=null,We=null,Ke=null,je=null,et=null;return{setTest:function(pt){Le||(pt?se(t.STENCIL_TEST):le(t.STENCIL_TEST))},setMask:function(pt){Ne!==pt&&!Le&&(t.stencilMask(pt),Ne=pt)},setFunc:function(pt,Lt,wt){($e!==pt||ft!==Lt||nt!==wt)&&(t.stencilFunc(pt,Lt,wt),$e=pt,ft=Lt,nt=wt)},setOp:function(pt,Lt,wt){(We!==pt||Ke!==Lt||je!==wt)&&(t.stencilOp(pt,Lt,wt),We=pt,Ke=Lt,je=wt)},setLocked:function(pt){Le=pt},setClear:function(pt){et!==pt&&(t.clearStencil(pt),et=pt)},reset:function(){Le=!1,Ne=null,$e=null,ft=null,nt=null,We=null,Ke=null,je=null,et=null}}}const s=new n,o=new r,a=new i,l=new WeakMap,c=new WeakMap;let d={},p={},m=new WeakMap,x=[],b=null,_=!1,S=null,w=null,C=null,A=null,N=null,D=null,P=null,O=new Sn(0,0,0),R=0,L=!1,V=null,F=null,U=null,W=null,Y=null;const $=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Z=0;const K=t.getParameter(t.VERSION);K.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(K)[1]),X=Z>=1):K.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),X=Z>=2);let ne=null,H={};const B=t.getParameter(t.SCISSOR_BOX),G=t.getParameter(t.VIEWPORT),j=new fi().fromArray(B),ie=new fi().fromArray(G);function ce(Le,Ne,$e,ft){const nt=new Uint8Array(4),We=t.createTexture();t.bindTexture(Le,We),t.texParameteri(Le,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Le,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ke=0;Ke<$e;Ke++)Le===t.TEXTURE_3D||Le===t.TEXTURE_2D_ARRAY?t.texImage3D(Ne,0,t.RGBA,1,1,ft,0,t.RGBA,t.UNSIGNED_BYTE,nt):t.texImage2D(Ne+Ke,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,nt);return We}const te={};te[t.TEXTURE_2D]=ce(t.TEXTURE_2D,t.TEXTURE_2D,1),te[t.TEXTURE_CUBE_MAP]=ce(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),te[t.TEXTURE_2D_ARRAY]=ce(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),te[t.TEXTURE_3D]=ce(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),se(t.DEPTH_TEST),o.setFunc(px),we(!1),Te(UR),se(t.CULL_FACE),me(sh);function se(Le){d[Le]!==!0&&(t.enable(Le),d[Le]=!0)}function le(Le){d[Le]!==!1&&(t.disable(Le),d[Le]=!1)}function re(Le,Ne){return p[Le]!==Ne?(t.bindFramebuffer(Le,Ne),p[Le]=Ne,Le===t.DRAW_FRAMEBUFFER&&(p[t.FRAMEBUFFER]=Ne),Le===t.FRAMEBUFFER&&(p[t.DRAW_FRAMEBUFFER]=Ne),!0):!1}function pe(Le,Ne){let $e=x,ft=!1;if(Le){$e=m.get(Ne),$e===void 0&&($e=[],m.set(Ne,$e));const nt=Le.textures;if($e.length!==nt.length||$e[0]!==t.COLOR_ATTACHMENT0){for(let We=0,Ke=nt.length;We<Ke;We++)$e[We]=t.COLOR_ATTACHMENT0+We;$e.length=nt.length,ft=!0}}else $e[0]!==t.BACK&&($e[0]=t.BACK,ft=!0);ft&&t.drawBuffers($e)}function be(Le){return b!==Le?(t.useProgram(Le),b=Le,!0):!1}const xe={[P0]:t.FUNC_ADD,[GX]:t.FUNC_SUBTRACT,[WX]:t.FUNC_REVERSE_SUBTRACT};xe[$X]=t.MIN,xe[qX]=t.MAX;const Pe={[XX]:t.ZERO,[YX]:t.ONE,[KX]:t.SRC_COLOR,[q2]:t.SRC_ALPHA,[nY]:t.SRC_ALPHA_SATURATE,[eY]:t.DST_COLOR,[QX]:t.DST_ALPHA,[ZX]:t.ONE_MINUS_SRC_COLOR,[X2]:t.ONE_MINUS_SRC_ALPHA,[tY]:t.ONE_MINUS_DST_COLOR,[JX]:t.ONE_MINUS_DST_ALPHA,[rY]:t.CONSTANT_COLOR,[iY]:t.ONE_MINUS_CONSTANT_COLOR,[sY]:t.CONSTANT_ALPHA,[oY]:t.ONE_MINUS_CONSTANT_ALPHA};function me(Le,Ne,$e,ft,nt,We,Ke,je,et,pt){if(Le===sh){_===!0&&(le(t.BLEND),_=!1);return}if(_===!1&&(se(t.BLEND),_=!0),Le!==VX){if(Le!==S||pt!==L){if((w!==P0||N!==P0)&&(t.blendEquation(t.FUNC_ADD),w=P0,N=P0),pt)switch(Le){case ex:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case BR:t.blendFunc(t.ONE,t.ONE);break;case HR:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case VR:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Un("WebGLState: Invalid blending: ",Le);break}else switch(Le){case ex:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case BR:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case HR:Un("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case VR:Un("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Un("WebGLState: Invalid blending: ",Le);break}C=null,A=null,D=null,P=null,O.set(0,0,0),R=0,S=Le,L=pt}return}nt=nt||Ne,We=We||$e,Ke=Ke||ft,(Ne!==w||nt!==N)&&(t.blendEquationSeparate(xe[Ne],xe[nt]),w=Ne,N=nt),($e!==C||ft!==A||We!==D||Ke!==P)&&(t.blendFuncSeparate(Pe[$e],Pe[ft],Pe[We],Pe[Ke]),C=$e,A=ft,D=We,P=Ke),(je.equals(O)===!1||et!==R)&&(t.blendColor(je.r,je.g,je.b,et),O.copy(je),R=et),S=Le,L=!1}function ke(Le,Ne){Le.side===Kc?le(t.CULL_FACE):se(t.CULL_FACE);let $e=Le.side===$l;Ne&&($e=!$e),we($e),Le.blending===ex&&Le.transparent===!1?me(sh):me(Le.blending,Le.blendEquation,Le.blendSrc,Le.blendDst,Le.blendEquationAlpha,Le.blendSrcAlpha,Le.blendDstAlpha,Le.blendColor,Le.blendAlpha,Le.premultipliedAlpha),o.setFunc(Le.depthFunc),o.setTest(Le.depthTest),o.setMask(Le.depthWrite),s.setMask(Le.colorWrite);const ft=Le.stencilWrite;a.setTest(ft),ft&&(a.setMask(Le.stencilWriteMask),a.setFunc(Le.stencilFunc,Le.stencilRef,Le.stencilFuncMask),a.setOp(Le.stencilFail,Le.stencilZFail,Le.stencilZPass)),_e(Le.polygonOffset,Le.polygonOffsetFactor,Le.polygonOffsetUnits),Le.alphaToCoverage===!0?se(t.SAMPLE_ALPHA_TO_COVERAGE):le(t.SAMPLE_ALPHA_TO_COVERAGE)}function we(Le){V!==Le&&(Le?t.frontFace(t.CW):t.frontFace(t.CCW),V=Le)}function Te(Le){Le!==UX?(se(t.CULL_FACE),Le!==F&&(Le===UR?t.cullFace(t.BACK):Le===BX?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):le(t.CULL_FACE),F=Le}function oe(Le){Le!==U&&(X&&t.lineWidth(Le),U=Le)}function _e(Le,Ne,$e){Le?(se(t.POLYGON_OFFSET_FILL),(W!==Ne||Y!==$e)&&(W=Ne,Y=$e,o.getReversed()&&(Ne=-Ne),t.polygonOffset(Ne,$e))):le(t.POLYGON_OFFSET_FILL)}function Fe(Le){Le?se(t.SCISSOR_TEST):le(t.SCISSOR_TEST)}function Ue(Le){Le===void 0&&(Le=t.TEXTURE0+$-1),ne!==Le&&(t.activeTexture(Le),ne=Le)}function Oe(Le,Ne,$e){$e===void 0&&(ne===null?$e=t.TEXTURE0+$-1:$e=ne);let ft=H[$e];ft===void 0&&(ft={type:void 0,texture:void 0},H[$e]=ft),(ft.type!==Le||ft.texture!==Ne)&&(ne!==$e&&(t.activeTexture($e),ne=$e),t.bindTexture(Le,Ne||te[Le]),ft.type=Le,ft.texture=Ne)}function ue(){const Le=H[ne];Le!==void 0&&Le.type!==void 0&&(t.bindTexture(Le.type,null),Le.type=void 0,Le.texture=void 0)}function Q(){try{t.compressedTexImage2D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function fe(){try{t.compressedTexImage3D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Se(){try{t.texSubImage2D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Ae(){try{t.texSubImage3D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function ve(){try{t.compressedTexSubImage2D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function qe(){try{t.compressedTexSubImage3D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Ee(){try{t.texStorage2D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Ce(){try{t.texStorage3D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Ye(){try{t.texImage2D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function Ze(){try{t.texImage3D(...arguments)}catch(Le){Un("WebGLState:",Le)}}function it(Le){j.equals(Le)===!1&&(t.scissor(Le.x,Le.y,Le.z,Le.w),j.copy(Le))}function ut(Le){ie.equals(Le)===!1&&(t.viewport(Le.x,Le.y,Le.z,Le.w),ie.copy(Le))}function De(Le,Ne){let $e=c.get(Ne);$e===void 0&&($e=new WeakMap,c.set(Ne,$e));let ft=$e.get(Le);ft===void 0&&(ft=t.getUniformBlockIndex(Ne,Le.name),$e.set(Le,ft))}function Ve(Le,Ne){const ft=c.get(Ne).get(Le);l.get(Ne)!==ft&&(t.uniformBlockBinding(Ne,ft,Le.__bindingPointIndex),l.set(Ne,ft))}function lt(){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),d={},ne=null,H={},p={},m=new WeakMap,x=[],b=null,_=!1,S=null,w=null,C=null,A=null,N=null,D=null,P=null,O=new Sn(0,0,0),R=0,L=!1,V=null,F=null,U=null,W=null,Y=null,j.set(0,0,t.canvas.width,t.canvas.height),ie.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:se,disable:le,bindFramebuffer:re,drawBuffers:pe,useProgram:be,setBlending:me,setMaterial:ke,setFlipSided:we,setCullFace:Te,setLineWidth:oe,setPolygonOffset:_e,setScissorTest:Fe,activeTexture:Ue,bindTexture:Oe,unbindTexture:ue,compressedTexImage2D:Q,compressedTexImage3D:fe,texImage2D:Ye,texImage3D:Ze,updateUBOMapping:De,uniformBlockBinding:Ve,texStorage2D:Ee,texStorage3D:Ce,texSubImage2D:Se,texSubImage3D:Ae,compressedTexSubImage2D:ve,compressedTexSubImage3D:qe,scissor:it,viewport:ut,reset:lt}}function gCe(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ht,d=new WeakMap;let p;const m=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(ue,Q){return x?new OffscreenCanvas(ue,Q):ES("canvas")}function _(ue,Q,fe){let Se=1;const Ae=Oe(ue);if((Ae.width>fe||Ae.height>fe)&&(Se=fe/Math.max(Ae.width,Ae.height)),Se<1)if(typeof HTMLImageElement<"u"&&ue instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ue instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ue instanceof ImageBitmap||typeof VideoFrame<"u"&&ue instanceof VideoFrame){const ve=Math.floor(Se*Ae.width),qe=Math.floor(Se*Ae.height);p===void 0&&(p=b(ve,qe));const Ee=Q?b(ve,qe):p;return Ee.width=ve,Ee.height=qe,Ee.getContext("2d").drawImage(ue,0,0,ve,qe),gn("WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+ve+"x"+qe+")."),Ee}else return"data"in ue&&gn("WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),ue;return ue}function S(ue){return ue.generateMipmaps}function w(ue){t.generateMipmap(ue)}function C(ue){return ue.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:ue.isWebGL3DRenderTarget?t.TEXTURE_3D:ue.isWebGLArrayRenderTarget||ue.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(ue,Q,fe,Se,Ae=!1){if(ue!==null){if(t[ue]!==void 0)return t[ue];gn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ue+"'")}let ve=Q;if(Q===t.RED&&(fe===t.FLOAT&&(ve=t.R32F),fe===t.HALF_FLOAT&&(ve=t.R16F),fe===t.UNSIGNED_BYTE&&(ve=t.R8)),Q===t.RED_INTEGER&&(fe===t.UNSIGNED_BYTE&&(ve=t.R8UI),fe===t.UNSIGNED_SHORT&&(ve=t.R16UI),fe===t.UNSIGNED_INT&&(ve=t.R32UI),fe===t.BYTE&&(ve=t.R8I),fe===t.SHORT&&(ve=t.R16I),fe===t.INT&&(ve=t.R32I)),Q===t.RG&&(fe===t.FLOAT&&(ve=t.RG32F),fe===t.HALF_FLOAT&&(ve=t.RG16F),fe===t.UNSIGNED_BYTE&&(ve=t.RG8)),Q===t.RG_INTEGER&&(fe===t.UNSIGNED_BYTE&&(ve=t.RG8UI),fe===t.UNSIGNED_SHORT&&(ve=t.RG16UI),fe===t.UNSIGNED_INT&&(ve=t.RG32UI),fe===t.BYTE&&(ve=t.RG8I),fe===t.SHORT&&(ve=t.RG16I),fe===t.INT&&(ve=t.RG32I)),Q===t.RGB_INTEGER&&(fe===t.UNSIGNED_BYTE&&(ve=t.RGB8UI),fe===t.UNSIGNED_SHORT&&(ve=t.RGB16UI),fe===t.UNSIGNED_INT&&(ve=t.RGB32UI),fe===t.BYTE&&(ve=t.RGB8I),fe===t.SHORT&&(ve=t.RGB16I),fe===t.INT&&(ve=t.RGB32I)),Q===t.RGBA_INTEGER&&(fe===t.UNSIGNED_BYTE&&(ve=t.RGBA8UI),fe===t.UNSIGNED_SHORT&&(ve=t.RGBA16UI),fe===t.UNSIGNED_INT&&(ve=t.RGBA32UI),fe===t.BYTE&&(ve=t.RGBA8I),fe===t.SHORT&&(ve=t.RGBA16I),fe===t.INT&&(ve=t.RGBA32I)),Q===t.RGB&&(fe===t.UNSIGNED_INT_5_9_9_9_REV&&(ve=t.RGB9_E5),fe===t.UNSIGNED_INT_10F_11F_11F_REV&&(ve=t.R11F_G11F_B10F)),Q===t.RGBA){const qe=Ae?TS:ai.getTransfer(Se);fe===t.FLOAT&&(ve=t.RGBA32F),fe===t.HALF_FLOAT&&(ve=t.RGBA16F),fe===t.UNSIGNED_BYTE&&(ve=qe===zi?t.SRGB8_ALPHA8:t.RGBA8),fe===t.UNSIGNED_SHORT_4_4_4_4&&(ve=t.RGBA4),fe===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 N(ue,Q){let fe;return ue?Q===null||Q===id||Q===cy?fe=t.DEPTH24_STENCIL8:Q===Wl?fe=t.DEPTH32F_STENCIL8:Q===ly&&(fe=t.DEPTH24_STENCIL8,gn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Q===null||Q===id||Q===cy?fe=t.DEPTH_COMPONENT24:Q===Wl?fe=t.DEPTH_COMPONENT32F:Q===ly&&(fe=t.DEPTH_COMPONENT16),fe}function D(ue,Q){return S(ue)===!0||ue.isFramebufferTexture&&ue.minFilter!==Co&&ue.minFilter!==rs?Math.log2(Math.max(Q.width,Q.height))+1:ue.mipmaps!==void 0&&ue.mipmaps.length>0?ue.mipmaps.length:ue.isCompressedTexture&&Array.isArray(ue.image)?Q.mipmaps.length:1}function P(ue){const Q=ue.target;Q.removeEventListener("dispose",P),R(Q),Q.isVideoTexture&&d.delete(Q)}function O(ue){const Q=ue.target;Q.removeEventListener("dispose",O),V(Q)}function R(ue){const Q=r.get(ue);if(Q.__webglInit===void 0)return;const fe=ue.source,Se=m.get(fe);if(Se){const Ae=Se[Q.__cacheKey];Ae.usedTimes--,Ae.usedTimes===0&&L(ue),Object.keys(Se).length===0&&m.delete(fe)}r.remove(ue)}function L(ue){const Q=r.get(ue);t.deleteTexture(Q.__webglTexture);const fe=ue.source,Se=m.get(fe);delete Se[Q.__cacheKey],o.memory.textures--}function V(ue){const Q=r.get(ue);if(ue.depthTexture&&(ue.depthTexture.dispose(),r.remove(ue.depthTexture)),ue.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++){if(Array.isArray(Q.__webglFramebuffer[Se]))for(let Ae=0;Ae<Q.__webglFramebuffer[Se].length;Ae++)t.deleteFramebuffer(Q.__webglFramebuffer[Se][Ae]);else t.deleteFramebuffer(Q.__webglFramebuffer[Se]);Q.__webglDepthbuffer&&t.deleteRenderbuffer(Q.__webglDepthbuffer[Se])}else{if(Array.isArray(Q.__webglFramebuffer))for(let Se=0;Se<Q.__webglFramebuffer.length;Se++)t.deleteFramebuffer(Q.__webglFramebuffer[Se]);else t.deleteFramebuffer(Q.__webglFramebuffer);if(Q.__webglDepthbuffer&&t.deleteRenderbuffer(Q.__webglDepthbuffer),Q.__webglMultisampledFramebuffer&&t.deleteFramebuffer(Q.__webglMultisampledFramebuffer),Q.__webglColorRenderbuffer)for(let Se=0;Se<Q.__webglColorRenderbuffer.length;Se++)Q.__webglColorRenderbuffer[Se]&&t.deleteRenderbuffer(Q.__webglColorRenderbuffer[Se]);Q.__webglDepthRenderbuffer&&t.deleteRenderbuffer(Q.__webglDepthRenderbuffer)}const fe=ue.textures;for(let Se=0,Ae=fe.length;Se<Ae;Se++){const ve=r.get(fe[Se]);ve.__webglTexture&&(t.deleteTexture(ve.__webglTexture),o.memory.textures--),r.remove(fe[Se])}r.remove(ue)}let F=0;function U(){F=0}function W(){const ue=F;return ue>=i.maxTextures&&gn("WebGLTextures: Trying to use "+ue+" texture units while this GPU supports only "+i.maxTextures),F+=1,ue}function Y(ue){const Q=[];return Q.push(ue.wrapS),Q.push(ue.wrapT),Q.push(ue.wrapR||0),Q.push(ue.magFilter),Q.push(ue.minFilter),Q.push(ue.anisotropy),Q.push(ue.internalFormat),Q.push(ue.format),Q.push(ue.type),Q.push(ue.generateMipmaps),Q.push(ue.premultiplyAlpha),Q.push(ue.flipY),Q.push(ue.unpackAlignment),Q.push(ue.colorSpace),Q.join()}function $(ue,Q){const fe=r.get(ue);if(ue.isVideoTexture&&Fe(ue),ue.isRenderTargetTexture===!1&&ue.isExternalTexture!==!0&&ue.version>0&&fe.__version!==ue.version){const Se=ue.image;if(Se===null)gn("WebGLRenderer: Texture marked for update but no image data found.");else if(Se.complete===!1)gn("WebGLRenderer: Texture marked for update but image is incomplete");else{te(fe,ue,Q);return}}else ue.isExternalTexture&&(fe.__webglTexture=ue.sourceTexture?ue.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,fe.__webglTexture,t.TEXTURE0+Q)}function X(ue,Q){const fe=r.get(ue);if(ue.isRenderTargetTexture===!1&&ue.version>0&&fe.__version!==ue.version){te(fe,ue,Q);return}else ue.isExternalTexture&&(fe.__webglTexture=ue.sourceTexture?ue.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,fe.__webglTexture,t.TEXTURE0+Q)}function Z(ue,Q){const fe=r.get(ue);if(ue.isRenderTargetTexture===!1&&ue.version>0&&fe.__version!==ue.version){te(fe,ue,Q);return}n.bindTexture(t.TEXTURE_3D,fe.__webglTexture,t.TEXTURE0+Q)}function K(ue,Q){const fe=r.get(ue);if(ue.isCubeDepthTexture!==!0&&ue.version>0&&fe.__version!==ue.version){se(fe,ue,Q);return}n.bindTexture(t.TEXTURE_CUBE_MAP,fe.__webglTexture,t.TEXTURE0+Q)}const ne={[_S]:t.REPEAT,[Ec]:t.CLAMP_TO_EDGE,[SS]:t.MIRRORED_REPEAT},H={[Co]:t.NEAREST,[e9]:t.NEAREST_MIPMAP_NEAREST,[d1]:t.NEAREST_MIPMAP_LINEAR,[rs]:t.LINEAR,[V_]:t.LINEAR_MIPMAP_NEAREST,[Jf]:t.LINEAR_MIPMAP_LINEAR},B={[gY]:t.NEVER,[_Y]:t.ALWAYS,[xY]:t.LESS,[mC]:t.LEQUAL,[vY]:t.EQUAL,[gC]:t.GEQUAL,[yY]:t.GREATER,[bY]:t.NOTEQUAL};function G(ue,Q){if(Q.type===Wl&&e.has("OES_texture_float_linear")===!1&&(Q.magFilter===rs||Q.magFilter===V_||Q.magFilter===d1||Q.magFilter===Jf||Q.minFilter===rs||Q.minFilter===V_||Q.minFilter===d1||Q.minFilter===Jf)&&gn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ue,t.TEXTURE_WRAP_S,ne[Q.wrapS]),t.texParameteri(ue,t.TEXTURE_WRAP_T,ne[Q.wrapT]),(ue===t.TEXTURE_3D||ue===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ue,t.TEXTURE_WRAP_R,ne[Q.wrapR]),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,H[Q.magFilter]),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,H[Q.minFilter]),Q.compareFunction&&(t.texParameteri(ue,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ue,t.TEXTURE_COMPARE_FUNC,B[Q.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Q.magFilter===Co||Q.minFilter!==d1&&Q.minFilter!==Jf||Q.type===Wl&&e.has("OES_texture_float_linear")===!1)return;if(Q.anisotropy>1||r.get(Q).__currentAnisotropy){const fe=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ue,fe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Q.anisotropy,i.getMaxAnisotropy())),r.get(Q).__currentAnisotropy=Q.anisotropy}}}function j(ue,Q){let fe=!1;ue.__webglInit===void 0&&(ue.__webglInit=!0,Q.addEventListener("dispose",P));const Se=Q.source;let Ae=m.get(Se);Ae===void 0&&(Ae={},m.set(Se,Ae));const ve=Y(Q);if(ve!==ue.__cacheKey){Ae[ve]===void 0&&(Ae[ve]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,fe=!0),Ae[ve].usedTimes++;const qe=Ae[ue.__cacheKey];qe!==void 0&&(Ae[ue.__cacheKey].usedTimes--,qe.usedTimes===0&&L(Q)),ue.__cacheKey=ve,ue.__webglTexture=Ae[ve].texture}return fe}function ie(ue,Q,fe){return Math.floor(Math.floor(ue/fe)/Q)}function ce(ue,Q,fe,Se){const ve=ue.updateRanges;if(ve.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,Q.width,Q.height,fe,Se,Q.data);else{ve.sort((Ze,it)=>Ze.start-it.start);let qe=0;for(let Ze=1;Ze<ve.length;Ze++){const it=ve[qe],ut=ve[Ze],De=it.start+it.count,Ve=ie(ut.start,Q.width,4),lt=ie(it.start,Q.width,4);ut.start<=De+1&&Ve===lt&&ie(ut.start+ut.count-1,Q.width,4)===Ve?it.count=Math.max(it.count,ut.start+ut.count-it.start):(++qe,ve[qe]=ut)}ve.length=qe+1;const Ee=t.getParameter(t.UNPACK_ROW_LENGTH),Ce=t.getParameter(t.UNPACK_SKIP_PIXELS),Ye=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,Q.width);for(let Ze=0,it=ve.length;Ze<it;Ze++){const ut=ve[Ze],De=Math.floor(ut.start/4),Ve=Math.ceil(ut.count/4),lt=De%Q.width,Le=Math.floor(De/Q.width),Ne=Ve,$e=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,lt),t.pixelStorei(t.UNPACK_SKIP_ROWS,Le),n.texSubImage2D(t.TEXTURE_2D,0,lt,Le,Ne,$e,fe,Se,Q.data)}ue.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,Ee),t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ce),t.pixelStorei(t.UNPACK_SKIP_ROWS,Ye)}}function te(ue,Q,fe){let Se=t.TEXTURE_2D;(Q.isDataArrayTexture||Q.isCompressedArrayTexture)&&(Se=t.TEXTURE_2D_ARRAY),Q.isData3DTexture&&(Se=t.TEXTURE_3D);const Ae=j(ue,Q),ve=Q.source;n.bindTexture(Se,ue.__webglTexture,t.TEXTURE0+fe);const qe=r.get(ve);if(ve.version!==qe.__version||Ae===!0){n.activeTexture(t.TEXTURE0+fe);const Ee=ai.getPrimaries(ai.workingColorSpace),Ce=Q.colorSpace===op?null:ai.getPrimaries(Q.colorSpace),Ye=Q.colorSpace===op||Ee===Ce?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Q.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Q.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ye);let Ze=_(Q.image,!1,i.maxTextureSize);Ze=Ue(Q,Ze);const it=s.convert(Q.format,Q.colorSpace),ut=s.convert(Q.type);let De=A(Q.internalFormat,it,ut,Q.colorSpace,Q.isVideoTexture);G(Se,Q);let Ve;const lt=Q.mipmaps,Le=Q.isVideoTexture!==!0,Ne=qe.__version===void 0||Ae===!0,$e=ve.dataReady,ft=D(Q,Ze);if(Q.isDepthTexture)De=N(Q.format===W0,Q.type),Ne&&(Le?n.texStorage2D(t.TEXTURE_2D,1,De,Ze.width,Ze.height):n.texImage2D(t.TEXTURE_2D,0,De,Ze.width,Ze.height,0,it,ut,null));else if(Q.isDataTexture)if(lt.length>0){Le&&Ne&&n.texStorage2D(t.TEXTURE_2D,ft,De,lt[0].width,lt[0].height);for(let nt=0,We=lt.length;nt<We;nt++)Ve=lt[nt],Le?$e&&n.texSubImage2D(t.TEXTURE_2D,nt,0,0,Ve.width,Ve.height,it,ut,Ve.data):n.texImage2D(t.TEXTURE_2D,nt,De,Ve.width,Ve.height,0,it,ut,Ve.data);Q.generateMipmaps=!1}else Le?(Ne&&n.texStorage2D(t.TEXTURE_2D,ft,De,Ze.width,Ze.height),$e&&ce(Q,Ze,it,ut)):n.texImage2D(t.TEXTURE_2D,0,De,Ze.width,Ze.height,0,it,ut,Ze.data);else if(Q.isCompressedTexture)if(Q.isCompressedArrayTexture){Le&&Ne&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ft,De,lt[0].width,lt[0].height,Ze.depth);for(let nt=0,We=lt.length;nt<We;nt++)if(Ve=lt[nt],Q.format!==ml)if(it!==null)if(Le){if($e)if(Q.layerUpdates.size>0){const Ke=tk(Ve.width,Ve.height,Q.format,Q.type);for(const je of Q.layerUpdates){const et=Ve.data.subarray(je*Ke/Ve.data.BYTES_PER_ELEMENT,(je+1)*Ke/Ve.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,nt,0,0,je,Ve.width,Ve.height,1,it,et)}Q.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,nt,0,0,0,Ve.width,Ve.height,Ze.depth,it,Ve.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,nt,De,Ve.width,Ve.height,Ze.depth,0,Ve.data,0,0);else gn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Le?$e&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,nt,0,0,0,Ve.width,Ve.height,Ze.depth,it,ut,Ve.data):n.texImage3D(t.TEXTURE_2D_ARRAY,nt,De,Ve.width,Ve.height,Ze.depth,0,it,ut,Ve.data)}else{Le&&Ne&&n.texStorage2D(t.TEXTURE_2D,ft,De,lt[0].width,lt[0].height);for(let nt=0,We=lt.length;nt<We;nt++)Ve=lt[nt],Q.format!==ml?it!==null?Le?$e&&n.compressedTexSubImage2D(t.TEXTURE_2D,nt,0,0,Ve.width,Ve.height,it,Ve.data):n.compressedTexImage2D(t.TEXTURE_2D,nt,De,Ve.width,Ve.height,0,Ve.data):gn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Le?$e&&n.texSubImage2D(t.TEXTURE_2D,nt,0,0,Ve.width,Ve.height,it,ut,Ve.data):n.texImage2D(t.TEXTURE_2D,nt,De,Ve.width,Ve.height,0,it,ut,Ve.data)}else if(Q.isDataArrayTexture)if(Le){if(Ne&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ft,De,Ze.width,Ze.height,Ze.depth),$e)if(Q.layerUpdates.size>0){const nt=tk(Ze.width,Ze.height,Q.format,Q.type);for(const We of Q.layerUpdates){const Ke=Ze.data.subarray(We*nt/Ze.data.BYTES_PER_ELEMENT,(We+1)*nt/Ze.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,We,Ze.width,Ze.height,1,it,ut,Ke)}Q.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ze.width,Ze.height,Ze.depth,it,ut,Ze.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,De,Ze.width,Ze.height,Ze.depth,0,it,ut,Ze.data);else if(Q.isData3DTexture)Le?(Ne&&n.texStorage3D(t.TEXTURE_3D,ft,De,Ze.width,Ze.height,Ze.depth),$e&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ze.width,Ze.height,Ze.depth,it,ut,Ze.data)):n.texImage3D(t.TEXTURE_3D,0,De,Ze.width,Ze.height,Ze.depth,0,it,ut,Ze.data);else if(Q.isFramebufferTexture){if(Ne)if(Le)n.texStorage2D(t.TEXTURE_2D,ft,De,Ze.width,Ze.height);else{let nt=Ze.width,We=Ze.height;for(let Ke=0;Ke<ft;Ke++)n.texImage2D(t.TEXTURE_2D,Ke,De,nt,We,0,it,ut,null),nt>>=1,We>>=1}}else if(lt.length>0){if(Le&&Ne){const nt=Oe(lt[0]);n.texStorage2D(t.TEXTURE_2D,ft,De,nt.width,nt.height)}for(let nt=0,We=lt.length;nt<We;nt++)Ve=lt[nt],Le?$e&&n.texSubImage2D(t.TEXTURE_2D,nt,0,0,it,ut,Ve):n.texImage2D(t.TEXTURE_2D,nt,De,it,ut,Ve);Q.generateMipmaps=!1}else if(Le){if(Ne){const nt=Oe(Ze);n.texStorage2D(t.TEXTURE_2D,ft,De,nt.width,nt.height)}$e&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,it,ut,Ze)}else n.texImage2D(t.TEXTURE_2D,0,De,it,ut,Ze);S(Q)&&w(Se),qe.__version=ve.version,Q.onUpdate&&Q.onUpdate(Q)}ue.__version=Q.version}function se(ue,Q,fe){if(Q.image.length!==6)return;const Se=j(ue,Q),Ae=Q.source;n.bindTexture(t.TEXTURE_CUBE_MAP,ue.__webglTexture,t.TEXTURE0+fe);const ve=r.get(Ae);if(Ae.version!==ve.__version||Se===!0){n.activeTexture(t.TEXTURE0+fe);const qe=ai.getPrimaries(ai.workingColorSpace),Ee=Q.colorSpace===op?null:ai.getPrimaries(Q.colorSpace),Ce=Q.colorSpace===op||qe===Ee?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Q.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Q.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ce);const Ye=Q.isCompressedTexture||Q.image[0].isCompressedTexture,Ze=Q.image[0]&&Q.image[0].isDataTexture,it=[];for(let We=0;We<6;We++)!Ye&&!Ze?it[We]=_(Q.image[We],!0,i.maxCubemapSize):it[We]=Ze?Q.image[We].image:Q.image[We],it[We]=Ue(Q,it[We]);const ut=it[0],De=s.convert(Q.format,Q.colorSpace),Ve=s.convert(Q.type),lt=A(Q.internalFormat,De,Ve,Q.colorSpace),Le=Q.isVideoTexture!==!0,Ne=ve.__version===void 0||Se===!0,$e=Ae.dataReady;let ft=D(Q,ut);G(t.TEXTURE_CUBE_MAP,Q);let nt;if(Ye){Le&&Ne&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ft,lt,ut.width,ut.height);for(let We=0;We<6;We++){nt=it[We].mipmaps;for(let Ke=0;Ke<nt.length;Ke++){const je=nt[Ke];Q.format!==ml?De!==null?Le?$e&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke,0,0,je.width,je.height,De,je.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke,lt,je.width,je.height,0,je.data):gn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Le?$e&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke,0,0,je.width,je.height,De,Ve,je.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke,lt,je.width,je.height,0,De,Ve,je.data)}}}else{if(nt=Q.mipmaps,Le&&Ne){nt.length>0&&ft++;const We=Oe(it[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ft,lt,We.width,We.height)}for(let We=0;We<6;We++)if(Ze){Le?$e&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,0,0,0,it[We].width,it[We].height,De,Ve,it[We].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,0,lt,it[We].width,it[We].height,0,De,Ve,it[We].data);for(let Ke=0;Ke<nt.length;Ke++){const et=nt[Ke].image[We].image;Le?$e&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke+1,0,0,et.width,et.height,De,Ve,et.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke+1,lt,et.width,et.height,0,De,Ve,et.data)}}else{Le?$e&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,0,0,0,De,Ve,it[We]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,0,lt,De,Ve,it[We]);for(let Ke=0;Ke<nt.length;Ke++){const je=nt[Ke];Le?$e&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke+1,0,0,De,Ve,je.image[We]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+We,Ke+1,lt,De,Ve,je.image[We])}}}S(Q)&&w(t.TEXTURE_CUBE_MAP),ve.__version=Ae.version,Q.onUpdate&&Q.onUpdate(Q)}ue.__version=Q.version}function le(ue,Q,fe,Se,Ae,ve){const qe=s.convert(fe.format,fe.colorSpace),Ee=s.convert(fe.type),Ce=A(fe.internalFormat,qe,Ee,fe.colorSpace),Ye=r.get(Q),Ze=r.get(fe);if(Ze.__renderTarget=Q,!Ye.__hasExternalTextures){const it=Math.max(1,Q.width>>ve),ut=Math.max(1,Q.height>>ve);Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY?n.texImage3D(Ae,ve,Ce,it,ut,Q.depth,0,qe,Ee,null):n.texImage2D(Ae,ve,Ce,it,ut,0,qe,Ee,null)}n.bindFramebuffer(t.FRAMEBUFFER,ue),_e(Q)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Se,Ae,Ze.__webglTexture,0,oe(Q)):(Ae===t.TEXTURE_2D||Ae>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Ae<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Se,Ae,Ze.__webglTexture,ve),n.bindFramebuffer(t.FRAMEBUFFER,null)}function re(ue,Q,fe){if(t.bindRenderbuffer(t.RENDERBUFFER,ue),Q.depthBuffer){const Se=Q.depthTexture,Ae=Se&&Se.isDepthTexture?Se.type:null,ve=N(Q.stencilBuffer,Ae),qe=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;_e(Q)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,oe(Q),ve,Q.width,Q.height):fe?t.renderbufferStorageMultisample(t.RENDERBUFFER,oe(Q),ve,Q.width,Q.height):t.renderbufferStorage(t.RENDERBUFFER,ve,Q.width,Q.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,qe,t.RENDERBUFFER,ue)}else{const Se=Q.textures;for(let Ae=0;Ae<Se.length;Ae++){const ve=Se[Ae],qe=s.convert(ve.format,ve.colorSpace),Ee=s.convert(ve.type),Ce=A(ve.internalFormat,qe,Ee,ve.colorSpace);_e(Q)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,oe(Q),Ce,Q.width,Q.height):fe?t.renderbufferStorageMultisample(t.RENDERBUFFER,oe(Q),Ce,Q.width,Q.height):t.renderbufferStorage(t.RENDERBUFFER,Ce,Q.width,Q.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function pe(ue,Q,fe){const Se=Q.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,ue),!(Q.depthTexture&&Q.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Ae=r.get(Q.depthTexture);if(Ae.__renderTarget=Q,(!Ae.__webglTexture||Q.depthTexture.image.width!==Q.width||Q.depthTexture.image.height!==Q.height)&&(Q.depthTexture.image.width=Q.width,Q.depthTexture.image.height=Q.height,Q.depthTexture.needsUpdate=!0),Se){if(Ae.__webglInit===void 0&&(Ae.__webglInit=!0,Q.depthTexture.addEventListener("dispose",P)),Ae.__webglTexture===void 0){Ae.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,Ae.__webglTexture),G(t.TEXTURE_CUBE_MAP,Q.depthTexture);const Ye=s.convert(Q.depthTexture.format),Ze=s.convert(Q.depthTexture.type);let it;Q.depthTexture.format===dh?it=t.DEPTH_COMPONENT24:Q.depthTexture.format===W0&&(it=t.DEPTH24_STENCIL8);for(let ut=0;ut<6;ut++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,it,Q.width,Q.height,0,Ye,Ze,null)}}else $(Q.depthTexture,0);const ve=Ae.__webglTexture,qe=oe(Q),Ee=Se?t.TEXTURE_CUBE_MAP_POSITIVE_X+fe:t.TEXTURE_2D,Ce=Q.depthTexture.format===W0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(Q.depthTexture.format===dh)_e(Q)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ce,Ee,ve,0,qe):t.framebufferTexture2D(t.FRAMEBUFFER,Ce,Ee,ve,0);else if(Q.depthTexture.format===W0)_e(Q)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ce,Ee,ve,0,qe):t.framebufferTexture2D(t.FRAMEBUFFER,Ce,Ee,ve,0);else throw new Error("Unknown depthTexture format")}function be(ue){const Q=r.get(ue),fe=ue.isWebGLCubeRenderTarget===!0;if(Q.__boundDepthTexture!==ue.depthTexture){const Se=ue.depthTexture;if(Q.__depthDisposeCallback&&Q.__depthDisposeCallback(),Se){const Ae=()=>{delete Q.__boundDepthTexture,delete Q.__depthDisposeCallback,Se.removeEventListener("dispose",Ae)};Se.addEventListener("dispose",Ae),Q.__depthDisposeCallback=Ae}Q.__boundDepthTexture=Se}if(ue.depthTexture&&!Q.__autoAllocateDepthBuffer)if(fe)for(let Se=0;Se<6;Se++)pe(Q.__webglFramebuffer[Se],ue,Se);else{const Se=ue.texture.mipmaps;Se&&Se.length>0?pe(Q.__webglFramebuffer[0],ue,0):pe(Q.__webglFramebuffer,ue,0)}else if(fe){Q.__webglDepthbuffer=[];for(let Se=0;Se<6;Se++)if(n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglFramebuffer[Se]),Q.__webglDepthbuffer[Se]===void 0)Q.__webglDepthbuffer[Se]=t.createRenderbuffer(),re(Q.__webglDepthbuffer[Se],ue,!1);else{const Ae=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=Q.__webglDepthbuffer[Se];t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ae,t.RENDERBUFFER,ve)}}else{const Se=ue.texture.mipmaps;if(Se&&Se.length>0?n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglFramebuffer),Q.__webglDepthbuffer===void 0)Q.__webglDepthbuffer=t.createRenderbuffer(),re(Q.__webglDepthbuffer,ue,!1);else{const Ae=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=Q.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ae,t.RENDERBUFFER,ve)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function xe(ue,Q,fe){const Se=r.get(ue);Q!==void 0&&le(Se.__webglFramebuffer,ue,ue.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),fe!==void 0&&be(ue)}function Pe(ue){const Q=ue.texture,fe=r.get(ue),Se=r.get(Q);ue.addEventListener("dispose",O);const Ae=ue.textures,ve=ue.isWebGLCubeRenderTarget===!0,qe=Ae.length>1;if(qe||(Se.__webglTexture===void 0&&(Se.__webglTexture=t.createTexture()),Se.__version=Q.version,o.memory.textures++),ve){fe.__webglFramebuffer=[];for(let Ee=0;Ee<6;Ee++)if(Q.mipmaps&&Q.mipmaps.length>0){fe.__webglFramebuffer[Ee]=[];for(let Ce=0;Ce<Q.mipmaps.length;Ce++)fe.__webglFramebuffer[Ee][Ce]=t.createFramebuffer()}else fe.__webglFramebuffer[Ee]=t.createFramebuffer()}else{if(Q.mipmaps&&Q.mipmaps.length>0){fe.__webglFramebuffer=[];for(let Ee=0;Ee<Q.mipmaps.length;Ee++)fe.__webglFramebuffer[Ee]=t.createFramebuffer()}else fe.__webglFramebuffer=t.createFramebuffer();if(qe)for(let Ee=0,Ce=Ae.length;Ee<Ce;Ee++){const Ye=r.get(Ae[Ee]);Ye.__webglTexture===void 0&&(Ye.__webglTexture=t.createTexture(),o.memory.textures++)}if(ue.samples>0&&_e(ue)===!1){fe.__webglMultisampledFramebuffer=t.createFramebuffer(),fe.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,fe.__webglMultisampledFramebuffer);for(let Ee=0;Ee<Ae.length;Ee++){const Ce=Ae[Ee];fe.__webglColorRenderbuffer[Ee]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,fe.__webglColorRenderbuffer[Ee]);const Ye=s.convert(Ce.format,Ce.colorSpace),Ze=s.convert(Ce.type),it=A(Ce.internalFormat,Ye,Ze,Ce.colorSpace,ue.isXRRenderTarget===!0),ut=oe(ue);t.renderbufferStorageMultisample(t.RENDERBUFFER,ut,it,ue.width,ue.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ee,t.RENDERBUFFER,fe.__webglColorRenderbuffer[Ee])}t.bindRenderbuffer(t.RENDERBUFFER,null),ue.depthBuffer&&(fe.__webglDepthRenderbuffer=t.createRenderbuffer(),re(fe.__webglDepthRenderbuffer,ue,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ve){n.bindTexture(t.TEXTURE_CUBE_MAP,Se.__webglTexture),G(t.TEXTURE_CUBE_MAP,Q);for(let Ee=0;Ee<6;Ee++)if(Q.mipmaps&&Q.mipmaps.length>0)for(let Ce=0;Ce<Q.mipmaps.length;Ce++)le(fe.__webglFramebuffer[Ee][Ce],ue,Q,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ce);else le(fe.__webglFramebuffer[Ee],ue,Q,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0);S(Q)&&w(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(qe){for(let Ee=0,Ce=Ae.length;Ee<Ce;Ee++){const Ye=Ae[Ee],Ze=r.get(Ye);let it=t.TEXTURE_2D;(ue.isWebGL3DRenderTarget||ue.isWebGLArrayRenderTarget)&&(it=ue.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(it,Ze.__webglTexture),G(it,Ye),le(fe.__webglFramebuffer,ue,Ye,t.COLOR_ATTACHMENT0+Ee,it,0),S(Ye)&&w(it)}n.unbindTexture()}else{let Ee=t.TEXTURE_2D;if((ue.isWebGL3DRenderTarget||ue.isWebGLArrayRenderTarget)&&(Ee=ue.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ee,Se.__webglTexture),G(Ee,Q),Q.mipmaps&&Q.mipmaps.length>0)for(let Ce=0;Ce<Q.mipmaps.length;Ce++)le(fe.__webglFramebuffer[Ce],ue,Q,t.COLOR_ATTACHMENT0,Ee,Ce);else le(fe.__webglFramebuffer,ue,Q,t.COLOR_ATTACHMENT0,Ee,0);S(Q)&&w(Ee),n.unbindTexture()}ue.depthBuffer&&be(ue)}function me(ue){const Q=ue.textures;for(let fe=0,Se=Q.length;fe<Se;fe++){const Ae=Q[fe];if(S(Ae)){const ve=C(ue),qe=r.get(Ae).__webglTexture;n.bindTexture(ve,qe),w(ve),n.unbindTexture()}}}const ke=[],we=[];function Te(ue){if(ue.samples>0){if(_e(ue)===!1){const Q=ue.textures,fe=ue.width,Se=ue.height;let Ae=t.COLOR_BUFFER_BIT;const ve=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,qe=r.get(ue),Ee=Q.length>1;if(Ee)for(let Ye=0;Ye<Q.length;Ye++)n.bindFramebuffer(t.FRAMEBUFFER,qe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ye,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,qe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ye,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,qe.__webglMultisampledFramebuffer);const Ce=ue.texture.mipmaps;Ce&&Ce.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,qe.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,qe.__webglFramebuffer);for(let Ye=0;Ye<Q.length;Ye++){if(ue.resolveDepthBuffer&&(ue.depthBuffer&&(Ae|=t.DEPTH_BUFFER_BIT),ue.stencilBuffer&&ue.resolveStencilBuffer&&(Ae|=t.STENCIL_BUFFER_BIT)),Ee){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,qe.__webglColorRenderbuffer[Ye]);const Ze=r.get(Q[Ye]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ze,0)}t.blitFramebuffer(0,0,fe,Se,0,0,fe,Se,Ae,t.NEAREST),l===!0&&(ke.length=0,we.length=0,ke.push(t.COLOR_ATTACHMENT0+Ye),ue.depthBuffer&&ue.resolveDepthBuffer===!1&&(ke.push(ve),we.push(ve),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,we)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ke))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),Ee)for(let Ye=0;Ye<Q.length;Ye++){n.bindFramebuffer(t.FRAMEBUFFER,qe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ye,t.RENDERBUFFER,qe.__webglColorRenderbuffer[Ye]);const Ze=r.get(Q[Ye]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,qe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ye,t.TEXTURE_2D,Ze,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,qe.__webglMultisampledFramebuffer)}else if(ue.depthBuffer&&ue.resolveDepthBuffer===!1&&l){const Q=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Q])}}}function oe(ue){return Math.min(i.maxSamples,ue.samples)}function _e(ue){const Q=r.get(ue);return ue.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Q.__useRenderToTexture!==!1}function Fe(ue){const Q=o.render.frame;d.get(ue)!==Q&&(d.set(ue,Q),ue.update())}function Ue(ue,Q){const fe=ue.colorSpace,Se=ue.format,Ae=ue.type;return ue.isCompressedTexture===!0||ue.isVideoTexture===!0||fe!==am&&fe!==op&&(ai.getTransfer(fe)===zi?(Se!==ml||Ae!==Bl)&&gn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Un("WebGLTextures: Unsupported texture color space:",fe)),Q}function Oe(ue){return typeof HTMLImageElement<"u"&&ue instanceof HTMLImageElement?(c.width=ue.naturalWidth||ue.width,c.height=ue.naturalHeight||ue.height):typeof VideoFrame<"u"&&ue instanceof VideoFrame?(c.width=ue.displayWidth,c.height=ue.displayHeight):(c.width=ue.width,c.height=ue.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=U,this.setTexture2D=$,this.setTexture2DArray=X,this.setTexture3D=Z,this.setTextureCube=K,this.rebindTextures=xe,this.setupRenderTarget=Pe,this.updateRenderTargetMipmap=me,this.updateMultisampleRenderTarget=Te,this.setupDepthRenderbuffer=be,this.setupFrameBufferTexture=le,this.useMultisampledRTT=_e,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function kK(t,e){function n(r,i=op){let s;const o=ai.getTransfer(i);if(r===Bl)return t.UNSIGNED_BYTE;if(r===cC)return t.UNSIGNED_SHORT_4_4_4_4;if(r===uC)return t.UNSIGNED_SHORT_5_5_5_1;if(r===r9)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===i9)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===t9)return t.BYTE;if(r===n9)return t.SHORT;if(r===ly)return t.UNSIGNED_SHORT;if(r===lC)return t.INT;if(r===id)return t.UNSIGNED_INT;if(r===Wl)return t.FLOAT;if(r===uh)return t.HALF_FLOAT;if(r===s9)return t.ALPHA;if(r===o9)return t.RGB;if(r===ml)return t.RGBA;if(r===dh)return t.DEPTH_COMPONENT;if(r===W0)return t.DEPTH_STENCIL;if(r===dC)return t.RED;if(r===Tw)return t.RED_INTEGER;if(r===mx)return t.RG;if(r===fC)return t.RG_INTEGER;if(r===hC)return t.RGBA_INTEGER;if(r===G_||r===W_||r===$_||r===q_)if(o===zi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===G_)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===W_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===$_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===q_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===G_)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===W_)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===$_)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===q_)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===n5||r===r5||r===i5||r===s5)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===n5)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===r5)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===i5)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===s5)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===o5||r===a5||r===l5||r===c5||r===u5||r===d5||r===f5)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===o5||r===a5)return o===zi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===l5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===c5)return s.COMPRESSED_R11_EAC;if(r===u5)return s.COMPRESSED_SIGNED_R11_EAC;if(r===d5)return s.COMPRESSED_RG11_EAC;if(r===f5)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===h5||r===p5||r===m5||r===g5||r===x5||r===v5||r===y5||r===b5||r===_5||r===S5||r===w5||r===M5||r===T5||r===C5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===h5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===p5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===m5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===g5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===x5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===v5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===y5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===b5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===_5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===S5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===w5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===M5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===T5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===C5)return o===zi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===E5||r===A5||r===N5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===E5)return o===zi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===A5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===N5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===R5||r===k5||r===D5||r===P5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===R5)return s.COMPRESSED_RED_RGTC1_EXT;if(r===k5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===D5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===P5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===cy?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const xCe=`
void main() {

	gl_Position = vec4( position, 1.0 );

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

void main() {

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

	if ( coord.x >= 1.0 ) {

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

	} else {

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

	}

}`;class yCe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new g9(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new uu({vertexShader:xCe,fragmentShader:vCe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Fs(new Np(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bCe extends yh{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,p=null,m=null,x=null,b=null;const _=typeof XRWebGLBinding<"u",S=new yCe,w={},C=n.getContextAttributes();let A=null,N=null;const D=[],P=[],O=new Ht;let R=null;const L=new Js;L.viewport=new fi;const V=new Js;V.viewport=new fi;const F=[L,V],U=new xK;let W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(te){let se=D[te];return se===void 0&&(se=new $M,D[te]=se),se.getTargetRaySpace()},this.getControllerGrip=function(te){let se=D[te];return se===void 0&&(se=new $M,D[te]=se),se.getGripSpace()},this.getHand=function(te){let se=D[te];return se===void 0&&(se=new $M,D[te]=se),se.getHandSpace()};function $(te){const se=P.indexOf(te.inputSource);if(se===-1)return;const le=D[se];le!==void 0&&(le.update(te.inputSource,te.frame,c||o),le.dispatchEvent({type:te.type,data:te.inputSource}))}function X(){i.removeEventListener("select",$),i.removeEventListener("selectstart",$),i.removeEventListener("selectend",$),i.removeEventListener("squeeze",$),i.removeEventListener("squeezestart",$),i.removeEventListener("squeezeend",$),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",Z);for(let te=0;te<D.length;te++){const se=P[te];se!==null&&(P[te]=null,D[te].disconnect(se))}W=null,Y=null,S.reset();for(const te in w)delete w[te];e.setRenderTarget(A),x=null,m=null,p=null,i=null,N=null,ce.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(O.width,O.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(te){s=te,r.isPresenting===!0&&gn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(te){a=te,r.isPresenting===!0&&gn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(te){c=te},this.getBaseLayer=function(){return m!==null?m:x},this.getBinding=function(){return p===null&&_&&(p=new XRWebGLBinding(i,n)),p},this.getFrame=function(){return b},this.getSession=function(){return i},this.setSession=async function(te){if(i=te,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",$),i.addEventListener("selectstart",$),i.addEventListener("selectend",$),i.addEventListener("squeeze",$),i.addEventListener("squeezestart",$),i.addEventListener("squeezeend",$),i.addEventListener("end",X),i.addEventListener("inputsourceschange",Z),C.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(O),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let le=null,re=null,pe=null;C.depth&&(pe=C.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=C.stencil?W0:dh,re=C.stencil?cy:id);const be={colorFormat:n.RGBA8,depthFormat:pe,scaleFactor:s};p=this.getBinding(),m=p.createProjectionLayer(be),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),N=new lu(m.textureWidth,m.textureHeight,{format:ml,type:Bl,depthTexture:new fy(m.textureWidth,m.textureHeight,re,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const le={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(i,n,le),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),N=new lu(x.framebufferWidth,x.framebufferHeight,{format:ml,type:Bl,colorSpace:e.outputColorSpace,stencilBuffer:C.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),ce.setContext(i),ce.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function Z(te){for(let se=0;se<te.removed.length;se++){const le=te.removed[se],re=P.indexOf(le);re>=0&&(P[re]=null,D[re].disconnect(le))}for(let se=0;se<te.added.length;se++){const le=te.added[se];let re=P.indexOf(le);if(re===-1){for(let be=0;be<D.length;be++)if(be>=P.length){P.push(le),re=be;break}else if(P[be]===null){P[be]=le,re=be;break}if(re===-1)break}const pe=D[re];pe&&pe.connect(le)}}const K=new He,ne=new He;function H(te,se,le){K.setFromMatrixPosition(se.matrixWorld),ne.setFromMatrixPosition(le.matrixWorld);const re=K.distanceTo(ne),pe=se.projectionMatrix.elements,be=le.projectionMatrix.elements,xe=pe[14]/(pe[10]-1),Pe=pe[14]/(pe[10]+1),me=(pe[9]+1)/pe[5],ke=(pe[9]-1)/pe[5],we=(pe[8]-1)/pe[0],Te=(be[8]+1)/be[0],oe=xe*we,_e=xe*Te,Fe=re/(-we+Te),Ue=Fe*-we;if(se.matrixWorld.decompose(te.position,te.quaternion,te.scale),te.translateX(Ue),te.translateZ(Fe),te.matrixWorld.compose(te.position,te.quaternion,te.scale),te.matrixWorldInverse.copy(te.matrixWorld).invert(),pe[10]===-1)te.projectionMatrix.copy(se.projectionMatrix),te.projectionMatrixInverse.copy(se.projectionMatrixInverse);else{const Oe=xe+Fe,ue=Pe+Fe,Q=oe-Ue,fe=_e+(re-Ue),Se=me*Pe/ue*Oe,Ae=ke*Pe/ue*Oe;te.projectionMatrix.makePerspective(Q,fe,Se,Ae,Oe,ue),te.projectionMatrixInverse.copy(te.projectionMatrix).invert()}}function B(te,se){se===null?te.matrixWorld.copy(te.matrix):te.matrixWorld.multiplyMatrices(se.matrixWorld,te.matrix),te.matrixWorldInverse.copy(te.matrixWorld).invert()}this.updateCamera=function(te){if(i===null)return;let se=te.near,le=te.far;S.texture!==null&&(S.depthNear>0&&(se=S.depthNear),S.depthFar>0&&(le=S.depthFar)),U.near=V.near=L.near=se,U.far=V.far=L.far=le,(W!==U.near||Y!==U.far)&&(i.updateRenderState({depthNear:U.near,depthFar:U.far}),W=U.near,Y=U.far),U.layers.mask=te.layers.mask|6,L.layers.mask=U.layers.mask&-5,V.layers.mask=U.layers.mask&-3;const re=te.parent,pe=U.cameras;B(U,re);for(let be=0;be<pe.length;be++)B(pe[be],re);pe.length===2?H(U,L,V):U.projectionMatrix.copy(L.projectionMatrix),G(te,U,re)};function G(te,se,le){le===null?te.matrix.copy(se.matrixWorld):(te.matrix.copy(le.matrixWorld),te.matrix.invert(),te.matrix.multiply(se.matrixWorld)),te.matrix.decompose(te.position,te.quaternion,te.scale),te.updateMatrixWorld(!0),te.projectionMatrix.copy(se.projectionMatrix),te.projectionMatrixInverse.copy(se.projectionMatrixInverse),te.isPerspectiveCamera&&(te.fov=uy*2*Math.atan(1/te.projectionMatrix.elements[5]),te.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(m===null&&x===null))return l},this.setFoveation=function(te){l=te,m!==null&&(m.fixedFoveation=te),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=te)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(U)},this.getCameraTexture=function(te){return w[te]};let j=null;function ie(te,se){if(d=se.getViewerPose(c||o),b=se,d!==null){const le=d.views;x!==null&&(e.setRenderTargetFramebuffer(N,x.framebuffer),e.setRenderTarget(N));let re=!1;le.length!==U.cameras.length&&(U.cameras.length=0,re=!0);for(let Pe=0;Pe<le.length;Pe++){const me=le[Pe];let ke=null;if(x!==null)ke=x.getViewport(me);else{const Te=p.getViewSubImage(m,me);ke=Te.viewport,Pe===0&&(e.setRenderTargetTextures(N,Te.colorTexture,Te.depthStencilTexture),e.setRenderTarget(N))}let we=F[Pe];we===void 0&&(we=new Js,we.layers.enable(Pe),we.viewport=new fi,F[Pe]=we),we.matrix.fromArray(me.transform.matrix),we.matrix.decompose(we.position,we.quaternion,we.scale),we.projectionMatrix.fromArray(me.projectionMatrix),we.projectionMatrixInverse.copy(we.projectionMatrix).invert(),we.viewport.set(ke.x,ke.y,ke.width,ke.height),Pe===0&&(U.matrix.copy(we.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),re===!0&&U.cameras.push(we)}const pe=i.enabledFeatures;if(pe&&pe.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){p=r.getBinding();const Pe=p.getDepthInformation(le[0]);Pe&&Pe.isValid&&Pe.texture&&S.init(Pe,i.renderState)}if(pe&&pe.includes("camera-access")&&_){e.state.unbindTexture(),p=r.getBinding();for(let Pe=0;Pe<le.length;Pe++){const me=le[Pe].camera;if(me){let ke=w[me];ke||(ke=new g9,w[me]=ke);const we=p.getCameraImage(me);ke.sourceTexture=we}}}}for(let le=0;le<D.length;le++){const re=P[le],pe=D[le];re!==null&&pe!==void 0&&pe.update(re,se,c||o)}j&&j(te,se),se.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:se}),b=null}const ce=new CK;ce.setAnimationLoop(ie),this.setAnimationLoop=function(te){j=te},this.dispose=function(){}}}const Cg=new cu,_Ce=new sr;function SCe(t,e){function n(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function r(S,w){w.color.getRGB(S.fogColor.value,XY(t)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function i(S,w,C,A,N){w.isMeshBasicMaterial?s(S,w):w.isMeshLambertMaterial?(s(S,w),w.envMap&&(S.envMapIntensity.value=w.envMapIntensity)):w.isMeshToonMaterial?(s(S,w),p(S,w)):w.isMeshPhongMaterial?(s(S,w),d(S,w),w.envMap&&(S.envMapIntensity.value=w.envMapIntensity)):w.isMeshStandardMaterial?(s(S,w),m(S,w),w.isMeshPhysicalMaterial&&x(S,w,N)):w.isMeshMatcapMaterial?(s(S,w),b(S,w)):w.isMeshDepthMaterial?s(S,w):w.isMeshDistanceMaterial?(s(S,w),_(S,w)):w.isMeshNormalMaterial?s(S,w):w.isLineBasicMaterial?(o(S,w),w.isLineDashedMaterial&&a(S,w)):w.isPointsMaterial?l(S,w,C,A):w.isSpriteMaterial?c(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function s(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,n(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,n(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,n(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===$l&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,n(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===$l&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,n(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,n(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,n(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);const C=e.get(w),A=C.envMap,N=C.envMapRotation;A&&(S.envMap.value=A,Cg.copy(N),Cg.x*=-1,Cg.y*=-1,Cg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Cg.y*=-1,Cg.z*=-1),S.envMapRotation.value.setFromMatrix4(_Ce.makeRotationFromEuler(Cg)),S.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap&&(S.lightMap.value=w.lightMap,S.lightMapIntensity.value=w.lightMapIntensity,n(w.lightMap,S.lightMapTransform)),w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,n(w.aoMap,S.aoMapTransform))}function o(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,n(w.map,S.mapTransform))}function a(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function l(S,w,C,A){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*C,S.scale.value=A*.5,w.map&&(S.map.value=w.map,n(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,n(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function c(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,n(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,n(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function d(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function p(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function m(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,n(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,n(w.roughnessMap,S.roughnessMapTransform)),w.envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function x(S,w,C){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,n(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,n(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,n(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,n(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,n(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===$l&&S.clearcoatNormalScale.value.negate())),w.dispersion>0&&(S.dispersion.value=w.dispersion),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,n(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,n(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=C.texture,S.transmissionSamplerSize.value.set(C.width,C.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,n(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,n(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,n(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,n(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,n(w.specularIntensityMap,S.specularIntensityMapTransform))}function b(S,w){w.matcap&&(S.matcap.value=w.matcap)}function _(S,w){const C=e.get(w).light;S.referencePosition.value.setFromMatrixPosition(C.matrixWorld),S.nearDistance.value=C.shadow.camera.near,S.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function wCe(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,A){const N=A.program;r.uniformBlockBinding(C,N)}function c(C,A){let N=i[C.id];N===void 0&&(b(C),N=d(C),i[C.id]=N,C.addEventListener("dispose",S));const D=A.program;r.updateUBOMapping(C,D);const P=e.render.frame;s[C.id]!==P&&(m(C),s[C.id]=P)}function d(C){const A=p();C.__bindingPointIndex=A;const N=t.createBuffer(),D=C.__size,P=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,D,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,N),N}function p(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Un("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(C){const A=i[C.id],N=C.uniforms,D=C.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let P=0,O=N.length;P<O;P++){const R=Array.isArray(N[P])?N[P]:[N[P]];for(let L=0,V=R.length;L<V;L++){const F=R[L];if(x(F,P,L,D)===!0){const U=F.__offset,W=Array.isArray(F.value)?F.value:[F.value];let Y=0;for(let $=0;$<W.length;$++){const X=W[$],Z=_(X);typeof X=="number"||typeof X=="boolean"?(F.__data[0]=X,t.bufferSubData(t.UNIFORM_BUFFER,U+Y,F.__data)):X.isMatrix3?(F.__data[0]=X.elements[0],F.__data[1]=X.elements[1],F.__data[2]=X.elements[2],F.__data[3]=0,F.__data[4]=X.elements[3],F.__data[5]=X.elements[4],F.__data[6]=X.elements[5],F.__data[7]=0,F.__data[8]=X.elements[6],F.__data[9]=X.elements[7],F.__data[10]=X.elements[8],F.__data[11]=0):(X.toArray(F.__data,Y),Y+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,U,F.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function x(C,A,N,D){const P=C.value,O=A+"_"+N;if(D[O]===void 0)return typeof P=="number"||typeof P=="boolean"?D[O]=P:D[O]=P.clone(),!0;{const R=D[O];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return D[O]=P,!0}else if(R.equals(P)===!1)return R.copy(P),!0}return!1}function b(C){const A=C.uniforms;let N=0;const D=16;for(let O=0,R=A.length;O<R;O++){const L=Array.isArray(A[O])?A[O]:[A[O]];for(let V=0,F=L.length;V<F;V++){const U=L[V],W=Array.isArray(U.value)?U.value:[U.value];for(let Y=0,$=W.length;Y<$;Y++){const X=W[Y],Z=_(X),K=N%D,ne=K%Z.boundary,H=K+ne;N+=ne,H!==0&&D-H<Z.storage&&(N+=D-H),U.__data=new Float32Array(Z.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=N,N+=Z.storage}}}const P=N%D;return P>0&&(N+=D-P),C.__size=N,C.__cache={},this}function _(C){const A={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(A.boundary=4,A.storage=4):C.isVector2?(A.boundary=8,A.storage=8):C.isVector3||C.isColor?(A.boundary=16,A.storage=12):C.isVector4?(A.boundary=16,A.storage=16):C.isMatrix3?(A.boundary=48,A.storage=48):C.isMatrix4?(A.boundary=64,A.storage=64):C.isTexture?gn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):gn("WebGLRenderer: Unsupported uniform value type.",C),A}function S(C){const A=C.target;A.removeEventListener("dispose",S);const N=o.indexOf(A.__bindingPointIndex);o.splice(N,1),t.deleteBuffer(i[A.id]),delete i[A.id],delete s[A.id]}function w(){for(const C in i)t.deleteBuffer(i[C]);o=[],i={},s={}}return{bind:l,update:c,dispose:w}}const MCe=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 Of=null;function TCe(){return Of===null&&(Of=new Yd(MCe,16,16,mx,uh),Of.name="DFG_LUT",Of.minFilter=rs,Of.magFilter=rs,Of.wrapS=Ec,Of.wrapT=Ec,Of.generateMipmaps=!1,Of.needsUpdate=!0),Of}class DK{constructor(e={}){const{canvas:n=wY(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:m=!1,outputBufferType:x=Bl}=e;this.isWebGLRenderer=!0;let b;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=r.getContextAttributes().alpha}else b=o;const _=x,S=new Set([hC,fC,Tw]),w=new Set([Bl,id,ly,cy,cC,uC]),C=new Uint32Array(4),A=new Int32Array(4);let N=null,D=null;const P=[],O=[];let R=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=ou,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let V=!1;this._outputColorSpace=pl;let F=0,U=0,W=null,Y=-1,$=null;const X=new fi,Z=new fi;let K=null;const ne=new Sn(0);let H=0,B=n.width,G=n.height,j=1,ie=null,ce=null;const te=new fi(0,0,B,G),se=new fi(0,0,B,G);let le=!1;const re=new zy;let pe=!1,be=!1;const xe=new sr,Pe=new He,me=new fi,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let we=!1;function Te(){return W===null?j:1}let oe=r;function _e(ge,rt){return n.getContext(ge,rt)}try{const ge={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${ww}`),n.addEventListener("webglcontextlost",Ke,!1),n.addEventListener("webglcontextrestored",je,!1),n.addEventListener("webglcontextcreationerror",et,!1),oe===null){const rt="webgl2";if(oe=_e(rt,ge),oe===null)throw _e(rt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ge){throw Un("WebGLRenderer: "+ge.message),ge}let Fe,Ue,Oe,ue,Q,fe,Se,Ae,ve,qe,Ee,Ce,Ye,Ze,it,ut,De,Ve,lt,Le,Ne,$e,ft;function nt(){Fe=new E5e(oe),Fe.init(),Ne=new kK(oe,Fe),Ue=new y5e(oe,Fe,e,Ne),Oe=new mCe(oe,Fe),Ue.reversedDepthBuffer&&m&&Oe.buffers.depth.setReversed(!0),ue=new R5e(oe),Q=new tCe,fe=new gCe(oe,Fe,Oe,Q,Ue,Ne,ue),Se=new C5e(L),Ae=new O4e(oe),$e=new x5e(oe,Ae),ve=new A5e(oe,Ae,ue,$e),qe=new D5e(oe,ve,Ae,$e,ue),Ve=new k5e(oe,Ue,fe),it=new b5e(Q),Ee=new eCe(L,Se,Fe,Ue,$e,it),Ce=new SCe(L,Q),Ye=new rCe,Ze=new cCe(Fe),De=new g5e(L,Se,Oe,qe,b,l),ut=new pCe(L,qe,Ue),ft=new wCe(oe,ue,Ue,Oe),lt=new v5e(oe,Fe,ue),Le=new N5e(oe,Fe,ue),ue.programs=Ee.programs,L.capabilities=Ue,L.extensions=Fe,L.properties=Q,L.renderLists=Ye,L.shadowMap=ut,L.state=Oe,L.info=ue}nt(),_!==Bl&&(R=new I5e(_,n.width,n.height,i,s));const We=new bCe(L,oe);this.xr=We,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const ge=Fe.get("WEBGL_lose_context");ge&&ge.loseContext()},this.forceContextRestore=function(){const ge=Fe.get("WEBGL_lose_context");ge&&ge.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(ge){ge!==void 0&&(j=ge,this.setSize(B,G,!1))},this.getSize=function(ge){return ge.set(B,G)},this.setSize=function(ge,rt,bt=!0){if(We.isPresenting){gn("WebGLRenderer: Can't change size while VR device is presenting.");return}B=ge,G=rt,n.width=Math.floor(ge*j),n.height=Math.floor(rt*j),bt===!0&&(n.style.width=ge+"px",n.style.height=rt+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,ge,rt)},this.getDrawingBufferSize=function(ge){return ge.set(B*j,G*j).floor()},this.setDrawingBufferSize=function(ge,rt,bt){B=ge,G=rt,j=bt,n.width=Math.floor(ge*bt),n.height=Math.floor(rt*bt),this.setViewport(0,0,ge,rt)},this.setEffects=function(ge){if(_===Bl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ge){for(let rt=0;rt<ge.length;rt++)if(ge[rt].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}R.setEffects(ge||[])},this.getCurrentViewport=function(ge){return ge.copy(X)},this.getViewport=function(ge){return ge.copy(te)},this.setViewport=function(ge,rt,bt,vt){ge.isVector4?te.set(ge.x,ge.y,ge.z,ge.w):te.set(ge,rt,bt,vt),Oe.viewport(X.copy(te).multiplyScalar(j).round())},this.getScissor=function(ge){return ge.copy(se)},this.setScissor=function(ge,rt,bt,vt){ge.isVector4?se.set(ge.x,ge.y,ge.z,ge.w):se.set(ge,rt,bt,vt),Oe.scissor(Z.copy(se).multiplyScalar(j).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(ge){Oe.setScissorTest(le=ge)},this.setOpaqueSort=function(ge){ie=ge},this.setTransparentSort=function(ge){ce=ge},this.getClearColor=function(ge){return ge.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(ge=!0,rt=!0,bt=!0){let vt=0;if(ge){let gt=!1;if(W!==null){const Xt=W.texture.format;gt=S.has(Xt)}if(gt){const Xt=W.texture.type,Jt=w.has(Xt),Kt=De.getClearColor(),Zt=De.getClearAlpha(),xn=Kt.r,On=Kt.g,Wn=Kt.b;Jt?(C[0]=xn,C[1]=On,C[2]=Wn,C[3]=Zt,oe.clearBufferuiv(oe.COLOR,0,C)):(A[0]=xn,A[1]=On,A[2]=Wn,A[3]=Zt,oe.clearBufferiv(oe.COLOR,0,A))}else vt|=oe.COLOR_BUFFER_BIT}rt&&(vt|=oe.DEPTH_BUFFER_BIT),bt&&(vt|=oe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),vt!==0&&oe.clear(vt)},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",Ke,!1),n.removeEventListener("webglcontextrestored",je,!1),n.removeEventListener("webglcontextcreationerror",et,!1),De.dispose(),Ye.dispose(),Ze.dispose(),Q.dispose(),Se.dispose(),qe.dispose(),$e.dispose(),ft.dispose(),Ee.dispose(),We.dispose(),We.removeEventListener("sessionstart",Dt),We.removeEventListener("sessionend",Et),Be.stop()};function Ke(ge){ge.preventDefault(),AS("WebGLRenderer: Context Lost."),V=!0}function je(){AS("WebGLRenderer: Context Restored."),V=!1;const ge=ue.autoReset,rt=ut.enabled,bt=ut.autoUpdate,vt=ut.needsUpdate,gt=ut.type;nt(),ue.autoReset=ge,ut.enabled=rt,ut.autoUpdate=bt,ut.needsUpdate=vt,ut.type=gt}function et(ge){Un("WebGLRenderer: A WebGL context could not be created. Reason: ",ge.statusMessage)}function pt(ge){const rt=ge.target;rt.removeEventListener("dispose",pt),Lt(rt)}function Lt(ge){wt(ge),Q.remove(ge)}function wt(ge){const rt=Q.get(ge).programs;rt!==void 0&&(rt.forEach(function(bt){Ee.releaseProgram(bt)}),ge.isShaderMaterial&&Ee.releaseShaderCache(ge))}this.renderBufferDirect=function(ge,rt,bt,vt,gt,Xt){rt===null&&(rt=ke);const Jt=gt.isMesh&&gt.matrixWorld.determinant()<0,Kt=nn(ge,rt,bt,vt,gt);Oe.setMaterial(vt,Jt);let Zt=bt.index,xn=1;if(vt.wireframe===!0){if(Zt=ve.getWireframeAttribute(bt),Zt===void 0)return;xn=2}const On=bt.drawRange,Wn=bt.attributes.position;let fn=On.start*xn,or=(On.start+On.count)*xn;Xt!==null&&(fn=Math.max(fn,Xt.start*xn),or=Math.min(or,(Xt.start+Xt.count)*xn)),Zt!==null?(fn=Math.max(fn,0),or=Math.min(or,Zt.count)):Wn!=null&&(fn=Math.max(fn,0),or=Math.min(or,Wn.count));const Kr=or-fn;if(Kr<0||Kr===1/0)return;$e.setup(gt,vt,Kt,bt,Zt);let ni,fr=lt;if(Zt!==null&&(ni=Ae.get(Zt),fr=Le,fr.setIndex(ni)),gt.isMesh)vt.wireframe===!0?(Oe.setLineWidth(vt.wireframeLinewidth*Te()),fr.setMode(oe.LINES)):fr.setMode(oe.TRIANGLES);else if(gt.isLine){let kr=vt.linewidth;kr===void 0&&(kr=1),Oe.setLineWidth(kr*Te()),gt.isLineSegments?fr.setMode(oe.LINES):gt.isLineLoop?fr.setMode(oe.LINE_LOOP):fr.setMode(oe.LINE_STRIP)}else gt.isPoints?fr.setMode(oe.POINTS):gt.isSprite&&fr.setMode(oe.TRIANGLES);if(gt.isBatchedMesh)if(gt._multiDrawInstances!==null)NS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),fr.renderMultiDrawInstances(gt._multiDrawStarts,gt._multiDrawCounts,gt._multiDrawCount,gt._multiDrawInstances);else if(Fe.get("WEBGL_multi_draw"))fr.renderMultiDraw(gt._multiDrawStarts,gt._multiDrawCounts,gt._multiDrawCount);else{const kr=gt._multiDrawStarts,ln=gt._multiDrawCounts,ss=gt._multiDrawCount,Dn=Zt?Ae.get(Zt).bytesPerElement:1,ms=Q.get(vt).currentProgram.getUniforms();for(let Ns=0;Ns<ss;Ns++)ms.setValue(oe,"_gl_DrawID",Ns),fr.render(kr[Ns]/Dn,ln[Ns])}else if(gt.isInstancedMesh)fr.renderInstances(fn,Kr,gt.count);else if(bt.isInstancedBufferGeometry){const kr=bt._maxInstanceCount!==void 0?bt._maxInstanceCount:1/0,ln=Math.min(bt.instanceCount,kr);fr.renderInstances(fn,Kr,ln)}else fr.render(fn,Kr)};function yt(ge,rt,bt){ge.transparent===!0&&ge.side===Kc&&ge.forceSinglePass===!1?(ge.side=$l,ge.needsUpdate=!0,Ut(ge,rt,bt),ge.side=_p,ge.needsUpdate=!0,Ut(ge,rt,bt),ge.side=Kc):Ut(ge,rt,bt)}this.compile=function(ge,rt,bt=null){bt===null&&(bt=ge),D=Ze.get(bt),D.init(rt),O.push(D),bt.traverseVisible(function(gt){gt.isLight&&gt.layers.test(rt.layers)&&(D.pushLight(gt),gt.castShadow&&D.pushShadow(gt))}),ge!==bt&&ge.traverseVisible(function(gt){gt.isLight&&gt.layers.test(rt.layers)&&(D.pushLight(gt),gt.castShadow&&D.pushShadow(gt))}),D.setupLights();const vt=new Set;return ge.traverse(function(gt){if(!(gt.isMesh||gt.isPoints||gt.isLine||gt.isSprite))return;const Xt=gt.material;if(Xt)if(Array.isArray(Xt))for(let Jt=0;Jt<Xt.length;Jt++){const Kt=Xt[Jt];yt(Kt,bt,gt),vt.add(Kt)}else yt(Xt,bt,gt),vt.add(Xt)}),D=O.pop(),vt},this.compileAsync=function(ge,rt,bt=null){const vt=this.compile(ge,rt,bt);return new Promise(gt=>{function Xt(){if(vt.forEach(function(Jt){Q.get(Jt).currentProgram.isReady()&&vt.delete(Jt)}),vt.size===0){gt(ge);return}setTimeout(Xt,10)}Fe.get("KHR_parallel_shader_compile")!==null?Xt():setTimeout(Xt,10)})};let Pt=null;function zt(ge){Pt&&Pt(ge)}function Dt(){Be.stop()}function Et(){Be.start()}const Be=new CK;Be.setAnimationLoop(zt),typeof self<"u"&&Be.setContext(self),this.setAnimationLoop=function(ge){Pt=ge,We.setAnimationLoop(ge),ge===null?Be.stop():Be.start()},We.addEventListener("sessionstart",Dt),We.addEventListener("sessionend",Et),this.render=function(ge,rt){if(rt!==void 0&&rt.isCamera!==!0){Un("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;const bt=We.enabled===!0&&We.isPresenting===!0,vt=R!==null&&(W===null||bt)&&R.begin(L,W);if(ge.matrixWorldAutoUpdate===!0&&ge.updateMatrixWorld(),rt.parent===null&&rt.matrixWorldAutoUpdate===!0&&rt.updateMatrixWorld(),We.enabled===!0&&We.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(We.cameraAutoUpdate===!0&&We.updateCamera(rt),rt=We.getCamera()),ge.isScene===!0&&ge.onBeforeRender(L,ge,rt,W),D=Ze.get(ge,O.length),D.init(rt),O.push(D),xe.multiplyMatrices(rt.projectionMatrix,rt.matrixWorldInverse),re.setFromProjectionMatrix(xe,tu,rt.reversedDepth),be=this.localClippingEnabled,pe=it.init(this.clippingPlanes,be),N=Ye.get(ge,P.length),N.init(),P.push(N),We.enabled===!0&&We.isPresenting===!0){const Jt=L.xr.getDepthSensingMesh();Jt!==null&&Qe(Jt,rt,-1/0,L.sortObjects)}Qe(ge,rt,0,L.sortObjects),N.finish(),L.sortObjects===!0&&N.sort(ie,ce),we=We.enabled===!1||We.isPresenting===!1||We.hasDepthSensing()===!1,we&&De.addToRenderList(N,ge),this.info.render.frame++,pe===!0&&it.beginShadows();const gt=D.state.shadowsArray;if(ut.render(gt,ge,rt),pe===!0&&it.endShadows(),this.info.autoReset===!0&&this.info.reset(),(vt&&R.hasRenderPass())===!1){const Jt=N.opaque,Kt=N.transmissive;if(D.setupLights(),rt.isArrayCamera){const Zt=rt.cameras;if(Kt.length>0)for(let xn=0,On=Zt.length;xn<On;xn++){const Wn=Zt[xn];It(Jt,Kt,ge,Wn)}we&&De.render(ge);for(let xn=0,On=Zt.length;xn<On;xn++){const Wn=Zt[xn];ht(N,ge,Wn,Wn.viewport)}}else Kt.length>0&&It(Jt,Kt,ge,rt),we&&De.render(ge),ht(N,ge,rt)}W!==null&&U===0&&(fe.updateMultisampleRenderTarget(W),fe.updateRenderTargetMipmap(W)),vt&&R.end(L),ge.isScene===!0&&ge.onAfterRender(L,ge,rt),$e.resetDefaultState(),Y=-1,$=null,O.pop(),O.length>0?(D=O[O.length-1],pe===!0&&it.setGlobalState(L.clippingPlanes,D.state.camera)):D=null,P.pop(),P.length>0?N=P[P.length-1]:N=null};function Qe(ge,rt,bt,vt){if(ge.visible===!1)return;if(ge.layers.test(rt.layers)){if(ge.isGroup)bt=ge.renderOrder;else if(ge.isLOD)ge.autoUpdate===!0&&ge.update(rt);else if(ge.isLight)D.pushLight(ge),ge.castShadow&&D.pushShadow(ge);else if(ge.isSprite){if(!ge.frustumCulled||re.intersectsSprite(ge)){vt&&me.setFromMatrixPosition(ge.matrixWorld).applyMatrix4(xe);const Jt=qe.update(ge),Kt=ge.material;Kt.visible&&N.push(ge,Jt,Kt,bt,me.z,null)}}else if((ge.isMesh||ge.isLine||ge.isPoints)&&(!ge.frustumCulled||re.intersectsObject(ge))){const Jt=qe.update(ge),Kt=ge.material;if(vt&&(ge.boundingSphere!==void 0?(ge.boundingSphere===null&&ge.computeBoundingSphere(),me.copy(ge.boundingSphere.center)):(Jt.boundingSphere===null&&Jt.computeBoundingSphere(),me.copy(Jt.boundingSphere.center)),me.applyMatrix4(ge.matrixWorld).applyMatrix4(xe)),Array.isArray(Kt)){const Zt=Jt.groups;for(let xn=0,On=Zt.length;xn<On;xn++){const Wn=Zt[xn],fn=Kt[Wn.materialIndex];fn&&fn.visible&&N.push(ge,Jt,fn,bt,me.z,Wn)}}else Kt.visible&&N.push(ge,Jt,Kt,bt,me.z,null)}}const Xt=ge.children;for(let Jt=0,Kt=Xt.length;Jt<Kt;Jt++)Qe(Xt[Jt],rt,bt,vt)}function ht(ge,rt,bt,vt){const{opaque:gt,transmissive:Xt,transparent:Jt}=ge;D.setupLightsView(bt),pe===!0&&it.setGlobalState(L.clippingPlanes,bt),vt&&Oe.viewport(X.copy(vt)),gt.length>0&&Tt(gt,rt,bt),Xt.length>0&&Tt(Xt,rt,bt),Jt.length>0&&Tt(Jt,rt,bt),Oe.buffers.depth.setTest(!0),Oe.buffers.depth.setMask(!0),Oe.buffers.color.setMask(!0),Oe.setPolygonOffset(!1)}function It(ge,rt,bt,vt){if((bt.isScene===!0?bt.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[vt.id]===void 0){const fn=Fe.has("EXT_color_buffer_half_float")||Fe.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[vt.id]=new lu(1,1,{generateMipmaps:!0,type:fn?uh:Bl,minFilter:Jf,samples:Ue.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ai.workingColorSpace})}const Xt=D.state.transmissionRenderTarget[vt.id],Jt=vt.viewport||X;Xt.setSize(Jt.z*L.transmissionResolutionScale,Jt.w*L.transmissionResolutionScale);const Kt=L.getRenderTarget(),Zt=L.getActiveCubeFace(),xn=L.getActiveMipmapLevel();L.setRenderTarget(Xt),L.getClearColor(ne),H=L.getClearAlpha(),H<1&&L.setClearColor(16777215,.5),L.clear(),we&&De.render(bt);const On=L.toneMapping;L.toneMapping=ou;const Wn=vt.viewport;if(vt.viewport!==void 0&&(vt.viewport=void 0),D.setupLightsView(vt),pe===!0&&it.setGlobalState(L.clippingPlanes,vt),Tt(ge,bt,vt),fe.updateMultisampleRenderTarget(Xt),fe.updateRenderTargetMipmap(Xt),Fe.has("WEBGL_multisampled_render_to_texture")===!1){let fn=!1;for(let or=0,Kr=rt.length;or<Kr;or++){const ni=rt[or],{object:fr,geometry:kr,material:ln,group:ss}=ni;if(ln.side===Kc&&fr.layers.test(vt.layers)){const Dn=ln.side;ln.side=$l,ln.needsUpdate=!0,ct(fr,bt,vt,kr,ln,ss),ln.side=Dn,ln.needsUpdate=!0,fn=!0}}fn===!0&&(fe.updateMultisampleRenderTarget(Xt),fe.updateRenderTargetMipmap(Xt))}L.setRenderTarget(Kt,Zt,xn),L.setClearColor(ne,H),Wn!==void 0&&(vt.viewport=Wn),L.toneMapping=On}function Tt(ge,rt,bt){const vt=rt.isScene===!0?rt.overrideMaterial:null;for(let gt=0,Xt=ge.length;gt<Xt;gt++){const Jt=ge[gt],{object:Kt,geometry:Zt,group:xn}=Jt;let On=Jt.material;On.allowOverride===!0&&vt!==null&&(On=vt),Kt.layers.test(bt.layers)&&ct(Kt,rt,bt,Zt,On,xn)}}function ct(ge,rt,bt,vt,gt,Xt){ge.onBeforeRender(L,rt,bt,vt,gt,Xt),ge.modelViewMatrix.multiplyMatrices(bt.matrixWorldInverse,ge.matrixWorld),ge.normalMatrix.getNormalMatrix(ge.modelViewMatrix),gt.onBeforeRender(L,rt,bt,vt,ge,Xt),gt.transparent===!0&&gt.side===Kc&&gt.forceSinglePass===!1?(gt.side=$l,gt.needsUpdate=!0,L.renderBufferDirect(bt,rt,vt,gt,ge,Xt),gt.side=_p,gt.needsUpdate=!0,L.renderBufferDirect(bt,rt,vt,gt,ge,Xt),gt.side=Kc):L.renderBufferDirect(bt,rt,vt,gt,ge,Xt),ge.onAfterRender(L,rt,bt,vt,gt,Xt)}function Ut(ge,rt,bt){rt.isScene!==!0&&(rt=ke);const vt=Q.get(ge),gt=D.state.lights,Xt=D.state.shadowsArray,Jt=gt.state.version,Kt=Ee.getParameters(ge,gt.state,Xt,rt,bt),Zt=Ee.getProgramCacheKey(Kt);let xn=vt.programs;vt.environment=ge.isMeshStandardMaterial||ge.isMeshLambertMaterial||ge.isMeshPhongMaterial?rt.environment:null,vt.fog=rt.fog;const On=ge.isMeshStandardMaterial||ge.isMeshLambertMaterial&&!ge.envMap||ge.isMeshPhongMaterial&&!ge.envMap;vt.envMap=Se.get(ge.envMap||vt.environment,On),vt.envMapRotation=vt.environment!==null&&ge.envMap===null?rt.environmentRotation:ge.envMapRotation,xn===void 0&&(ge.addEventListener("dispose",pt),xn=new Map,vt.programs=xn);let Wn=xn.get(Zt);if(Wn!==void 0){if(vt.currentProgram===Wn&&vt.lightsStateVersion===Jt)return sn(ge,Kt),Wn}else Kt.uniforms=Ee.getUniforms(ge),ge.onBeforeCompile(Kt,L),Wn=Ee.acquireProgram(Kt,Zt),xn.set(Zt,Wn),vt.uniforms=Kt.uniforms;const fn=vt.uniforms;return(!ge.isShaderMaterial&&!ge.isRawShaderMaterial||ge.clipping===!0)&&(fn.clippingPlanes=it.uniform),sn(ge,Kt),vt.needsLights=Hn(ge),vt.lightsStateVersion=Jt,vt.needsLights&&(fn.ambientLightColor.value=gt.state.ambient,fn.lightProbe.value=gt.state.probe,fn.directionalLights.value=gt.state.directional,fn.directionalLightShadows.value=gt.state.directionalShadow,fn.spotLights.value=gt.state.spot,fn.spotLightShadows.value=gt.state.spotShadow,fn.rectAreaLights.value=gt.state.rectArea,fn.ltc_1.value=gt.state.rectAreaLTC1,fn.ltc_2.value=gt.state.rectAreaLTC2,fn.pointLights.value=gt.state.point,fn.pointLightShadows.value=gt.state.pointShadow,fn.hemisphereLights.value=gt.state.hemi,fn.directionalShadowMatrix.value=gt.state.directionalShadowMatrix,fn.spotLightMatrix.value=gt.state.spotLightMatrix,fn.spotLightMap.value=gt.state.spotLightMap,fn.pointShadowMatrix.value=gt.state.pointShadowMatrix),vt.currentProgram=Wn,vt.uniformsList=null,Wn}function Gt(ge){if(ge.uniformsList===null){const rt=ge.currentProgram.getUniforms();ge.uniformsList=qM.seqWithValue(rt.seq,ge.uniforms)}return ge.uniformsList}function sn(ge,rt){const bt=Q.get(ge);bt.outputColorSpace=rt.outputColorSpace,bt.batching=rt.batching,bt.batchingColor=rt.batchingColor,bt.instancing=rt.instancing,bt.instancingColor=rt.instancingColor,bt.instancingMorph=rt.instancingMorph,bt.skinning=rt.skinning,bt.morphTargets=rt.morphTargets,bt.morphNormals=rt.morphNormals,bt.morphColors=rt.morphColors,bt.morphTargetsCount=rt.morphTargetsCount,bt.numClippingPlanes=rt.numClippingPlanes,bt.numIntersection=rt.numClipIntersection,bt.vertexAlphas=rt.vertexAlphas,bt.vertexTangents=rt.vertexTangents,bt.toneMapping=rt.toneMapping}function nn(ge,rt,bt,vt,gt){rt.isScene!==!0&&(rt=ke),fe.resetTextureUnits();const Xt=rt.fog,Jt=vt.isMeshStandardMaterial||vt.isMeshLambertMaterial||vt.isMeshPhongMaterial?rt.environment:null,Kt=W===null?L.outputColorSpace:W.isXRRenderTarget===!0?W.texture.colorSpace:am,Zt=vt.isMeshStandardMaterial||vt.isMeshLambertMaterial&&!vt.envMap||vt.isMeshPhongMaterial&&!vt.envMap,xn=Se.get(vt.envMap||Jt,Zt),On=vt.vertexColors===!0&&!!bt.attributes.color&&bt.attributes.color.itemSize===4,Wn=!!bt.attributes.tangent&&(!!vt.normalMap||vt.anisotropy>0),fn=!!bt.morphAttributes.position,or=!!bt.morphAttributes.normal,Kr=!!bt.morphAttributes.color;let ni=ou;vt.toneMapped&&(W===null||W.isXRRenderTarget===!0)&&(ni=L.toneMapping);const fr=bt.morphAttributes.position||bt.morphAttributes.normal||bt.morphAttributes.color,kr=fr!==void 0?fr.length:0,ln=Q.get(vt),ss=D.state.lights;if(pe===!0&&(be===!0||ge!==$)){const Pi=ge===$&&vt.id===Y;it.setState(vt,ge,Pi)}let Dn=!1;vt.version===ln.__version?(ln.needsLights&&ln.lightsStateVersion!==ss.state.version||ln.outputColorSpace!==Kt||gt.isBatchedMesh&&ln.batching===!1||!gt.isBatchedMesh&&ln.batching===!0||gt.isBatchedMesh&&ln.batchingColor===!0&&gt.colorTexture===null||gt.isBatchedMesh&&ln.batchingColor===!1&&gt.colorTexture!==null||gt.isInstancedMesh&&ln.instancing===!1||!gt.isInstancedMesh&&ln.instancing===!0||gt.isSkinnedMesh&&ln.skinning===!1||!gt.isSkinnedMesh&&ln.skinning===!0||gt.isInstancedMesh&&ln.instancingColor===!0&&gt.instanceColor===null||gt.isInstancedMesh&&ln.instancingColor===!1&&gt.instanceColor!==null||gt.isInstancedMesh&&ln.instancingMorph===!0&&gt.morphTexture===null||gt.isInstancedMesh&&ln.instancingMorph===!1&&gt.morphTexture!==null||ln.envMap!==xn||vt.fog===!0&&ln.fog!==Xt||ln.numClippingPlanes!==void 0&&(ln.numClippingPlanes!==it.numPlanes||ln.numIntersection!==it.numIntersection)||ln.vertexAlphas!==On||ln.vertexTangents!==Wn||ln.morphTargets!==fn||ln.morphNormals!==or||ln.morphColors!==Kr||ln.toneMapping!==ni||ln.morphTargetsCount!==kr)&&(Dn=!0):(Dn=!0,ln.__version=vt.version);let ms=ln.currentProgram;Dn===!0&&(ms=Ut(vt,rt,gt));let Ns=!1,Di=!1,gs=!1;const xr=ms.getUniforms(),hi=ln.uniforms;if(Oe.useProgram(ms.program)&&(Ns=!0,Di=!0,gs=!0),vt.id!==Y&&(Y=vt.id,Di=!0),Ns||$!==ge){Oe.buffers.depth.getReversed()&&ge.reversedDepth!==!0&&(ge._reversedDepth=!0,ge.updateProjectionMatrix()),xr.setValue(oe,"projectionMatrix",ge.projectionMatrix),xr.setValue(oe,"viewMatrix",ge.matrixWorldInverse);const qo=xr.map.cameraPosition;qo!==void 0&&qo.setValue(oe,Pe.setFromMatrixPosition(ge.matrixWorld)),Ue.logarithmicDepthBuffer&&xr.setValue(oe,"logDepthBufFC",2/(Math.log(ge.far+1)/Math.LN2)),(vt.isMeshPhongMaterial||vt.isMeshToonMaterial||vt.isMeshLambertMaterial||vt.isMeshBasicMaterial||vt.isMeshStandardMaterial||vt.isShaderMaterial)&&xr.setValue(oe,"isOrthographic",ge.isOrthographicCamera===!0),$!==ge&&($=ge,Di=!0,gs=!0)}if(ln.needsLights&&(ss.state.directionalShadowMap.length>0&&xr.setValue(oe,"directionalShadowMap",ss.state.directionalShadowMap,fe),ss.state.spotShadowMap.length>0&&xr.setValue(oe,"spotShadowMap",ss.state.spotShadowMap,fe),ss.state.pointShadowMap.length>0&&xr.setValue(oe,"pointShadowMap",ss.state.pointShadowMap,fe)),gt.isSkinnedMesh){xr.setOptional(oe,gt,"bindMatrix"),xr.setOptional(oe,gt,"bindMatrixInverse");const Pi=gt.skeleton;Pi&&(Pi.boneTexture===null&&Pi.computeBoneTexture(),xr.setValue(oe,"boneTexture",Pi.boneTexture,fe))}gt.isBatchedMesh&&(xr.setOptional(oe,gt,"batchingTexture"),xr.setValue(oe,"batchingTexture",gt._matricesTexture,fe),xr.setOptional(oe,gt,"batchingIdTexture"),xr.setValue(oe,"batchingIdTexture",gt._indirectTexture,fe),xr.setOptional(oe,gt,"batchingColorTexture"),gt._colorsTexture!==null&&xr.setValue(oe,"batchingColorTexture",gt._colorsTexture,fe));const Rs=bt.morphAttributes;if((Rs.position!==void 0||Rs.normal!==void 0||Rs.color!==void 0)&&Ve.update(gt,bt,ms),(Di||ln.receiveShadow!==gt.receiveShadow)&&(ln.receiveShadow=gt.receiveShadow,xr.setValue(oe,"receiveShadow",gt.receiveShadow)),(vt.isMeshStandardMaterial||vt.isMeshLambertMaterial||vt.isMeshPhongMaterial)&&vt.envMap===null&&rt.environment!==null&&(hi.envMapIntensity.value=rt.environmentIntensity),hi.dfgLUT!==void 0&&(hi.dfgLUT.value=TCe()),Di&&(xr.setValue(oe,"toneMappingExposure",L.toneMappingExposure),ln.needsLights&&En(hi,gs),Xt&&vt.fog===!0&&Ce.refreshFogUniforms(hi,Xt),Ce.refreshMaterialUniforms(hi,vt,j,G,D.state.transmissionRenderTarget[ge.id]),qM.upload(oe,Gt(ln),hi,fe)),vt.isShaderMaterial&&vt.uniformsNeedUpdate===!0&&(qM.upload(oe,Gt(ln),hi,fe),vt.uniformsNeedUpdate=!1),vt.isSpriteMaterial&&xr.setValue(oe,"center",gt.center),xr.setValue(oe,"modelViewMatrix",gt.modelViewMatrix),xr.setValue(oe,"normalMatrix",gt.normalMatrix),xr.setValue(oe,"modelMatrix",gt.matrixWorld),vt.isShaderMaterial||vt.isRawShaderMaterial){const Pi=vt.uniformsGroups;for(let qo=0,ga=Pi.length;qo<ga;qo++){const Aa=Pi[qo];ft.update(Aa,ms),ft.bind(Aa,ms)}}return ms}function En(ge,rt){ge.ambientLightColor.needsUpdate=rt,ge.lightProbe.needsUpdate=rt,ge.directionalLights.needsUpdate=rt,ge.directionalLightShadows.needsUpdate=rt,ge.pointLights.needsUpdate=rt,ge.pointLightShadows.needsUpdate=rt,ge.spotLights.needsUpdate=rt,ge.spotLightShadows.needsUpdate=rt,ge.rectAreaLights.needsUpdate=rt,ge.hemisphereLights.needsUpdate=rt}function Hn(ge){return ge.isMeshLambertMaterial||ge.isMeshToonMaterial||ge.isMeshPhongMaterial||ge.isMeshStandardMaterial||ge.isShadowMaterial||ge.isShaderMaterial&&ge.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return W},this.setRenderTargetTextures=function(ge,rt,bt){const vt=Q.get(ge);vt.__autoAllocateDepthBuffer=ge.resolveDepthBuffer===!1,vt.__autoAllocateDepthBuffer===!1&&(vt.__useRenderToTexture=!1),Q.get(ge.texture).__webglTexture=rt,Q.get(ge.depthTexture).__webglTexture=vt.__autoAllocateDepthBuffer?void 0:bt,vt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ge,rt){const bt=Q.get(ge);bt.__webglFramebuffer=rt,bt.__useDefaultFramebuffer=rt===void 0};const Nn=oe.createFramebuffer();this.setRenderTarget=function(ge,rt=0,bt=0){W=ge,F=rt,U=bt;let vt=null,gt=!1,Xt=!1;if(ge){const Kt=Q.get(ge);if(Kt.__useDefaultFramebuffer!==void 0){Oe.bindFramebuffer(oe.FRAMEBUFFER,Kt.__webglFramebuffer),X.copy(ge.viewport),Z.copy(ge.scissor),K=ge.scissorTest,Oe.viewport(X),Oe.scissor(Z),Oe.setScissorTest(K),Y=-1;return}else if(Kt.__webglFramebuffer===void 0)fe.setupRenderTarget(ge);else if(Kt.__hasExternalTextures)fe.rebindTextures(ge,Q.get(ge.texture).__webglTexture,Q.get(ge.depthTexture).__webglTexture);else if(ge.depthBuffer){const On=ge.depthTexture;if(Kt.__boundDepthTexture!==On){if(On!==null&&Q.has(On)&&(ge.width!==On.image.width||ge.height!==On.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");fe.setupDepthRenderbuffer(ge)}}const Zt=ge.texture;(Zt.isData3DTexture||Zt.isDataArrayTexture||Zt.isCompressedArrayTexture)&&(Xt=!0);const xn=Q.get(ge).__webglFramebuffer;ge.isWebGLCubeRenderTarget?(Array.isArray(xn[rt])?vt=xn[rt][bt]:vt=xn[rt],gt=!0):ge.samples>0&&fe.useMultisampledRTT(ge)===!1?vt=Q.get(ge).__webglMultisampledFramebuffer:Array.isArray(xn)?vt=xn[bt]:vt=xn,X.copy(ge.viewport),Z.copy(ge.scissor),K=ge.scissorTest}else X.copy(te).multiplyScalar(j).floor(),Z.copy(se).multiplyScalar(j).floor(),K=le;if(bt!==0&&(vt=Nn),Oe.bindFramebuffer(oe.FRAMEBUFFER,vt)&&Oe.drawBuffers(ge,vt),Oe.viewport(X),Oe.scissor(Z),Oe.setScissorTest(K),gt){const Kt=Q.get(ge.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+rt,Kt.__webglTexture,bt)}else if(Xt){const Kt=rt;for(let Zt=0;Zt<ge.textures.length;Zt++){const xn=Q.get(ge.textures[Zt]);oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0+Zt,xn.__webglTexture,bt,Kt)}}else if(ge!==null&&bt!==0){const Kt=Q.get(ge.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,Kt.__webglTexture,bt)}Y=-1},this.readRenderTargetPixels=function(ge,rt,bt,vt,gt,Xt,Jt,Kt=0){if(!(ge&&ge.isWebGLRenderTarget)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Zt=Q.get(ge).__webglFramebuffer;if(ge.isWebGLCubeRenderTarget&&Jt!==void 0&&(Zt=Zt[Jt]),Zt){Oe.bindFramebuffer(oe.FRAMEBUFFER,Zt);try{const xn=ge.textures[Kt],On=xn.format,Wn=xn.type;if(ge.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+Kt),!Ue.textureFormatReadable(On)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ue.textureTypeReadable(Wn)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}rt>=0&&rt<=ge.width-vt&&bt>=0&&bt<=ge.height-gt&&oe.readPixels(rt,bt,vt,gt,Ne.convert(On),Ne.convert(Wn),Xt)}finally{const xn=W!==null?Q.get(W).__webglFramebuffer:null;Oe.bindFramebuffer(oe.FRAMEBUFFER,xn)}}},this.readRenderTargetPixelsAsync=async function(ge,rt,bt,vt,gt,Xt,Jt,Kt=0){if(!(ge&&ge.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Zt=Q.get(ge).__webglFramebuffer;if(ge.isWebGLCubeRenderTarget&&Jt!==void 0&&(Zt=Zt[Jt]),Zt)if(rt>=0&&rt<=ge.width-vt&&bt>=0&&bt<=ge.height-gt){Oe.bindFramebuffer(oe.FRAMEBUFFER,Zt);const xn=ge.textures[Kt],On=xn.format,Wn=xn.type;if(ge.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+Kt),!Ue.textureFormatReadable(On))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ue.textureTypeReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const fn=oe.createBuffer();oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.bufferData(oe.PIXEL_PACK_BUFFER,Xt.byteLength,oe.STREAM_READ),oe.readPixels(rt,bt,vt,gt,Ne.convert(On),Ne.convert(Wn),0);const or=W!==null?Q.get(W).__webglFramebuffer:null;Oe.bindFramebuffer(oe.FRAMEBUFFER,or);const Kr=oe.fenceSync(oe.SYNC_GPU_COMMANDS_COMPLETE,0);return oe.flush(),await FSe(oe,Kr,4),oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.getBufferSubData(oe.PIXEL_PACK_BUFFER,0,Xt),oe.deleteBuffer(fn),oe.deleteSync(Kr),Xt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ge,rt=null,bt=0){const vt=Math.pow(2,-bt),gt=Math.floor(ge.image.width*vt),Xt=Math.floor(ge.image.height*vt),Jt=rt!==null?rt.x:0,Kt=rt!==null?rt.y:0;fe.setTexture2D(ge,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,bt,0,0,Jt,Kt,gt,Xt),Oe.unbindTexture()};const Br=oe.createFramebuffer(),er=oe.createFramebuffer();this.copyTextureToTexture=function(ge,rt,bt=null,vt=null,gt=0,Xt=0){let Jt,Kt,Zt,xn,On,Wn,fn,or,Kr;const ni=ge.isCompressedTexture?ge.mipmaps[Xt]:ge.image;if(bt!==null)Jt=bt.max.x-bt.min.x,Kt=bt.max.y-bt.min.y,Zt=bt.isBox3?bt.max.z-bt.min.z:1,xn=bt.min.x,On=bt.min.y,Wn=bt.isBox3?bt.min.z:0;else{const hi=Math.pow(2,-gt);Jt=Math.floor(ni.width*hi),Kt=Math.floor(ni.height*hi),ge.isDataArrayTexture?Zt=ni.depth:ge.isData3DTexture?Zt=Math.floor(ni.depth*hi):Zt=1,xn=0,On=0,Wn=0}vt!==null?(fn=vt.x,or=vt.y,Kr=vt.z):(fn=0,or=0,Kr=0);const fr=Ne.convert(rt.format),kr=Ne.convert(rt.type);let ln;rt.isData3DTexture?(fe.setTexture3D(rt,0),ln=oe.TEXTURE_3D):rt.isDataArrayTexture||rt.isCompressedArrayTexture?(fe.setTexture2DArray(rt,0),ln=oe.TEXTURE_2D_ARRAY):(fe.setTexture2D(rt,0),ln=oe.TEXTURE_2D),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,rt.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,rt.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,rt.unpackAlignment);const ss=oe.getParameter(oe.UNPACK_ROW_LENGTH),Dn=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),ms=oe.getParameter(oe.UNPACK_SKIP_PIXELS),Ns=oe.getParameter(oe.UNPACK_SKIP_ROWS),Di=oe.getParameter(oe.UNPACK_SKIP_IMAGES);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,ni.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,ni.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,xn),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,On),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Wn);const gs=ge.isDataArrayTexture||ge.isData3DTexture,xr=rt.isDataArrayTexture||rt.isData3DTexture;if(ge.isDepthTexture){const hi=Q.get(ge),Rs=Q.get(rt),Pi=Q.get(hi.__renderTarget),qo=Q.get(Rs.__renderTarget);Oe.bindFramebuffer(oe.READ_FRAMEBUFFER,Pi.__webglFramebuffer),Oe.bindFramebuffer(oe.DRAW_FRAMEBUFFER,qo.__webglFramebuffer);for(let ga=0;ga<Zt;ga++)gs&&(oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Q.get(ge).__webglTexture,gt,Wn+ga),oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Q.get(rt).__webglTexture,Xt,Kr+ga)),oe.blitFramebuffer(xn,On,Jt,Kt,fn,or,Jt,Kt,oe.DEPTH_BUFFER_BIT,oe.NEAREST);Oe.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Oe.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else if(gt!==0||ge.isRenderTargetTexture||Q.has(ge)){const hi=Q.get(ge),Rs=Q.get(rt);Oe.bindFramebuffer(oe.READ_FRAMEBUFFER,Br),Oe.bindFramebuffer(oe.DRAW_FRAMEBUFFER,er);for(let Pi=0;Pi<Zt;Pi++)gs?oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,hi.__webglTexture,gt,Wn+Pi):oe.framebufferTexture2D(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,hi.__webglTexture,gt),xr?oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Rs.__webglTexture,Xt,Kr+Pi):oe.framebufferTexture2D(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,Rs.__webglTexture,Xt),gt!==0?oe.blitFramebuffer(xn,On,Jt,Kt,fn,or,Jt,Kt,oe.COLOR_BUFFER_BIT,oe.NEAREST):xr?oe.copyTexSubImage3D(ln,Xt,fn,or,Kr+Pi,xn,On,Jt,Kt):oe.copyTexSubImage2D(ln,Xt,fn,or,xn,On,Jt,Kt);Oe.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Oe.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else xr?ge.isDataTexture||ge.isData3DTexture?oe.texSubImage3D(ln,Xt,fn,or,Kr,Jt,Kt,Zt,fr,kr,ni.data):rt.isCompressedArrayTexture?oe.compressedTexSubImage3D(ln,Xt,fn,or,Kr,Jt,Kt,Zt,fr,ni.data):oe.texSubImage3D(ln,Xt,fn,or,Kr,Jt,Kt,Zt,fr,kr,ni):ge.isDataTexture?oe.texSubImage2D(oe.TEXTURE_2D,Xt,fn,or,Jt,Kt,fr,kr,ni.data):ge.isCompressedTexture?oe.compressedTexSubImage2D(oe.TEXTURE_2D,Xt,fn,or,ni.width,ni.height,fr,ni.data):oe.texSubImage2D(oe.TEXTURE_2D,Xt,fn,or,Jt,Kt,fr,kr,ni);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,ss),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,Dn),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,ms),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Ns),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Di),Xt===0&&rt.generateMipmaps&&oe.generateMipmap(ln),Oe.unbindTexture()},this.initRenderTarget=function(ge){Q.get(ge).__webglFramebuffer===void 0&&fe.setupRenderTarget(ge)},this.initTexture=function(ge){ge.isCubeTexture?fe.setTextureCube(ge,0):ge.isData3DTexture?fe.setTexture3D(ge,0):ge.isDataArrayTexture||ge.isCompressedArrayTexture?fe.setTexture2DArray(ge,0):fe.setTexture2D(ge,0),Oe.unbindTexture()},this.resetState=function(){F=0,U=0,W=null,Oe.reset(),$e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ai._getDrawingBufferColorSpace(e),n.unpackColorSpace=ai._getUnpackColorSpace()}}const CCe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:oC,AddEquation:P0,AddOperation:lY,AdditiveAnimationBlendMode:a9,AdditiveBlending:BR,AgXToneMapping:Q8,AlphaFormat:s9,AlwaysCompare:_Y,AlwaysDepth:K2,AlwaysStencilFunc:$R,AmbientLight:fK,AnimationAction:_K,AnimationClip:LS,AnimationLoader:N3e,AnimationMixer:s4e,AnimationObjectGroup:r4e,AnimationUtils:T3e,ArcCurve:zY,ArrayCamera:xK,ArrowHelper:C4e,AttachedBindMode:GR,Audio:yK,AudioAnalyser:q3e,AudioContext:P9,AudioListener:G3e,AudioLoader:U3e,AxesHelper:E4e,BackSide:$l,BasicDepthPacking:hY,BasicShadowMap:HX,BatchedMesh:PY,BezierInterpolant:sK,Bone:p9,BooleanKeyframeTrack:Ix,Box2:d4e,Box3:Eo,Box3Helper:M4e,BoxGeometry:Px,BoxHelper:w4e,BufferAttribute:Wi,BufferGeometry:wr,BufferGeometryLoader:mK,ByteType:t9,Cache:eh,Camera:UC,CameraHelper:S4e,CanvasTexture:Wwe,CapsuleGeometry:TC,CatmullRomCurve3:FY,CineonToneMapping:K8,CircleGeometry:CC,ClampToEdgeWrapping:Ec,Clock:wK,Color:Sn,ColorKeyframeTrack:N9,ColorManagement:ai,Compatibility:ISe,CompressedArrayTexture:Vwe,CompressedCubeTexture:Gwe,CompressedTexture:MC,CompressedTextureLoader:R3e,ConeGeometry:Aw,ConstantAlphaFactor:sY,ConstantColorFactor:rY,Controls:N4e,CubeCamera:gK,CubeDepthTexture:jY,CubeReflectionMapping:ch,CubeRefractionMapping:om,CubeTexture:Cw,CubeTextureLoader:k3e,CubeUVReflectionMapping:jy,CubicBezierCurve:y9,CubicBezierCurve3:UY,CubicInterpolant:rK,CullFaceBack:UR,CullFaceFront:BX,CullFaceFrontBack:q_e,CullFaceNone:UX,Curve:nf,CurvePath:HY,CustomBlending:VX,CustomToneMapping:Z8,CylinderGeometry:Ew,Cylindrical:u4e,Data3DTexture:vC,DataArrayTexture:xC,DataTexture:Yd,DataTextureLoader:D3e,DataUtils:gwe,DecrementStencilOp:dSe,DecrementWrapStencilOp:hSe,DefaultLoadingManager:aK,DepthFormat:dh,DepthStencilFormat:W0,DepthTexture:fy,DetachedBindMode:cY,DirectionalLight:dK,DirectionalLightHelper:_4e,DiscreteInterpolant:iK,DodecahedronGeometry:EC,DoubleSide:Kc,DstAlphaFactor:QX,DstColorFactor:eY,DynamicCopyUsage:ASe,DynamicDrawUsage:SSe,DynamicReadUsage:TSe,EdgesGeometry:x9,EllipseCurve:AC,EqualCompare:vY,EqualDepth:Q2,EqualStencilFunc:xSe,EquirectangularReflectionMapping:B_,EquirectangularRefractionMapping:H_,Euler:cu,EventDispatcher:yh,ExternalTexture:g9,ExtrudeGeometry:NC,FileLoader:Sp,Float16BufferAttribute:wwe,Float32BufferAttribute:Rn,FloatType:Wl,Fog:bC,FogExp2:yC,FramebufferTexture:Hwe,FrontSide:_p,Frustum:zy,FrustumArray:wC,GLBufferAttribute:c4e,GLSL1:RSe,GLSL3:qR,GreaterCompare:yY,GreaterDepth:e5,GreaterEqualCompare:gC,GreaterEqualDepth:J2,GreaterEqualStencilFunc:_Se,GreaterStencilFunc:ySe,GridHelper:y4e,Group:h1,HalfFloatType:uh,HemisphereLight:lK,HemisphereLightHelper:v4e,IcosahedronGeometry:RC,ImageBitmapLoader:F3e,ImageLoader:jS,ImageUtils:CY,IncrementStencilOp:uSe,IncrementWrapStencilOp:fSe,InstancedBufferAttribute:xx,InstancedBufferGeometry:HC,InstancedInterleavedBuffer:F5,InstancedMesh:DY,Int16BufferAttribute:_we,Int32BufferAttribute:Swe,Int8BufferAttribute:vwe,IntType:lC,InterleavedBuffer:_C,InterleavedBufferAttribute:nu,Interpolant:Fy,InterpolateBezier:WR,InterpolateDiscrete:wS,InterpolateLinear:I5,InterpolateSmooth:WM,InterpolationSamplingMode:PSe,InterpolationSamplingType:DSe,InvertStencilOp:pSe,KeepStencilOp:Pg,KeyframeTrack:ud,LOD:RY,LatheGeometry:kC,Layers:dy,LessCompare:xY,LessDepth:Z2,LessEqualCompare:mC,LessEqualDepth:px,LessEqualStencilFunc:vSe,LessStencilFunc:gSe,Light:Tm,LightProbe:pK,Line:cm,Line3:MK,LineBasicMaterial:Xl,LineCurve:b9,LineCurve3:BY,LineDashedMaterial:tK,LineLoop:IY,LineSegments:bh,LinearFilter:rs,LinearInterpolant:A9,LinearMipMapLinearFilter:Q_e,LinearMipMapNearestFilter:Z_e,LinearMipmapLinearFilter:Jf,LinearMipmapNearestFilter:V_,LinearSRGBColorSpace:am,LinearToneMapping:X8,LinearTransfer:TS,Loader:Pc,LoaderUtils:QR,LoadingManager:R9,LoopOnce:uY,LoopPingPong:fY,LoopRepeat:dY,MOUSE:kg,Material:bl,MaterialBlending:X_e,MaterialLoader:BC,MathUtils:TY,Matrix2:j9,Matrix3:Sr,Matrix4:sr,MaxEquation:qX,Mesh:Fs,MeshBasicMaterial:Ap,MeshDepthMaterial:zC,MeshDistanceMaterial:FC,MeshLambertMaterial:JY,MeshMatcapMaterial:eK,MeshNormalMaterial:QY,MeshPhongMaterial:KY,MeshPhysicalMaterial:YY,MeshStandardMaterial:C9,MeshToonMaterial:ZY,MinEquation:$X,MirroredRepeatWrapping:SS,MixOperation:aY,MultiplyBlending:VR,MultiplyOperation:Mw,NearestFilter:Co,NearestMipMapLinearFilter:K_e,NearestMipMapNearestFilter:Y_e,NearestMipmapLinearFilter:d1,NearestMipmapNearestFilter:e9,NeutralToneMapping:J8,NeverCompare:gY,NeverDepth:Y2,NeverStencilFunc:mSe,NoBlending:sh,NoColorSpace:op,NoNormalPacking:sSe,NoToneMapping:ou,NormalAnimationBlendMode:pC,NormalBlending:ex,NormalGAPacking:aSe,NormalRGPacking:oSe,NotEqualCompare:bY,NotEqualDepth:t5,NotEqualStencilFunc:bSe,NumberKeyframeTrack:IS,Object3D:_i,ObjectLoader:j3e,ObjectSpaceNormalMap:mY,OctahedronGeometry:Nw,OneFactor:YX,OneMinusConstantAlphaFactor:oY,OneMinusConstantColorFactor:iY,OneMinusDstAlphaFactor:JX,OneMinusDstColorFactor:tY,OneMinusSrcAlphaFactor:X2,OneMinusSrcColorFactor:ZX,OrthographicCamera:Kd,PCFShadowMap:A1,PCFSoftShadowMap:U_,PMREMGenerator:nk,Path:z5,PerspectiveCamera:Js,Plane:rp,PlaneGeometry:Np,PlaneHelper:T4e,PointLight:uK,PointLightHelper:g4e,Points:OY,PointsMaterial:m9,PolarGridHelper:b4e,PolyhedronGeometry:Mm,PositionalAudio:$3e,PropertyBinding:yi,PropertyMixer:bK,QuadraticBezierCurve:_9,QuadraticBezierCurve3:S9,Quaternion:$a,QuaternionKeyframeTrack:kw,QuaternionLinearInterpolant:oK,R11_EAC_Format:c5,RED_GREEN_RGTC2_Format:D5,RED_RGTC1_Format:R5,REVISION:ww,RG11_EAC_Format:d5,RGBADepthPacking:pY,RGBAFormat:ml,RGBAIntegerFormat:hC,RGBA_ASTC_10x10_Format:M5,RGBA_ASTC_10x5_Format:_5,RGBA_ASTC_10x6_Format:S5,RGBA_ASTC_10x8_Format:w5,RGBA_ASTC_12x10_Format:T5,RGBA_ASTC_12x12_Format:C5,RGBA_ASTC_4x4_Format:h5,RGBA_ASTC_5x4_Format:p5,RGBA_ASTC_5x5_Format:m5,RGBA_ASTC_6x5_Format:g5,RGBA_ASTC_6x6_Format:x5,RGBA_ASTC_8x5_Format:v5,RGBA_ASTC_8x6_Format:y5,RGBA_ASTC_8x8_Format:b5,RGBA_BPTC_Format:E5,RGBA_ETC2_EAC_Format:l5,RGBA_PVRTC_2BPPV1_Format:s5,RGBA_PVRTC_4BPPV1_Format:i5,RGBA_S3TC_DXT1_Format:W_,RGBA_S3TC_DXT3_Format:$_,RGBA_S3TC_DXT5_Format:q_,RGBDepthPacking:rSe,RGBFormat:o9,RGBIntegerFormat:J_e,RGB_BPTC_SIGNED_Format:A5,RGB_BPTC_UNSIGNED_Format:N5,RGB_ETC1_Format:o5,RGB_ETC2_Format:a5,RGB_PVRTC_2BPPV1_Format:r5,RGB_PVRTC_4BPPV1_Format:n5,RGB_S3TC_DXT1_Format:G_,RGDepthPacking:iSe,RGFormat:mx,RGIntegerFormat:fC,RawShaderMaterial:T9,Ray:Dx,Raycaster:SK,RectAreaLight:hK,RedFormat:dC,RedIntegerFormat:Tw,ReinhardToneMapping:Y8,RenderTarget:c9,RenderTarget3D:o4e,RepeatWrapping:_S,ReplaceStencilOp:cSe,ReverseSubtractEquation:WX,RingGeometry:DC,SIGNED_R11_EAC_Format:u5,SIGNED_RED_GREEN_RGTC2_Format:P5,SIGNED_RED_RGTC1_Format:k5,SIGNED_RG11_EAC_Format:f5,SRGBColorSpace:pl,SRGBTransfer:zi,Scene:u9,ShaderChunk:Ar,ShaderLib:Vd,ShaderMaterial:uu,ShadowMaterial:qY,Shape:Y0,ShapeGeometry:PC,ShapePath:A4e,ShapeUtils:Xd,ShortType:n9,Skeleton:SC,SkeletonHelper:m4e,SkinnedMesh:kY,Source:$0,Sphere:Wo,SphereGeometry:Rw,Spherical:ek,SphericalHarmonics3:D9,SplineCurve:w9,SpotLight:cK,SpotLightHelper:p4e,Sprite:NY,SpriteMaterial:h9,SrcAlphaFactor:q2,SrcAlphaSaturateFactor:nY,SrcColorFactor:KX,StaticCopyUsage:ESe,StaticDrawUsage:CS,StaticReadUsage:MSe,StereoCamera:B3e,StreamCopyUsage:NSe,StreamDrawUsage:wSe,StreamReadUsage:CSe,StringKeyframeTrack:Ox,SubtractEquation:GX,SubtractiveBlending:HR,TOUCH:Dg,TangentSpaceNormalMap:wm,TetrahedronGeometry:IC,Texture:ro,TextureLoader:P3e,TextureUtils:I4e,Timer:vK,TimestampQuery:kSe,TorusGeometry:OC,TorusKnotGeometry:LC,Triangle:Cc,TriangleFanDrawMode:nSe,TriangleStripDrawMode:tSe,TrianglesDrawMode:eSe,TubeGeometry:jC,UVMapping:aC,Uint16BufferAttribute:d9,Uint32BufferAttribute:f9,Uint8BufferAttribute:ywe,Uint8ClampedBufferAttribute:bwe,Uniform:L9,UniformsGroup:l4e,UniformsLib:vn,UniformsUtils:PS,UnsignedByteType:Bl,UnsignedInt101111Type:i9,UnsignedInt248Type:cy,UnsignedInt5999Type:r9,UnsignedIntType:id,UnsignedShort4444Type:cC,UnsignedShort5551Type:uC,UnsignedShortType:ly,VSMShadowMap:zg,Vector2:Ht,Vector3:He,Vector4:fi,VectorKeyframeTrack:OS,VideoFrameTexture:Bwe,VideoTexture:LY,WebGL3DRenderTarget:awe,WebGLArrayRenderTarget:owe,WebGLCoordinateSystem:tu,WebGLCubeRenderTarget:z9,WebGLRenderTarget:lu,WebGLRenderer:DK,WebGLUtils:kK,WebGPUCoordinateSystem:gx,WebXRController:$M,WireframeGeometry:M9,WrapAroundEnding:MS,ZeroCurvatureEnding:Fg,ZeroFactor:XX,ZeroSlopeEnding:Ug,ZeroStencilOp:lSe,createCanvasElement:wY,error:Un,getConsoleFunction:zSe,log:AS,setConsoleFunction:jSe,warn:gn,warnOnce:NS},Symbol.toStringTag,{value:"Module"}));var H6={exports:{}},V6={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Oz;function ECe(){if(Oz)return V6;Oz=1;var t=KS(),e=tre();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return V6.useSyncExternalStoreWithSelector=function(c,d,p,m,x){var b=s(null);if(b.current===null){var _={hasValue:!1,value:null};b.current=_}else _=b.current;b=a(function(){function w(P){if(!C){if(C=!0,A=P,P=m(P),x!==void 0&&_.hasValue){var O=_.value;if(x(O,P))return N=O}return N=P}if(O=N,r(A,P))return O;var R=m(P);return x!==void 0&&x(O,R)?(A=P,O):(A=P,N=R)}var C=!1,A,N,D=p===void 0?null:p;return[function(){return w(d())},D===null?void 0:function(){return w(D())}]},[d,p,m,x]);var S=i(c,b[0],b[1]);return o(function(){_.hasValue=!0,_.value=S},[S]),l(S),S},V6}var Lz;function ACe(){return Lz||(Lz=1,H6.exports=ECe()),H6.exports}var NCe=ACe();const RCe=xy(NCe),jz=t=>{let e;const n=new Set,r=(c,d)=>{const p=typeof c=="function"?c(e):c;if(!Object.is(p,e)){const m=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(x=>x(e,m))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,a);return a},kCe=(t=>t?jz(t):jz),{useSyncExternalStoreWithSelector:DCe}=RCe,PCe=t=>t;function ICe(t,e=PCe,n){const r=DCe(t.subscribe,t.getState,t.getInitialState,e,n);return ei.useDebugValue(r),r}const zz=(t,e)=>{const n=kCe(t),r=(i,s=e)=>ICe(n,i,s);return Object.assign(r,n),r},OCe=((t,e)=>t?zz(t,e):zz),LCe=t=>typeof t=="object"&&typeof t.then=="function",SM=[];function jCe(t,e,n=(r,i)=>r===i){if(t===e)return!0;if(!t||!e)return!1;const r=t.length;if(e.length!==r)return!1;for(let i=0;i<r;i++)if(!n(t[i],e[i]))return!1;return!0}function zCe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of SM)if(jCe(e,s.keys,s.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return r.lifespan&&r.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,r.lifespan)),s.response;if(!n)throw s.promise}const i={keys:e,equal:r.equal,remove:()=>{const s=SM.indexOf(i);s!==-1&&SM.splice(s,1)},promise:(LCe(t)?t:t(...e)).then(s=>{i.response=s,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(s=>i.error=s)};if(SM.push(i),!n)throw i.promise}const FCe=(t,e,n)=>zCe(t,e,!1,n);var sk=VF();const UCe=xy(sk);function F9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=F9(r,e,n);if(i)return i;r=e?null:r.sibling}}function PK(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const U9=PK(M.createContext(null));class IK extends M.Component{render(){return M.createElement(U9.Provider,{value:this._reactInternals},this.props.children)}}function OK(){const t=M.useContext(U9);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=M.useId();return M.useMemo(()=>{for(const n of[t,t==null?void 0:t.alternate]){if(!n)continue;const r=F9(n,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(r)return r}},[t,e])}const BCe=Symbol.for("react.context"),HCe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===BCe;function VCe(){const t=OK(),[e]=M.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;HCe(r)&&r!==U9&&!e.has(r)&&e.set(r,M.use(PK(r))),n=n.return}return e}function GCe(){const t=VCe();return M.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>M.createElement(e,null,M.createElement(n.Provider,{...r,value:t.get(n)})),e=>M.createElement(IK,{...e})),[t])}function LK(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const jK=t=>t&&t.isOrthographicCamera,WCe=t=>t&&t.hasOwnProperty("current"),$Ce=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Dw=((t,e)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?M.useLayoutEffect:M.useEffect;function zK(t){const e=M.useRef(t);return Dw(()=>void(e.current=t),[t]),e}function qCe(){const t=OK(),e=GCe();return M.useMemo(()=>({children:n})=>{const i=!!F9(t,!0,s=>s.type===M.StrictMode)?M.StrictMode:M.Fragment;return f.jsx(i,{children:f.jsx(e,{children:n})})},[t,e])}function XCe({set:t}){return Dw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const YCe=(t=>(t=class extends M.Component{constructor(...n){super(...n),this.state={error:!1}}componentDidCatch(n){this.props.set(n)}render(){return this.state.error?null:this.props.children}},t.getDerivedStateFromError=()=>({error:!0}),t))();function FK(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}function n1(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const Zs={obj:t=>t===Object(t)&&!Zs.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,nul:t=>t===null,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(Zs.str(t)||Zs.num(t)||Zs.boo(t))return t===e;const s=Zs.obj(t);if(s&&r==="reference")return t===e;const o=Zs.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!Zs.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(Zs.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function KCe(t){t.type!=="Scene"&&(t.dispose==null||t.dispose());for(const e in t){const n=t[e];(n==null?void 0:n.type)!=="Scene"&&(n==null||n.dispose==null||n.dispose())}}const UK=["children","key","ref"];function ZCe(t){const e={};for(const n in t)UK.includes(n)||(e[n]=t[n]);return e}function U5(t,e,n,r){const i=t;let s=i==null?void 0:i.__r3f;return s||(s={root:e,type:n,parent:null,children:[],props:ZCe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function zS(t,e){if(!e.includes("-"))return{root:t,key:e,target:t[e]};if(e in t)return{root:t,key:e,target:t[e]};let n=t;const r=e.split("-");for(const i of r){if(typeof n!="object"||n===null){if(n!==void 0){const s=r.slice(r.indexOf(i)).join("-");return{root:n,key:s,target:void 0}}return{root:t,key:e,target:void 0}}e=i,t=n,n=n[e]}return{root:t,key:e,target:n}}const Fz=/-\d+$/;function B5(t,e){if(Zs.str(e.props.attach)){if(Fz.test(e.props.attach)){const i=e.props.attach.replace(Fz,""),{root:s,key:o}=zS(t.object,i);Array.isArray(s[o])||(s[o]=[])}const{root:n,key:r}=zS(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else Zs.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function H5(t,e){if(Zs.str(e.props.attach)){const{root:n,key:r}=zS(t.object,e.props.attach),i=e.previousAttach;i===void 0?delete n[r]:n[r]=i}else e.previousAttach==null||e.previousAttach(t.object,e.object);delete e.previousAttach}const ok=[...UK,"args","dispose","attach","object","onUpdate","dispose"],Uz=new Map;function QCe(t){let e=Uz.get(t.constructor);try{e||(e=new t.constructor,Uz.set(t.constructor,e))}catch{}return e}function JCe(t,e){const n={};for(const r in e)if(!ok.includes(r)&&!Zs.equ(e[r],t.props[r])){n[r]=e[r];for(const i in e)i.startsWith(`${r}-`)&&(n[i]=e[i])}for(const r in t.props){if(ok.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=zS(t.object,r);if(i.constructor&&i.constructor.length===0){const o=QCe(i);Zs.und(o)||(n[s]=o[s])}else n[s]=0}return n}const eEe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function I0(t,e){var n;const r=t.__r3f,i=r&&LK(r).getState(),s=r==null?void 0:r.eventCount;for(const a in e){let l=e[a];if(ok.includes(a))continue;if(r&&tEe.test(a)){typeof l=="function"?r.handlers[a]=l:delete r.handlers[a],r.eventCount=Object.keys(r.handlers).length;continue}if(l===void 0)continue;let{root:c,key:d,target:p}=zS(t,a);if(p===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${a}". Ensure it is an object before setting "${d}".`);if(p instanceof dy&&l instanceof dy)p.mask=l.mask;else if(p instanceof Sn&&$Ce(l))p.set(l);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof p.copy=="function"&&l!=null&&l.constructor&&p.constructor===l.constructor)p.copy(l);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&Array.isArray(l))typeof p.fromArray=="function"?p.fromArray(l):p.set(...l);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof l=="number")typeof p.setScalar=="function"?p.setScalar(l):p.set(l);else{var o;c[d]=l,i&&!i.linear&&eEe.includes(d)&&(o=c[d])!=null&&o.isTexture&&c[d].format===ml&&c[d].type===Bl&&(c[d].colorSpace=pl)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&s!==r.eventCount){const a=r.object,l=i.internal.interaction.indexOf(a);l>-1&&i.internal.interaction.splice(l,1),r.eventCount&&a.raycast!==null&&i.internal.interaction.push(a)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&By(r),t}function By(t){var e;if(!t.parent)return;t.props.onUpdate==null||t.props.onUpdate(t.object);const n=(e=t.root)==null||e.getState==null?void 0:e.getState();n&&n.internal.frames===0&&n.invalidate()}function nEe(t,e){t.manual||(jK(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix())}const wc=t=>t==null?void 0:t.isObject3D;function wM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function BK(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function rEe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{BK(n.capturedMap,e,r,i)})}function iEe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],p=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+p*p))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var p;return(p=c.__r3f)==null?void 0:p.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),p=new Set,m=[],x=c?c(d.internal.interaction):d.internal.interaction;for(let w=0;w<x.length;w++){const C=n1(x[w]);C&&(C.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function b(w){const C=n1(w);if(!C||!C.events.enabled||C.raycaster.camera===null)return[];if(C.raycaster.camera===void 0){var A;C.events.compute==null||C.events.compute(l,C,(A=C.previousRoot)==null?void 0:A.getState()),C.raycaster.camera===void 0&&(C.raycaster.camera=null)}return C.raycaster.camera?C.raycaster.intersectObject(w,!0):[]}let _=x.flatMap(b).sort((w,C)=>{const A=n1(w.object),N=n1(C.object);return!A||!N?w.distance-C.distance:N.events.priority-A.events.priority||w.distance-C.distance}).filter(w=>{const C=wM(w);return p.has(C)?!1:(p.add(C),!0)});d.events.filter&&(_=d.events.filter(_,d));for(const w of _){let C=w.object;for(;C;){var S;(S=C.__r3f)!=null&&S.eventCount&&m.push({...w,eventObject:C}),C=C.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let w of d.internal.capturedMap.get(l.pointerId).values())p.has(wM(w.intersection))||m.push(w.intersection);return m}function i(l,c,d,p){if(l.length){const m={stopped:!1};for(const x of l){let b=n1(x.object);if(b||x.object.traverseAncestors(_=>{const S=n1(_);if(S)return b=S,!1}),b){const{raycaster:_,pointer:S,camera:w,internal:C}=b,A=new He(S.x,S.y,0).unproject(w),N=L=>{var V,F;return(V=(F=C.capturedMap.get(L))==null?void 0:F.has(x.eventObject))!=null?V:!1},D=L=>{const V={intersection:x,target:c.target};C.capturedMap.has(L)?C.capturedMap.get(L).set(x.eventObject,V):C.capturedMap.set(L,new Map([[x.eventObject,V]])),c.target.setPointerCapture(L)},P=L=>{const V=C.capturedMap.get(L);V&&BK(C.capturedMap,x.eventObject,V,L)};let O={};for(let L in c){let V=c[L];typeof V!="function"&&(O[L]=V)}let R={...x,...O,pointer:S,intersections:l,stopped:m.stopped,delta:d,unprojectedPoint:A,ray:_.ray,camera:w,stopPropagation(){const L="pointerId"in c&&C.capturedMap.get(c.pointerId);if((!L||L.has(x.eventObject))&&(R.stopped=m.stopped=!0,C.hovered.size&&Array.from(C.hovered.values()).find(V=>V.eventObject===x.eventObject))){const V=l.slice(0,l.indexOf(x));s([...V,x])}},target:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:P},currentTarget:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:P},nativeEvent:c};if(p(R),m.stopped===!0)break}}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(p=>p.object===d.object&&p.index===d.index&&p.instanceId===d.instanceId)){const m=d.eventObject.__r3f;if(c.hovered.delete(wM(d)),m!=null&&m.eventCount){const x=m.handlers,b={...d,intersections:l};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function o(l,c){for(let d=0;d<c.length;d++){const p=c[d].__r3f;p==null||p.handlers.onPointerMissed==null||p.handlers.onPointerMissed(l)}}function a(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:p,internal:m}=t.getState();m.lastEvent.current=d;const x=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",S=r(d,x?n:void 0),w=b?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=S.map(A=>A.eventObject)),b&&!S.length&&w<=2&&(o(d,m.interaction),p&&p(d)),x&&s(S);function C(A){const N=A.eventObject,D=N.__r3f;if(!(D!=null&&D.eventCount))return;const P=D.handlers;if(x){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const O=wM(A),R=m.hovered.get(O);R?R.stopped&&A.stopPropagation():(m.hovered.set(O,A),P.onPointerOver==null||P.onPointerOver(A),P.onPointerEnter==null||P.onPointerEnter(A))}P.onPointerMove==null||P.onPointerMove(A)}else{const O=P[l];O?(!b||m.initialHits.includes(N))&&(o(d,m.interaction.filter(R=>!m.initialHits.includes(R))),O(A)):b&&m.initialHits.includes(N)&&o(d,m.interaction.filter(R=>!m.initialHits.includes(R)))}}i(S,d,w,C)}}return{handlePointer:a}}const Bz=t=>!!(t!=null&&t.render),HK=M.createContext(null),sEe=(t,e)=>{const n=OCe((a,l)=>{const c=new He,d=new He,p=new He;function m(w=l().camera,C=d,A=l().size){const{width:N,height:D,top:P,left:O}=A,R=N/D;C.isVector3?p.copy(C):p.set(...C);const L=w.getWorldPosition(c).distanceTo(p);if(jK(w))return{width:N/w.zoom,height:D/w.zoom,top:P,left:O,factor:1,distance:L,aspect:R};{const V=w.fov*Math.PI/180,F=2*Math.tan(V/2)*L,U=F*(N/D);return{width:U,height:F,top:P,left:O,factor:N/U,distance:L,aspect:R}}}let x;const b=w=>a(C=>({performance:{...C.performance,current:w}})),_=new Ht;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(w=1)=>t(l(),w),advance:(w,C)=>e(w,C,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new wK,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const w=l();x&&clearTimeout(x),w.performance.current!==w.performance.min&&b(w.performance.min),x=setTimeout(()=>b(l().performance.max),w.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:w=>a(C=>({...C,events:{...C.events,...w}})),setSize:(w,C,A=0,N=0)=>{const D=l().camera,P={width:w,height:C,top:A,left:N};a(O=>({size:P,viewport:{...O.viewport,...m(D,d,P)}}))},setDpr:w=>a(C=>{const A=FK(w);return{viewport:{...C.viewport,dpr:A,initialDpr:C.viewport.initialDpr||A}}}),setFrameloop:(w="always")=>{const C=l().clock;C.stop(),C.elapsedTime=0,w!=="never"&&(C.start(),C.elapsedTime=0),a(()=>({frameloop:w}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:M.createRef(),active:!1,frames:0,priority:0,subscribe:(w,C,A)=>{const N=l().internal;return N.priority=N.priority+(C>0?1:0),N.subscribers.push({ref:w,priority:C,store:A}),N.subscribers=N.subscribers.sort((D,P)=>D.priority-P.priority),()=>{const D=l().internal;D!=null&&D.subscribers&&(D.priority=D.priority-(C>0?1:0),D.subscribers=D.subscribers.filter(P=>P.ref!==w))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:p}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){i=l,s=c.dpr,nEe(a,l),c.dpr>0&&d.setPixelRatio(c.dpr);const m=typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,m)}a!==o&&(o=a,p(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};function VK(){const t=M.useContext(HK);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function Mc(t=n=>n,e){return VK()(t,e)}function WC(t,e=0){const n=VK(),r=n.getState().internal.subscribe,i=zK(t);return Dw(()=>r(i,e,n),[e,r,n]),null}/**
 * @license React
 * react-reconciler-constants.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */const oEe=1,aEe=8,lEe=32,cEe=2;var uEe={version:"9.5.0"};function dEe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hz={exports:{}},Vz={exports:{}},Gz;function fEe(){return Gz||(Gz=1,(function(t){t.exports=function(e){function n(g,v,E,k){return new Wy(g,v,E,k)}function r(){}function i(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)v+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(g){var v=g,E=g;if(g.alternate)for(;v.return;)v=v.return;else{g=v;do v=g,(v.flags&4098)!==0&&(E=v.return),g=v.return;while(g)}return v.tag===3?E:null}function o(g){if(s(g)!==g)throw Error(i(188))}function a(g){var v=g.alternate;if(!v){if(v=s(g),v===null)throw Error(i(188));return v!==g?null:g}for(var E=g,k=v;;){var q=E.return;if(q===null)break;var ee=q.alternate;if(ee===null){if(k=q.return,k!==null){E=k;continue}break}if(q.child===ee.child){for(ee=q.child;ee;){if(ee===E)return o(q),g;if(ee===k)return o(q),v;ee=ee.sibling}throw Error(i(188))}if(E.return!==k.return)E=q,k=ee;else{for(var Re=!1,at=q.child;at;){if(at===E){Re=!0,E=q,k=ee;break}if(at===k){Re=!0,k=q,E=ee;break}at=at.sibling}if(!Re){for(at=ee.child;at;){if(at===E){Re=!0,E=ee,k=q;break}if(at===k){Re=!0,k=ee,E=q;break}at=at.sibling}if(!Re)throw Error(i(189))}}if(E.alternate!==k)throw Error(i(190))}if(E.tag!==3)throw Error(i(188));return E.stateNode.current===E?g:v}function l(g){var v=g.tag;if(v===5||v===26||v===27||v===6)return g;for(g=g.child;g!==null;){if(v=l(g),v!==null)return v;g=g.sibling}return null}function c(g){var v=g.tag;if(v===5||v===26||v===27||v===6)return g;for(g=g.child;g!==null;){if(g.tag!==4&&(v=c(g),v!==null))return v;g=g.sibling}return null}function d(g){return g===null||typeof g!="object"?null:(g=Td&&g[Td]||g["@@iterator"],typeof g=="function"?g:null)}function p(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===mf?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case Ah:return"Fragment";case Rh:return"Profiler";case Nh:return"StrictMode";case Kx:return"Suspense";case Md:return"SuspenseList";case Hm:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case Eh:return"Portal";case ac:return g.displayName||"Context";case Bm:return(g._context.displayName||"Context")+".Consumer";case $p:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case Zx:return v=g.displayName||null,v!==null?v:p(g.type)||"Memo";case Ia:v=g._payload,g=g._init;try{return p(g(v))}catch{}}return null}function m(g){return{current:g}}function x(g){0>Oh||(g.current=uv[Oh],uv[Oh]=null,Oh--)}function b(g,v){Oh++,uv[Oh]=g.current,g.current=v}function _(g){return g>>>=0,g===0?32:31-(dv(g)/T3|0)|0}function S(g){var v=g&42;if(v!==0)return v;switch(g&-g){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return g&261888;case 262144:case 524288:case 1048576:case 2097152:return g&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return g&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return g}}function w(g,v,E){var k=g.pendingLanes;if(k===0)return 0;var q=0,ee=g.suspendedLanes,Re=g.pingedLanes;g=g.warmLanes;var at=k&134217727;return at!==0?(k=at&~ee,k!==0?q=S(k):(Re&=at,Re!==0?q=S(Re):E||(E=at&~g,E!==0&&(q=S(E))))):(at=k&~ee,at!==0?q=S(at):Re!==0?q=S(Re):E||(E=k&~g,E!==0&&(q=S(E)))),q===0?0:v!==0&&v!==q&&(v&ee)===0&&(ee=q&-q,E=v&-v,ee>=E||ee===32&&(E&4194048)!==0)?v:q}function C(g,v){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&v)===0}function A(g,v){switch(g){case 1:case 2:case 4:case 8:case 64:return v+250;case 16:case 32: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 v+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function N(){var g=Jp;return Jp<<=1,(Jp&62914560)===0&&(Jp=4194304),g}function D(g){for(var v=[],E=0;31>E;E++)v.push(g);return v}function P(g,v){g.pendingLanes|=v,v!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function O(g,v,E,k,q,ee){var Re=g.pendingLanes;g.pendingLanes=E,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=E,g.entangledLanes&=E,g.errorRecoveryDisabledLanes&=E,g.shellSuspendCounter=0;var at=g.entanglements,jt=g.expirationTimes,Yt=g.hiddenUpdates;for(E=Re&~E;0<E;){var hn=31-rl(E),en=1<<hn;at[hn]=0,jt[hn]=-1;var wn=Yt[hn];if(wn!==null)for(Yt[hn]=null,hn=0;hn<wn.length;hn++){var pr=wn[hn];pr!==null&&(pr.lane&=-536870913)}E&=~en}k!==0&&R(g,k,0),ee!==0&&q===0&&g.tag!==0&&(g.suspendedLanes|=ee&~(Re&~v))}function R(g,v,E){g.pendingLanes|=v,g.suspendedLanes&=~v;var k=31-rl(v);g.entangledLanes|=v,g.entanglements[k]=g.entanglements[k]|1073741824|E&261930}function L(g,v){var E=g.entangledLanes|=v;for(g=g.entanglements;E;){var k=31-rl(E),q=1<<k;q&v|g[k]&v&&(g[k]|=v),E&=~q}}function V(g,v){var E=v&-v;return E=(E&42)!==0?1:F(E),(E&(g.suspendedLanes|v))!==0?0:E}function F(g){switch(g){case 2:g=1;break;case 8:g=4;break;case 32:g=16;break;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:g=128;break;case 268435456:g=134217728;break;default:g=0}return g}function U(g){return g&=-g,2<g?8<g?(g&134217727)!==0?32:268435456:8:2}function W(g){if(typeof Rb=="function"&&A3(g),il&&typeof il.setStrictMode=="function")try{il.setStrictMode(jh,g)}catch{}}function Y(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}function $(g){if(xv===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);xv=v&&v[1]||"",Nu=-1<E.stack.indexOf(`
    at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
`+xv+g+Nu}function X(g,v){if(!g||Zm)return"";Zm=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(v){var en=function(){throw Error()};if(Object.defineProperty(en.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(en,[])}catch(pr){var wn=pr}Reflect.construct(g,[],en)}else{try{en.call()}catch(pr){wn=pr}g.call(en.prototype)}}else{try{throw Error()}catch(pr){wn=pr}(en=g())&&typeof en.catch=="function"&&en.catch(function(){})}}catch(pr){if(pr&&wn&&typeof pr.stack=="string")return[pr.stack,wn.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var q=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");q&&q.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ee=k.DetermineComponentFrameRoot(),Re=ee[0],at=ee[1];if(Re&&at){var jt=Re.split(`
`),Yt=at.split(`
`);for(q=k=0;k<jt.length&&!jt[k].includes("DetermineComponentFrameRoot");)k++;for(;q<Yt.length&&!Yt[q].includes("DetermineComponentFrameRoot");)q++;if(k===jt.length||q===Yt.length)for(k=jt.length-1,q=Yt.length-1;1<=k&&0<=q&&jt[k]!==Yt[q];)q--;for(;1<=k&&0<=q;k--,q--)if(jt[k]!==Yt[q]){if(k!==1||q!==1)do if(k--,q--,0>q||jt[k]!==Yt[q]){var hn=`
`+jt[k].replace(" at new "," at ");return g.displayName&&hn.includes("<anonymous>")&&(hn=hn.replace("<anonymous>",g.displayName)),hn}while(1<=k&&0<=q);break}}}finally{Zm=!1,Error.prepareStackTrace=E}return(E=g?g.displayName||g.name:"")?$(E):""}function Z(g,v){switch(g.tag){case 26:case 27:case 5:return $(g.type);case 16:return $("Lazy");case 13:return g.child!==v&&v!==null?$("Suspense Fallback"):$("Suspense");case 19:return $("SuspenseList");case 0:case 15:return X(g.type,!1);case 11:return X(g.type.render,!1);case 1:return X(g.type,!0);case 31:return $("Activity");default:return""}}function K(g){try{var v="",E=null;do v+=Z(g,E),E=g,g=g.return;while(g);return v}catch(k){return`
Error generating stack: `+k.message+`
`+k.stack}}function ne(g,v){if(typeof g=="object"&&g!==null){var E=kb.get(g);return E!==void 0?E:(v={value:g,source:v,stack:K(v)},kb.set(g,v),v)}return{value:g,source:v,stack:K(v)}}function H(g,v){Ad[Ru++]=Qm,Ad[Ru++]=Li,Li=g,Qm=v}function B(g,v,E){uc[Nl++]=Zo,uc[Nl++]=Uc,uc[Nl++]=dc,dc=g;var k=Zo;g=Uc;var q=32-rl(k)-1;k&=~(1<<q),E+=1;var ee=32-rl(v)+q;if(30<ee){var Re=q-q%5;ee=(k&(1<<Re)-1).toString(32),k>>=Re,q-=Re,Zo=1<<32-rl(v)+q|E<<q|k,Uc=ee+g}else Zo=1<<ee|E<<q|k,Uc=g}function G(g){g.return!==null&&(H(g,1),B(g,1,0))}function j(g){for(;g===Li;)Li=Ad[--Ru],Ad[Ru]=null,Qm=Ad[--Ru],Ad[Ru]=null;for(;g===dc;)dc=uc[--Nl],uc[Nl]=null,Uc=uc[--Nl],uc[Nl]=null,Zo=uc[--Nl],uc[Nl]=null}function ie(g,v){uc[Nl++]=Zo,uc[Nl++]=Uc,uc[Nl++]=dc,Zo=v.id,Uc=v.overflow,dc=g}function ce(g,v){b(Qo,v),b(Nd,g),b(jo,null),g=Bw(v),x(jo),b(jo,g)}function te(){x(jo),x(Nd),x(Qo)}function se(g){g.memoizedState!==null&&b(Jm,g);var v=jo.current,E=Yp(v,g.type);v!==E&&(b(Nd,g),b(jo,E))}function le(g){Nd.current===g&&(x(jo),x(Nd)),Jm.current===g&&(x(Jm),Gs?Ph._currentValue=Dh:Ph._currentValue2=Dh)}function re(g){var v=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ke(ne(v,g)),vv}function pe(g,v){if(!ls)throw Error(i(175));h3(g.stateNode,g.type,g.memoizedProps,v,g)||re(g,!0)}function be(g){for(_o=g.return;_o;)switch(_o.tag){case 5:case 31:case 13:La=!1;return;case 27:case 3:La=!0;return;default:_o=_o.return}}function xe(g){if(!ls||g!==_o)return!1;if(!Gr)return be(g),Gr=!0,!1;var v=g.tag;if(bo?v!==3&&v!==27&&(v!==5||Qp(g.type)&&!Oa(g.type,g.memoizedProps))&&cs&&re(g):v!==3&&(v!==5||Qp(g.type)&&!Oa(g.type,g.memoizedProps))&&cs&&re(g),be(g),v===13){if(!ls)throw Error(i(316));if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));cs=yb(g)}else if(v===31){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));cs=m3(g)}else cs=bo&&v===27?s3(g.type,cs):_o?i3(g.stateNode):null;return!0}function Pe(){ls&&(cs=_o=null,Gr=!1)}function me(){var g=ku;return g!==null&&(al===null?al=g:al.push.apply(al,g),ku=null),g}function ke(g){ku===null?ku=[g]:ku.push(g)}function we(g,v,E){Gs?(b(fc,v._currentValue),v._currentValue=E):(b(fc,v._currentValue2),v._currentValue2=E)}function Te(g){var v=fc.current;Gs?g._currentValue=v:g._currentValue2=v,x(fc)}function oe(g,v,E){for(;g!==null;){var k=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,k!==null&&(k.childLanes|=v)):k!==null&&(k.childLanes&v)!==v&&(k.childLanes|=v),g===E)break;g=g.return}}function _e(g,v,E,k){var q=g.child;for(q!==null&&(q.return=g);q!==null;){var ee=q.dependencies;if(ee!==null){var Re=q.child;ee=ee.firstContext;e:for(;ee!==null;){var at=ee;ee=q;for(var jt=0;jt<v.length;jt++)if(at.context===v[jt]){ee.lanes|=E,at=ee.alternate,at!==null&&(at.lanes|=E),oe(ee.return,E,g),k||(Re=null);break e}ee=at.next}}else if(q.tag===18){if(Re=q.return,Re===null)throw Error(i(341));Re.lanes|=E,ee=Re.alternate,ee!==null&&(ee.lanes|=E),oe(Re,E,g),Re=null}else Re=q.child;if(Re!==null)Re.return=q;else for(Re=q;Re!==null;){if(Re===g){Re=null;break}if(q=Re.sibling,q!==null){q.return=Re.return,Re=q;break}Re=Re.return}q=Re}}function Fe(g,v,E,k){g=null;for(var q=v,ee=!1;q!==null;){if(!ee){if((q.flags&524288)!==0)ee=!0;else if((q.flags&262144)!==0)break}if(q.tag===10){var Re=q.alternate;if(Re===null)throw Error(i(387));if(Re=Re.memoizedProps,Re!==null){var at=q.type;$s(q.pendingProps.value,Re.value)||(g!==null?g.push(at):g=[at])}}else if(q===Jm.current){if(Re=q.alternate,Re===null)throw Error(i(387));Re.memoizedState.memoizedState!==q.memoizedState.memoizedState&&(g!==null?g.push(Ph):g=[Ph])}q=q.return}g!==null&&_e(v,g,E,k),v.flags|=262144}function Ue(g){for(g=g.firstContext;g!==null;){var v=g.context;if(!$s(Gs?v._currentValue:v._currentValue2,g.memoizedValue))return!0;g=g.next}return!1}function Oe(g){Yi=g,Bc=null,g=g.dependencies,g!==null&&(g.firstContext=null)}function ue(g){return fe(Yi,g)}function Q(g,v){return Yi===null&&Oe(g),fe(g,v)}function fe(g,v){var E=Gs?v._currentValue:v._currentValue2;if(v={context:v,memoizedValue:E,next:null},Bc===null){if(g===null)throw Error(i(308));Bc=v,g.dependencies={lanes:0,firstContext:v},g.flags|=524288}else Bc=Bc.next=v;return E}function Se(){return{controller:new N3,data:new Map,refCount:0}}function Ae(g){g.refCount--,g.refCount===0&&zo(rE,function(){g.controller.abort()})}function ve(){}function qe(g){g!==Ei&&g.next===null&&(Ei===null?eg=Ei=g:Ei=Ei.next=g),hc=!0,ba||(ba=!0,De())}function Ee(g,v){if(!yv&&hc){yv=!0;do for(var E=!1,k=eg;k!==null;){if(g!==0){var q=k.pendingLanes;if(q===0)var ee=0;else{var Re=k.suspendedLanes,at=k.pingedLanes;ee=(1<<31-rl(42|g)+1)-1,ee&=q&~(Re&~at),ee=ee&201326741?ee&201326741|1:ee?ee|2:0}ee!==0&&(E=!0,ut(k,ee))}else ee=Wr,ee=w(k,k===Er?ee:0,k.cancelPendingCommit!==null||k.timeoutHandle!==nl),(ee&3)===0||C(k,ee)||(E=!0,ut(k,ee));k=k.next}while(E);yv=!1}}function Ce(){Ye()}function Ye(){hc=ba=!1;var g=0;bf!==0&&kh()&&(g=bf);for(var v=ya(),E=null,k=eg;k!==null;){var q=k.next,ee=Ze(k,v);ee===0?(k.next=null,E===null?eg=q:E.next=q,q===null&&(Ei=E)):(E=k,(g!==0||(ee&3)!==0)&&(hc=!0)),k=q}uo!==0&&uo!==5||Ee(g),bf!==0&&(bf=0)}function Ze(g,v){for(var E=g.suspendedLanes,k=g.pingedLanes,q=g.expirationTimes,ee=g.pendingLanes&-62914561;0<ee;){var Re=31-rl(ee),at=1<<Re,jt=q[Re];jt===-1?((at&E)===0||(at&k)!==0)&&(q[Re]=A(at,v)):jt<=v&&(g.expiredLanes|=at),ee&=~at}if(v=Er,E=Wr,E=w(g,g===v?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==nl),k=g.callbackNode,E===0||g===v&&(Ni===2||Ni===9)||g.cancelPendingCommit!==null)return k!==null&&k!==null&&hv(k),g.callbackNode=null,g.callbackPriority=0;if((E&3)===0||C(g,E)){if(v=E&-E,v===g.callbackPriority)return v;switch(k!==null&&hv(k),U(E)){case 2:case 8:E=E3;break;case 32:E=Km;break;case 268435456:E=mv;break;default:E=Km}return k=it.bind(null,g),E=Ym(E,k),g.callbackPriority=v,g.callbackNode=E,v}return k!==null&&k!==null&&hv(k),g.callbackPriority=2,g.callbackNode=null,2}function it(g,v){if(uo!==0&&uo!==5)return g.callbackNode=null,g.callbackPriority=0,null;var E=g.callbackNode;if(Cu()&&g.callbackNode!==E)return null;var k=Wr;return k=w(g,g===Er?k:0,g.cancelPendingCommit!==null||g.timeoutHandle!==nl),k===0?null:(Fc(g,k,v),Ze(g,ya()),g.callbackNode!=null&&g.callbackNode===E?it.bind(null,g):null)}function ut(g,v){if(Cu())return null;Fc(g,v,!0)}function De(){rb?ib(function(){(jr&6)!==0?Ym(pv,Ce):Ye()}):Ym(pv,Ce)}function Ve(){if(bf===0){var g=Rd;g===0&&(g=fv,fv<<=1,(fv&261888)===0&&(fv=256)),bf=g}return bf}function lt(g,v){if(e0===null){var E=e0=[];Db=0,Rd=Ve(),So={status:"pending",value:void 0,then:function(k){E.push(k)}}}return Db++,v.then(Le,Le),v}function Le(){if(--Db===0&&e0!==null){So!==null&&(So.status="fulfilled");var g=e0;e0=null,Rd=0,So=null;for(var v=0;v<g.length;v++)(0,g[v])()}}function Ne(g,v){var E=[],k={status:"pending",value:null,reason:null,then:function(q){E.push(q)}};return g.then(function(){k.status="fulfilled",k.value=v;for(var q=0;q<E.length;q++)(0,E[q])(v)},function(q){for(k.status="rejected",k.reason=q,q=0;q<E.length;q++)(0,E[q])(void 0)}),k}function $e(){var g=_f.current;return g!==null?g:Er.pooledCache}function ft(g,v){v===null?b(_f,_f.current):b(_f,v.pool)}function nt(){var g=$e();return g===null?null:{parent:Gs?us._currentValue:us._currentValue2,pool:g}}function We(g,v){if($s(g,v))return!0;if(typeof g!="object"||g===null||typeof v!="object"||v===null)return!1;var E=Object.keys(g),k=Object.keys(v);if(E.length!==k.length)return!1;for(k=0;k<E.length;k++){var q=E[k];if(!nE.call(v,q)||!$s(g[q],v[q]))return!1}return!0}function Ke(g){return g=g.status,g==="fulfilled"||g==="rejected"}function je(g,v,E){switch(E=g[E],E===void 0?g.push(v):E!==v&&(v.then(ve,ve),v=E),v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,Lt(g),g;default:if(typeof v.status=="string")v.then(ve,ve);else{if(g=Er,g!==null&&100<g.shellSuspendCounter)throw Error(i(482));g=v,g.status="pending",g.then(function(k){if(v.status==="pending"){var q=v;q.status="fulfilled",q.value=k}},function(k){if(v.status==="pending"){var q=v;q.status="rejected",q.reason=k}})}switch(v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,Lt(g),g}throw ja=v,wo}}function et(g){try{var v=g._init;return v(g._payload)}catch(E){throw E!==null&&typeof E=="object"&&typeof E.then=="function"?(ja=E,wo):E}}function pt(){if(ja===null)throw Error(i(459));var g=ja;return ja=null,g}function Lt(g){if(g===wo||g===mc)throw Error(i(483))}function wt(g){var v=zh;return zh+=1,Sf===null&&(Sf=[]),je(Sf,g,v)}function yt(g,v){v=v.props.ref,g.ref=v!==void 0?v:null}function Pt(g,v){throw v.$$typeof===Ch?Error(i(525)):(g=Object.prototype.toString.call(v),Error(i(31,g==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":g)))}function zt(g){function v(Nt,St){if(g){var Ot=Nt.deletions;Ot===null?(Nt.deletions=[St],Nt.flags|=16):Ot.push(St)}}function E(Nt,St){if(!g)return null;for(;St!==null;)v(Nt,St),St=St.sibling;return null}function k(Nt){for(var St=new Map;Nt!==null;)Nt.key!==null?St.set(Nt.key,Nt):St.set(Nt.index,Nt),Nt=Nt.sibling;return St}function q(Nt,St){return Nt=El(Nt,St),Nt.index=0,Nt.sibling=null,Nt}function ee(Nt,St,Ot){return Nt.index=Ot,g?(Ot=Nt.alternate,Ot!==null?(Ot=Ot.index,Ot<St?(Nt.flags|=67108866,St):Ot):(Nt.flags|=67108866,St)):(Nt.flags|=1048576,St)}function Re(Nt){return g&&Nt.alternate===null&&(Nt.flags|=67108866),Nt}function at(Nt,St,Ot,cn){return St===null||St.tag!==6?(St=$y(Ot,Nt.mode,cn),St.return=Nt,St):(St=q(St,Ot),St.return=Nt,St)}function jt(Nt,St,Ot,cn){var qn=Ot.type;return qn===Ah?hn(Nt,St,Ot.props.children,cn,Ot.key):St!==null&&(St.elementType===qn||typeof qn=="object"&&qn!==null&&qn.$$typeof===Ia&&et(qn)===St.type)?(St=q(St,Ot.props),yt(St,Ot),St.return=Nt,St):(St=wd(Ot.type,Ot.key,Ot.props,null,Nt.mode,cn),yt(St,Ot),St.return=Nt,St)}function Yt(Nt,St,Ot,cn){return St===null||St.tag!==4||St.stateNode.containerInfo!==Ot.containerInfo||St.stateNode.implementation!==Ot.implementation?(St=Xy(Ot,Nt.mode,cn),St.return=Nt,St):(St=q(St,Ot.children||[]),St.return=Nt,St)}function hn(Nt,St,Ot,cn,qn){return St===null||St.tag!==7?(St=oc(Ot,Nt.mode,cn,qn),St.return=Nt,St):(St=q(St,Ot),St.return=Nt,St)}function en(Nt,St,Ot){if(typeof St=="string"&&St!==""||typeof St=="number"||typeof St=="bigint")return St=$y(""+St,Nt.mode,Ot),St.return=Nt,St;if(typeof St=="object"&&St!==null){switch(St.$$typeof){case Eu:return Ot=wd(St.type,St.key,St.props,null,Nt.mode,Ot),yt(Ot,St),Ot.return=Nt,Ot;case Eh:return St=Xy(St,Nt.mode,Ot),St.return=Nt,St;case Ia:return St=et(St),en(Nt,St,Ot)}if(gf(St)||d(St))return St=oc(St,Nt.mode,Ot,null),St.return=Nt,St;if(typeof St.then=="function")return en(Nt,wt(St),Ot);if(St.$$typeof===ac)return en(Nt,Q(Nt,St),Ot);Pt(Nt,St)}return null}function wn(Nt,St,Ot,cn){var qn=St!==null?St.key:null;if(typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint")return qn!==null?null:at(Nt,St,""+Ot,cn);if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case Eu:return Ot.key===qn?jt(Nt,St,Ot,cn):null;case Eh:return Ot.key===qn?Yt(Nt,St,Ot,cn):null;case Ia:return Ot=et(Ot),wn(Nt,St,Ot,cn)}if(gf(Ot)||d(Ot))return qn!==null?null:hn(Nt,St,Ot,cn,null);if(typeof Ot.then=="function")return wn(Nt,St,wt(Ot),cn);if(Ot.$$typeof===ac)return wn(Nt,St,Q(Nt,Ot),cn);Pt(Nt,Ot)}return null}function pr(Nt,St,Ot,cn,qn){if(typeof cn=="string"&&cn!==""||typeof cn=="number"||typeof cn=="bigint")return Nt=Nt.get(Ot)||null,at(St,Nt,""+cn,qn);if(typeof cn=="object"&&cn!==null){switch(cn.$$typeof){case Eu:return Nt=Nt.get(cn.key===null?Ot:cn.key)||null,jt(St,Nt,cn,qn);case Eh:return Nt=Nt.get(cn.key===null?Ot:cn.key)||null,Yt(St,Nt,cn,qn);case Ia:return cn=et(cn),pr(Nt,St,Ot,cn,qn)}if(gf(cn)||d(cn))return Nt=Nt.get(Ot)||null,hn(St,Nt,cn,qn,null);if(typeof cn.then=="function")return pr(Nt,St,Ot,wt(cn),qn);if(cn.$$typeof===ac)return pr(Nt,St,Ot,Q(St,cn),qn);Pt(St,cn)}return null}function Ys(Nt,St,Ot,cn){for(var qn=null,Cs=null,Yn=St,ii=St=0,Fo=null;Yn!==null&&ii<Ot.length;ii++){Yn.index>ii?(Fo=Yn,Yn=null):Fo=Yn.sibling;var pi=wn(Nt,Yn,Ot[ii],cn);if(pi===null){Yn===null&&(Yn=Fo);break}g&&Yn&&pi.alternate===null&&v(Nt,Yn),St=ee(pi,St,ii),Cs===null?qn=pi:Cs.sibling=pi,Cs=pi,Yn=Fo}if(ii===Ot.length)return E(Nt,Yn),Gr&&H(Nt,ii),qn;if(Yn===null){for(;ii<Ot.length;ii++)Yn=en(Nt,Ot[ii],cn),Yn!==null&&(St=ee(Yn,St,ii),Cs===null?qn=Yn:Cs.sibling=Yn,Cs=Yn);return Gr&&H(Nt,ii),qn}for(Yn=k(Yn);ii<Ot.length;ii++)Fo=pr(Yn,Nt,ii,Ot[ii],cn),Fo!==null&&(g&&Fo.alternate!==null&&Yn.delete(Fo.key===null?ii:Fo.key),St=ee(Fo,St,ii),Cs===null?qn=Fo:Cs.sibling=Fo,Cs=Fo);return g&&Yn.forEach(function(vc){return v(Nt,vc)}),Gr&&H(Nt,ii),qn}function l0(Nt,St,Ot,cn){if(Ot==null)throw Error(i(151));for(var qn=null,Cs=null,Yn=St,ii=St=0,Fo=null,pi=Ot.next();Yn!==null&&!pi.done;ii++,pi=Ot.next()){Yn.index>ii?(Fo=Yn,Yn=null):Fo=Yn.sibling;var vc=wn(Nt,Yn,pi.value,cn);if(vc===null){Yn===null&&(Yn=Fo);break}g&&Yn&&vc.alternate===null&&v(Nt,Yn),St=ee(vc,St,ii),Cs===null?qn=vc:Cs.sibling=vc,Cs=vc,Yn=Fo}if(pi.done)return E(Nt,Yn),Gr&&H(Nt,ii),qn;if(Yn===null){for(;!pi.done;ii++,pi=Ot.next())pi=en(Nt,pi.value,cn),pi!==null&&(St=ee(pi,St,ii),Cs===null?qn=pi:Cs.sibling=pi,Cs=pi);return Gr&&H(Nt,ii),qn}for(Yn=k(Yn);!pi.done;ii++,pi=Ot.next())pi=pr(Yn,Nt,ii,pi.value,cn),pi!==null&&(g&&pi.alternate!==null&&Yn.delete(pi.key===null?ii:pi.key),St=ee(pi,St,ii),Cs===null?qn=pi:Cs.sibling=pi,Cs=pi);return g&&Yn.forEach(function(iE){return v(Nt,iE)}),Gr&&H(Nt,ii),qn}function Rf(Nt,St,Ot,cn){if(typeof Ot=="object"&&Ot!==null&&Ot.type===Ah&&Ot.key===null&&(Ot=Ot.props.children),typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case Eu:e:{for(var qn=Ot.key;St!==null;){if(St.key===qn){if(qn=Ot.type,qn===Ah){if(St.tag===7){E(Nt,St.sibling),cn=q(St,Ot.props.children),cn.return=Nt,Nt=cn;break e}}else if(St.elementType===qn||typeof qn=="object"&&qn!==null&&qn.$$typeof===Ia&&et(qn)===St.type){E(Nt,St.sibling),cn=q(St,Ot.props),yt(cn,Ot),cn.return=Nt,Nt=cn;break e}E(Nt,St);break}else v(Nt,St);St=St.sibling}Ot.type===Ah?(cn=oc(Ot.props.children,Nt.mode,cn,Ot.key),cn.return=Nt,Nt=cn):(cn=wd(Ot.type,Ot.key,Ot.props,null,Nt.mode,cn),yt(cn,Ot),cn.return=Nt,Nt=cn)}return Re(Nt);case Eh:e:{for(qn=Ot.key;St!==null;){if(St.key===qn)if(St.tag===4&&St.stateNode.containerInfo===Ot.containerInfo&&St.stateNode.implementation===Ot.implementation){E(Nt,St.sibling),cn=q(St,Ot.children||[]),cn.return=Nt,Nt=cn;break e}else{E(Nt,St);break}else v(Nt,St);St=St.sibling}cn=Xy(Ot,Nt.mode,cn),cn.return=Nt,Nt=cn}return Re(Nt);case Ia:return Ot=et(Ot),Rf(Nt,St,Ot,cn)}if(gf(Ot))return Ys(Nt,St,Ot,cn);if(d(Ot)){if(qn=d(Ot),typeof qn!="function")throw Error(i(150));return Ot=qn.call(Ot),l0(Nt,St,Ot,cn)}if(typeof Ot.then=="function")return Rf(Nt,St,wt(Ot),cn);if(Ot.$$typeof===ac)return Rf(Nt,St,Q(Nt,Ot),cn);Pt(Nt,Ot)}return typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint"?(Ot=""+Ot,St!==null&&St.tag===6?(E(Nt,St.sibling),cn=q(St,Ot),cn.return=Nt,Nt=cn):(E(Nt,St),cn=$y(Ot,Nt.mode,cn),cn.return=Nt,Nt=cn),Re(Nt)):E(Nt,St)}return function(Nt,St,Ot,cn){try{zh=0;var qn=Rf(Nt,St,Ot,cn);return Sf=null,qn}catch(Yn){if(Yn===wo||Yn===mc)throw Yn;var Cs=n(29,Yn,null,Nt.mode);return Cs.lanes=cn,Cs.return=Nt,Cs}finally{}}}function Dt(){for(var g=Pu,v=Fh=Pu=0;v<g;){var E=ea[v];ea[v++]=null;var k=ea[v];ea[v++]=null;var q=ea[v];ea[v++]=null;var ee=ea[v];if(ea[v++]=null,k!==null&&q!==null){var Re=k.pending;Re===null?q.next=q:(q.next=Re.next,Re.next=q),k.pending=q}ee!==0&&ht(E,q,ee)}}function Et(g,v,E,k){ea[Pu++]=g,ea[Pu++]=v,ea[Pu++]=E,ea[Pu++]=k,Fh|=k,g.lanes|=k,g=g.alternate,g!==null&&(g.lanes|=k)}function Be(g,v,E,k){return Et(g,v,E,k),It(g)}function Qe(g,v){return Et(g,null,null,v),It(g)}function ht(g,v,E){g.lanes|=E;var k=g.alternate;k!==null&&(k.lanes|=E);for(var q=!1,ee=g.return;ee!==null;)ee.childLanes|=E,k=ee.alternate,k!==null&&(k.childLanes|=E),ee.tag===22&&(g=ee.stateNode,g===null||g._visibility&1||(q=!0)),g=ee,ee=ee.return;return g.tag===3?(ee=g.stateNode,q&&v!==null&&(q=31-rl(E),g=ee.hiddenUpdates,k=g[q],k===null?g[q]=[v]:k.push(v),v.lane=E|536870912),ee):null}function It(g){if(50<ci)throw ci=0,og=null,Error(i(185));for(var v=g.return;v!==null;)g=v,v=g.return;return g.tag===3?g.stateNode:null}function Tt(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ct(g,v){g=g.updateQueue,v.updateQueue===g&&(v.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,callbacks:null})}function Ut(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function Gt(g,v,E){var k=g.updateQueue;if(k===null)return null;if(k=k.shared,(jr&2)!==0){var q=k.pending;return q===null?v.next=v:(v.next=q.next,q.next=v),k.pending=v,v=It(g),ht(g,null,E),v}return Et(g,k,v,E),It(g)}function sn(g,v,E){if(v=v.updateQueue,v!==null&&(v=v.shared,(E&4194048)!==0)){var k=v.lanes;k&=g.pendingLanes,E|=k,v.lanes=E,L(g,E)}}function nn(g,v){var E=g.updateQueue,k=g.alternate;if(k!==null&&(k=k.updateQueue,E===k)){var q=null,ee=null;if(E=E.firstBaseUpdate,E!==null){do{var Re={lane:E.lane,tag:E.tag,payload:E.payload,callback:null,next:null};ee===null?q=ee=Re:ee=ee.next=Re,E=E.next}while(E!==null);ee===null?q=ee=v:ee=ee.next=v}else q=ee=v;E={baseState:k.baseState,firstBaseUpdate:q,lastBaseUpdate:ee,shared:k.shared,callbacks:k.callbacks},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=v:g.next=v,E.lastBaseUpdate=v}function En(){if(_v){var g=So;if(g!==null)throw g}}function Hn(g,v,E,k){_v=!1;var q=g.updateQueue;Rl=!1;var ee=q.firstBaseUpdate,Re=q.lastBaseUpdate,at=q.shared.pending;if(at!==null){q.shared.pending=null;var jt=at,Yt=jt.next;jt.next=null,Re===null?ee=Yt:Re.next=Yt,Re=jt;var hn=g.alternate;hn!==null&&(hn=hn.updateQueue,at=hn.lastBaseUpdate,at!==Re&&(at===null?hn.firstBaseUpdate=Yt:at.next=Yt,hn.lastBaseUpdate=jt))}if(ee!==null){var en=q.baseState;Re=0,hn=Yt=jt=null,at=ee;do{var wn=at.lane&-536870913,pr=wn!==at.lane;if(pr?(Wr&wn)===wn:(k&wn)===wn){wn!==0&&wn===Rd&&(_v=!0),hn!==null&&(hn=hn.next={lane:0,tag:at.tag,payload:at.payload,callback:null,next:null});e:{var Ys=g,l0=at;wn=v;var Rf=E;switch(l0.tag){case 1:if(Ys=l0.payload,typeof Ys=="function"){en=Ys.call(Rf,en,wn);break e}en=Ys;break e;case 3:Ys.flags=Ys.flags&-65537|128;case 0:if(Ys=l0.payload,wn=typeof Ys=="function"?Ys.call(Rf,en,wn):Ys,wn==null)break e;en=Yx({},en,wn);break e;case 2:Rl=!0}}wn=at.callback,wn!==null&&(g.flags|=64,pr&&(g.flags|=8192),pr=q.callbacks,pr===null?q.callbacks=[wn]:pr.push(wn))}else pr={lane:wn,tag:at.tag,payload:at.payload,callback:at.callback,next:null},hn===null?(Yt=hn=pr,jt=en):hn=hn.next=pr,Re|=wn;if(at=at.next,at===null){if(at=q.shared.pending,at===null)break;pr=at,at=pr.next,pr.next=null,q.lastBaseUpdate=pr,q.shared.pending=null}}while(!0);hn===null&&(jt=en),q.baseState=jt,q.firstBaseUpdate=Yt,q.lastBaseUpdate=hn,ee===null&&(q.shared.lanes=0),Dd|=Re,g.lanes=Re,g.memoizedState=en}}function Nn(g,v){if(typeof g!="function")throw Error(i(191,g));g.call(v)}function Br(g,v){var E=g.callbacks;if(E!==null)for(g.callbacks=null,g=0;g<E.length;g++)Nn(E[g],v)}function er(g,v){g=Ou,b(wf,g),b(Uh,v),Ou=g|v.baseLanes}function ge(){b(wf,Ou),b(Uh,Uh.current)}function rt(){Ou=wf.current,x(Uh),x(wf)}function bt(g){var v=g.alternate;b(Ls,Ls.current&1),b(sl,g),ol===null&&(v===null||Uh.current!==null||v.memoizedState!==null)&&(ol=g)}function vt(g){b(Ls,Ls.current),b(sl,g),ol===null&&(ol=g)}function gt(g){g.tag===22?(b(Ls,Ls.current),b(sl,g),ol===null&&(ol=g)):Xt()}function Xt(){b(Ls,Ls.current),b(sl,sl.current)}function Jt(g){x(sl),ol===g&&(ol=null),x(Ls)}function Kt(g){for(var v=g;v!==null;){if(v.tag===13){var E=v.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||vf(E)||rv(E)))return v}else if(v.tag===19&&(v.memoizedProps.revealOrder==="forwards"||v.memoizedProps.revealOrder==="backwards"||v.memoizedProps.revealOrder==="unstable_legacy-backwards"||v.memoizedProps.revealOrder==="together")){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===g)break;for(;v.sibling===null;){if(v.return===null||v.return===g)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}function Zt(){throw Error(i(321))}function xn(g,v){if(v===null)return!1;for(var E=0;E<v.length&&E<g.length;E++)if(!$s(g[E],v[E]))return!1;return!0}function On(g,v,E,k,q,ee){return kd=ee,br=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,Vn.H=g===null||g.memoizedState===null?ws:Iu,Qr=!1,ee=E(k,q),Qr=!1,Mr&&(ee=fn(v,E,k,q)),Wn(g),ee}function Wn(g){Vn.H=kl;var v=Fn!==null&&Fn.next!==null;if(kd=0,ur=Fn=br=null,Cr=!1,gc=0,Hc=null,v)throw Error(i(300));g===null||es||(g=g.dependencies,g!==null&&Ue(g)&&(es=!0))}function fn(g,v,E,k){br=g;var q=0;do{if(Mr&&(Hc=null),gc=0,Mr=!1,25<=q)throw Error(i(301));if(q+=1,ur=Fn=null,g.updateQueue!=null){var ee=g.updateQueue;ee.lastEffect=null,ee.events=null,ee.stores=null,ee.memoCache!=null&&(ee.memoCache.index=0)}Vn.H=Mf,ee=v(E,k)}while(Mr);return ee}function or(){var g=Vn.H,v=g.useState()[0];return v=typeof v.then=="function"?Dn(v):v,g=g.useState()[0],(Fn!==null?Fn.memoizedState:null)!==g&&(br.flags|=1024),v}function Kr(){var g=_a!==0;return _a=0,g}function ni(g,v,E){v.updateQueue=g.updateQueue,v.flags&=-2053,g.lanes&=~E}function fr(g){if(Cr){for(g=g.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Cr=!1}kd=0,ur=Fn=br=null,Mr=!1,gc=_a=0,Hc=null}function kr(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ur===null?br.memoizedState=ur=g:ur=ur.next=g,ur}function ln(){if(Fn===null){var g=br.alternate;g=g!==null?g.memoizedState:null}else g=Fn.next;var v=ur===null?br.memoizedState:ur.next;if(v!==null)ur=v,Fn=g;else{if(g===null)throw br.alternate===null?Error(i(467)):Error(i(310));Fn=g,g={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},ur===null?br.memoizedState=ur=g:ur=ur.next=g}return ur}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dn(g){var v=gc;return gc+=1,Hc===null&&(Hc=[]),g=je(Hc,g,v),v=br,(ur===null?v.memoizedState:ur.next)===null&&(v=v.alternate,Vn.H=v===null||v.memoizedState===null?ws:Iu),g}function ms(g){if(g!==null&&typeof g=="object"){if(typeof g.then=="function")return Dn(g);if(g.$$typeof===ac)return ue(g)}throw Error(i(438,String(g)))}function Ns(g){var v=null,E=br.updateQueue;if(E!==null&&(v=E.memoCache),v==null){var k=br.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(v={data:k.data.map(function(q){return q.slice()}),index:0})))}if(v==null&&(v={data:[],index:0}),E===null&&(E=ss(),br.updateQueue=E),E.memoCache=v,E=v.data[v.index],E===void 0)for(E=v.data[v.index]=Array(g),k=0;k<g;k++)E[k]=Ky;return v.index++,E}function Di(g,v){return typeof v=="function"?v(g):v}function gs(g){var v=ln();return xr(v,Fn,g)}function xr(g,v,E){var k=g.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=E;var q=g.baseQueue,ee=k.pending;if(ee!==null){if(q!==null){var Re=q.next;q.next=ee.next,ee.next=Re}v.baseQueue=q=ee,k.pending=null}if(ee=g.baseState,q===null)g.memoizedState=ee;else{v=q.next;var at=Re=null,jt=null,Yt=v,hn=!1;do{var en=Yt.lane&-536870913;if(en!==Yt.lane?(Wr&en)===en:(kd&en)===en){var wn=Yt.revertLane;if(wn===0)jt!==null&&(jt=jt.next={lane:0,revertLane:0,gesture:null,action:Yt.action,hasEagerState:Yt.hasEagerState,eagerState:Yt.eagerState,next:null}),en===Rd&&(hn=!0);else if((kd&wn)===wn){Yt=Yt.next,wn===Rd&&(hn=!0);continue}else en={lane:0,revertLane:Yt.revertLane,gesture:null,action:Yt.action,hasEagerState:Yt.hasEagerState,eagerState:Yt.eagerState,next:null},jt===null?(at=jt=en,Re=ee):jt=jt.next=en,br.lanes|=wn,Dd|=wn;en=Yt.action,Qr&&E(ee,en),ee=Yt.hasEagerState?Yt.eagerState:E(ee,en)}else wn={lane:en,revertLane:Yt.revertLane,gesture:Yt.gesture,action:Yt.action,hasEagerState:Yt.hasEagerState,eagerState:Yt.eagerState,next:null},jt===null?(at=jt=wn,Re=ee):jt=jt.next=wn,br.lanes|=en,Dd|=en;Yt=Yt.next}while(Yt!==null&&Yt!==v);if(jt===null?Re=ee:jt.next=at,!$s(ee,g.memoizedState)&&(es=!0,hn&&(E=So,E!==null)))throw E;g.memoizedState=ee,g.baseState=Re,g.baseQueue=jt,k.lastRenderedState=ee}return q===null&&(k.lanes=0),[g.memoizedState,k.dispatch]}function hi(g){var v=ln(),E=v.queue;if(E===null)throw Error(i(311));E.lastRenderedReducer=g;var k=E.dispatch,q=E.pending,ee=v.memoizedState;if(q!==null){E.pending=null;var Re=q=q.next;do ee=g(ee,Re.action),Re=Re.next;while(Re!==q);$s(ee,v.memoizedState)||(es=!0),v.memoizedState=ee,v.baseQueue===null&&(v.baseState=ee),E.lastRenderedState=ee}return[ee,k]}function Rs(g,v,E){var k=br,q=ln(),ee=Gr;if(ee){if(E===void 0)throw Error(i(407));E=E()}else E=v();var Re=!$s((Fn||q).memoizedState,E);if(Re&&(q.memoizedState=E,es=!0),q=q.queue,Hr(ga.bind(null,k,q,g),[g]),q.getSnapshot!==v||Re||ur!==null&&ur.memoizedState.tag&1){if(k.flags|=2048,xs(9,{destroy:void 0},qo.bind(null,k,q,E,v),null),Er===null)throw Error(i(349));ee||(kd&127)!==0||Pi(k,v,E)}return E}function Pi(g,v,E){g.flags|=16384,g={getSnapshot:v,value:E},v=br.updateQueue,v===null?(v=ss(),br.updateQueue=v,v.stores=[g]):(E=v.stores,E===null?v.stores=[g]:E.push(g))}function qo(g,v,E,k){v.value=E,v.getSnapshot=k,Aa(v)&&Yl(g)}function ga(g,v,E){return E(function(){Aa(v)&&Yl(g)})}function Aa(g){var v=g.getSnapshot;g=g.value;try{var E=v();return!$s(g,E)}catch{return!0}}function Yl(g){var v=Qe(g,2);v!==null&&_s(v,g,2)}function _l(g){var v=kr();if(typeof g=="function"){var E=g;if(g=E(),Qr){W(!0);try{E()}finally{W(!1)}}}return v.memoizedState=v.baseState=g,v.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:g},v}function xa(g,v,E,k){return g.baseState=E,xr(g,Fn,typeof k=="function"?k:Di)}function ks(g,v,E,k,q){if(Sh(g))throw Error(i(485));if(g=v.action,g!==null){var ee={payload:q,action:g,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Re){ee.listeners.push(Re)}};Vn.T!==null?E(!0):ee.isTransition=!1,k(ee),E=v.pending,E===null?(ee.next=v.pending=ee,Kl(v,ee)):(ee.next=E.next,v.pending=E.next=ee)}}function Kl(g,v){var E=v.action,k=v.payload,q=g.state;if(v.isTransition){var ee=Vn.T,Re={};Vn.T=Re;try{var at=E(q,k),jt=Vn.S;jt!==null&&jt(Re,at),Ya(g,v,at)}catch(Yt){Ra(g,v,Yt)}finally{ee!==null&&Re.types!==null&&(ee.types=Re.types),Vn.T=ee}}else try{ee=E(q,k),Ya(g,v,ee)}catch(Yt){Ra(g,v,Yt)}}function Ya(g,v,E){E!==null&&typeof E=="object"&&typeof E.then=="function"?E.then(function(k){Na(g,v,k)},function(k){return Ra(g,v,k)}):Na(g,v,E)}function Na(g,v,E){v.status="fulfilled",v.value=E,Ic(v),g.state=E,v=g.pending,v!==null&&(E=v.next,E===v?g.pending=null:(E=E.next,v.next=E,Kl(g,E)))}function Ra(g,v,E){var k=g.pending;if(g.pending=null,k!==null){k=k.next;do v.status="rejected",v.reason=E,Ic(v),v=v.next;while(v!==k)}g.action=null}function Ic(g){g=g.listeners;for(var v=0;v<g.length;v++)(0,g[v])()}function Oc(g,v){return v}function Zl(g,v){if(Gr){var E=Er.formState;if(E!==null){e:{var k=br;if(Gr){if(cs){var q=r3(cs,La);if(q){cs=i3(q),k=mb(q);break e}}re(k)}k=!1}k&&(v=E[0])}}E=kr(),E.memoizedState=E.baseState=v,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oc,lastRenderedState:v},E.queue=k,E=Ml.bind(null,br,k),k.dispatch=E,k=_l(!1);var ee=Rp.bind(null,br,!1,k.queue);return k=kr(),q={state:v,dispatch:null,action:g,pending:null},k.queue=q,E=ks.bind(null,br,q,ee,E),q.dispatch=E,k.memoizedState=g,[v,E,!1]}function Xo(g){var v=ln();return io(v,Fn,g)}function io(g,v,E){if(v=xr(g,v,Oc)[0],g=gs(Di)[0],typeof v=="object"&&v!==null&&typeof v.then=="function")try{var k=Dn(v)}catch(Re){throw Re===wo?mc:Re}else k=v;v=ln();var q=v.queue,ee=q.dispatch;return E!==v.memoizedState&&(br.flags|=2048,xs(9,{destroy:void 0},Ro.bind(null,q,E),null)),[k,ee,g]}function Ro(g,v){g.action=v}function Sl(g){var v=ln(),E=Fn;if(E!==null)return io(v,E,g);ln(),v=v.memoizedState,E=ln();var k=E.queue.dispatch;return E.memoizedState=g,[v,k,!1]}function xs(g,v,E,k){return g={tag:g,create:E,deps:k,inst:v,next:null},v=br.updateQueue,v===null&&(v=ss(),br.updateQueue=v),E=v.lastEffect,E===null?v.lastEffect=g.next=g:(k=E.next,E.next=g,g.next=k,v.lastEffect=g),g}function Ka(){return ln().memoizedState}function Za(g,v,E,k){var q=kr();br.flags|=g,q.memoizedState=xs(1|v,{destroy:void 0},E,k===void 0?null:k)}function Lc(g,v,E,k){var q=ln();k=k===void 0?null:k;var ee=q.memoizedState.inst;Fn!==null&&k!==null&&xn(k,Fn.memoizedState.deps)?q.memoizedState=xs(v,ee,E,k):(br.flags|=g,q.memoizedState=xs(1|v,ee,E,k))}function ri(g,v){Za(8390656,8,g,v)}function Hr(g,v){Lc(2048,8,g,v)}function Yo(g){br.flags|=4;var v=br.updateQueue;if(v===null)v=ss(),br.updateQueue=v,v.events=[g];else{var E=v.events;E===null?v.events=[g]:E.push(g)}}function vr(g){var v=ln().memoizedState;return Yo({ref:v,nextImpl:g}),function(){if((jr&2)!==0)throw Error(i(440));return v.impl.apply(void 0,arguments)}}function Si(g,v){return Lc(4,2,g,v)}function Ii(g,v){return Lc(4,4,g,v)}function qr(g,v){if(typeof v=="function"){g=g();var E=v(g);return function(){typeof E=="function"?E():v(null)}}if(v!=null)return g=g(),v.current=g,function(){v.current=null}}function ka(g,v,E){E=E!=null?E.concat([g]):null,Lc(4,4,qr.bind(null,v,g),E)}function wl(){}function Ql(g,v){var E=ln();v=v===void 0?null:v;var k=E.memoizedState;return v!==null&&xn(v,k[1])?k[0]:(E.memoizedState=[g,v],g)}function go(g,v){var E=ln();v=v===void 0?null:v;var k=E.memoizedState;if(v!==null&&xn(v,k[1]))return k[0];if(k=g(),Qr){W(!0);try{g()}finally{W(!1)}}return E.memoizedState=[k,v],k}function gi(g,v,E){return E===void 0||(kd&1073741824)!==0&&(Wr&261930)===0?g.memoizedState=v:(g.memoizedState=E,g=bd(),br.lanes|=g,Dd|=g,E)}function _h(g,v,E,k){return $s(E,v)?E:Uh.current!==null?(g=gi(g,E,k),$s(g,v)||(es=!0),g):(kd&42)===0||(kd&1073741824)!==0&&(Wr&261930)===0?(es=!0,g.memoizedState=E):(g=bd(),br.lanes|=g,Dd|=g,v)}function dd(g,v,E,k,q){var ee=lc();Vr(ee!==0&&8>ee?ee:8);var Re=Vn.T,at={};Vn.T=at,Rp(g,!1,v,E);try{var jt=q(),Yt=Vn.S;if(Yt!==null&&Yt(at,jt),jt!==null&&typeof jt=="object"&&typeof jt.then=="function"){var hn=Ne(jt,k);xo(g,v,hn,as(g))}else xo(g,v,k,as(g))}catch(en){xo(g,v,{then:function(){},status:"rejected",reason:en},as())}finally{Vr(ee),Re!==null&&at.types!==null&&(Re.types=at.types),Vn.T=Re}}function fd(g){var v=g.memoizedState;if(v!==null)return v;v={memoizedState:Dh,baseState:Dh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:Dh},next:null};var E={};return v.next={memoizedState:E,baseState:E,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:E},next:null},g.memoizedState=v,g=g.alternate,g!==null&&(g.memoizedState=v),v}function rf(){return ue(Ph)}function va(){return ln().memoizedState}function qi(){return ln().memoizedState}function Bs(g){for(var v=g.return;v!==null;){switch(v.tag){case 24:case 3:var E=as();g=Ut(E);var k=Gt(v,g,E);k!==null&&(_s(k,v,E),sn(k,v,E)),v={cache:Se()},g.payload=v;return}v=v.return}}function vs(g,v,E){var k=as();E={lane:k,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null},Sh(g)?Cm(v,E):(E=Be(g,v,E,k),E!==null&&(_s(E,g,k),sf(E,v,k)))}function Ml(g,v,E){var k=as();xo(g,v,E,k)}function xo(g,v,E,k){var q={lane:k,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null};if(Sh(g))Cm(v,q);else{var ee=g.alternate;if(g.lanes===0&&(ee===null||ee.lanes===0)&&(ee=v.lastRenderedReducer,ee!==null))try{var Re=v.lastRenderedState,at=ee(Re,E);if(q.hasEagerState=!0,q.eagerState=at,$s(at,Re))return Et(g,v,q,0),Er===null&&Dt(),!1}catch{}finally{}if(E=Be(g,v,q,k),E!==null)return _s(E,g,k),sf(E,v,k),!0}return!1}function Rp(g,v,E,k){if(k={lane:2,revertLane:Ve(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},Sh(g)){if(v)throw Error(i(479))}else v=Be(g,E,k,2),v!==null&&_s(v,g,2)}function Sh(g){var v=g.alternate;return g===br||v!==null&&v===br}function Cm(g,v){Mr=Cr=!0;var E=g.pending;E===null?v.next=v:(v.next=E.next,E.next=v),g.pending=v}function sf(g,v,E){if((E&4194048)!==0){var k=v.lanes;k&=g.pendingLanes,E|=k,v.lanes=E,L(g,E)}}function hd(g,v,E,k){v=g.memoizedState,E=E(k,v),E=E==null?v:Yx({},v,E),g.memoizedState=E,g.lanes===0&&(g.updateQueue.baseState=E)}function kp(g,v,E,k,q,ee,Re){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(k,ee,Re):v.prototype&&v.prototype.isPureReactComponent?!We(E,k)||!We(q,ee):!0}function Dp(g,v,E,k){g=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(E,k),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(E,k),v.state!==g&&tg.enqueueReplaceState(v,v.state,null)}function pd(g,v){var E=v;if("ref"in v){E={};for(var k in v)k!=="ref"&&(E[k]=v[k])}if(g=g.defaultProps){E===v&&(E=Yx({},E));for(var q in g)E[q]===void 0&&(E[q]=g[q])}return E}function Jl(g,v){try{var E=g.onUncaughtError;E(v.value,{componentStack:v.stack})}catch(k){setTimeout(function(){throw k})}}function ec(g,v,E){try{var k=g.onCaughtError;k(E.value,{componentStack:E.stack,errorBoundary:v.tag===1?v.stateNode:null})}catch(q){setTimeout(function(){throw q})}}function md(g,v,E){return E=Ut(E),E.tag=3,E.payload={element:null},E.callback=function(){Jl(g,v)},E}function Em(g){return g=Ut(g),g.tag=3,g}function Pp(g,v,E,k){var q=E.type.getDerivedStateFromError;if(typeof q=="function"){var ee=k.value;g.payload=function(){return q(ee)},g.callback=function(){ec(v,E,k)}}var Re=E.stateNode;Re!==null&&typeof Re.componentDidCatch=="function"&&(g.callback=function(){ec(v,E,k),typeof q!="function"&&(Pd===null?Pd=new Set([this]):Pd.add(this));var at=k.stack;this.componentDidCatch(k.value,{componentStack:at!==null?at:""})})}function Am(g,v,E,k,q){if(E.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(v=E.alternate,v!==null&&Fe(v,E,q,!0),E=sl.current,E!==null){switch(E.tag){case 31:case 13:return ol===null?Hp():E.alternate===null&&Ts===0&&(Ts=3),E.flags&=-257,E.flags|=65536,E.lanes=q,k===Du?E.flags|=16384:(v=E.updateQueue,v===null?E.updateQueue=new Set([k]):v.add(k),Wp(g,k,q)),!1;case 22:return E.flags|=65536,k===Du?E.flags|=16384:(v=E.updateQueue,v===null?(v={transitions:null,markerInstances:null,retryQueue:new Set([k])},E.updateQueue=v):(E=v.retryQueue,E===null?v.retryQueue=new Set([k]):E.add(k)),Wp(g,k,q)),!1}throw Error(i(435,E.tag))}return Wp(g,k,q),Hp(),!1}if(Gr)return v=sl.current,v!==null?((v.flags&65536)===0&&(v.flags|=256),v.flags|=65536,v.lanes=q,k!==vv&&(g=Error(i(422),{cause:k}),ke(ne(g,E)))):(k!==vv&&(v=Error(i(423),{cause:k}),ke(ne(v,E))),g=g.current.alternate,g.flags|=65536,q&=-q,g.lanes|=q,k=ne(k,E),q=md(g.stateNode,k,q),nn(g,q),Ts!==4&&(Ts=2)),!1;var ee=Error(i(520),{cause:k});if(ee=ne(ee,E),rg===null?rg=[ee]:rg.push(ee),Ts!==4&&(Ts=2),v===null)return!0;k=ne(k,E),E=v;do{switch(E.tag){case 3:return E.flags|=65536,g=q&-q,E.lanes|=g,g=md(E.stateNode,k,g),nn(E,g),!1;case 1:if(v=E.type,ee=E.stateNode,(E.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||ee!==null&&typeof ee.componentDidCatch=="function"&&(Pd===null||!Pd.has(ee))))return E.flags|=65536,q&=-q,E.lanes|=q,q=Em(q),Pp(q,g,E,k),nn(E,q),!1}E=E.return}while(E!==null);return!1}function Hs(g,v,E,k){v.child=g===null?Pb(v,null,E,k):Jo(v,g.child,E,k)}function Nm(g,v,E,k,q){E=E.render;var ee=v.ref;if("ref"in k){var Re={};for(var at in k)at!=="ref"&&(Re[at]=k[at])}else Re=k;return Oe(v),k=On(g,v,E,Re,ee,q),at=Kr(),g!==null&&!es?(ni(g,v,q),Xe(g,v,q)):(Gr&&at&&G(v),v.flags|=1,Hs(g,v,k,q),v.child)}function Rm(g,v,E,k,q){if(g===null){var ee=E.type;return typeof ee=="function"&&!Mh(ee)&&ee.defaultProps===void 0&&E.compare===null?(v.tag=15,v.type=ee,km(g,v,ee,k,q)):(g=wd(E.type,null,k,v,v.mode,q),g.ref=v.ref,g.return=v,v.child=g)}if(ee=g.child,!dt(g,q)){var Re=ee.memoizedProps;if(E=E.compare,E=E!==null?E:We,E(Re,k)&&g.ref===v.ref)return Xe(g,v,q)}return v.flags|=1,g=El(ee,k),g.ref=v.ref,g.return=v,v.child=g}function km(g,v,E,k,q){if(g!==null){var ee=g.memoizedProps;if(We(ee,k)&&g.ref===v.ref)if(es=!1,v.pendingProps=k=ee,dt(g,q))(g.flags&131072)!==0&&(es=!0);else return v.lanes=g.lanes,Xe(g,v,q)}return xd(g,v,E,k,q)}function Dm(g,v,E,k){var q=k.children,ee=g!==null?g.memoizedState:null;if(g===null&&v.stateNode===null&&(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((v.flags&128)!==0){if(ee=ee!==null?ee.baseLanes|E:E,g!==null){for(k=v.child=g.child,q=0;k!==null;)q=q|k.lanes|k.childLanes,k=k.sibling;k=q&~ee}else k=0,v.child=null;return gd(g,v,ee,E,k)}if((E&536870912)!==0)v.memoizedState={baseLanes:0,cachePool:null},g!==null&&ft(v,ee!==null?ee.cachePool:null),ee!==null?er(v,ee):ge(),gt(v);else return k=v.lanes=536870912,gd(g,v,ee!==null?ee.baseLanes|E:E,E,k)}else ee!==null?(ft(v,ee.cachePool),er(v,ee),Xt(),v.memoizedState=null):(g!==null&&ft(v,null),ge(),Xt());return Hs(g,v,q,E),v.child}function gu(g,v){return g!==null&&g.tag===22||v.stateNode!==null||(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.sibling}function gd(g,v,E,k,q){var ee=$e();return ee=ee===null?null:{parent:Gs?us._currentValue:us._currentValue2,pool:ee},v.memoizedState={baseLanes:E,cachePool:ee},g!==null&&ft(v,null),ge(),gt(v),g!==null&&Fe(g,v,k,!0),v.childLanes=q,null}function Ip(g,v){return v=vu({mode:v.mode,children:v.children},g.mode),v.ref=g.ref,g.child=v,v.return=g,v}function Op(g,v,E){return Jo(v,g.child,null,E),g=Ip(v,v.pendingProps),g.flags|=2,Jt(v),v.memoizedState=null,g}function Pm(g,v,E){var k=v.pendingProps,q=(v.flags&128)!==0;if(v.flags&=-129,g===null){if(Gr){if(k.mode==="hidden")return g=Ip(v,k),v.lanes=536870912,gu(null,g);if(vt(v),(g=cs)?(g=xb(g,La),g!==null&&(v.memoizedState={dehydrated:g,treeContext:dc!==null?{id:Zo,overflow:Uc}:null,retryLane:536870912,hydrationErrors:null},E=qy(g),E.return=v,v.child=E,_o=v,cs=null)):g=null,g===null)throw re(v);return v.lanes=536870912,null}return Ip(v,k)}var ee=g.memoizedState;if(ee!==null){var Re=ee.dehydrated;if(vt(v),q)if(v.flags&256)v.flags&=-257,v=Op(g,v,E);else if(v.memoizedState!==null)v.child=g.child,v.flags|=128,v=null;else throw Error(i(558));else if(es||Fe(g,v,E,!1),q=(E&g.childLanes)!==0,es||q){if(k=Er,k!==null&&(Re=V(k,E),Re!==0&&Re!==ee.retryLane))throw ee.retryLane=Re,Qe(g,Re),_s(k,g,Re),za;Hp(),v=Op(g,v,E)}else g=ee.treeContext,ls&&(cs=l3(Re),_o=v,Gr=!0,ku=null,La=!1,g!==null&&ie(v,g)),v=Ip(v,k),v.flags|=4096;return v}return g=El(g.child,{mode:k.mode,children:k.children}),g.ref=v.ref,v.child=g,g.return=v,g}function tc(g,v){var E=v.ref;if(E===null)g!==null&&g.ref!==null&&(v.flags|=4194816);else{if(typeof E!="function"&&typeof E!="object")throw Error(i(284));(g===null||g.ref!==E)&&(v.flags|=4194816)}}function xd(g,v,E,k,q){return Oe(v),E=On(g,v,E,k,void 0,q),k=Kr(),g!==null&&!es?(ni(g,v,q),Xe(g,v,q)):(Gr&&k&&G(v),v.flags|=1,Hs(g,v,E,q),v.child)}function Ds(g,v,E,k,q,ee){return Oe(v),v.updateQueue=null,E=fn(v,k,E,q),Wn(g),k=Kr(),g!==null&&!es?(ni(g,v,ee),Xe(g,v,ee)):(Gr&&k&&G(v),v.flags|=1,Hs(g,v,E,ee),v.child)}function xu(g,v,E,k,q){if(Oe(v),v.stateNode===null){var ee=Au,Re=E.contextType;typeof Re=="object"&&Re!==null&&(ee=ue(Re)),ee=new E(k,ee),v.memoizedState=ee.state!==null&&ee.state!==void 0?ee.state:null,ee.updater=tg,v.stateNode=ee,ee._reactInternals=v,ee=v.stateNode,ee.props=k,ee.state=v.memoizedState,ee.refs={},Tt(v),Re=E.contextType,ee.context=typeof Re=="object"&&Re!==null?ue(Re):Au,ee.state=v.memoizedState,Re=E.getDerivedStateFromProps,typeof Re=="function"&&(hd(v,E,Re,k),ee.state=v.memoizedState),typeof E.getDerivedStateFromProps=="function"||typeof ee.getSnapshotBeforeUpdate=="function"||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(Re=ee.state,typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount(),Re!==ee.state&&tg.enqueueReplaceState(ee,ee.state,null),Hn(v,k,ee,q),En(),ee.state=v.memoizedState),typeof ee.componentDidMount=="function"&&(v.flags|=4194308),k=!0}else if(g===null){ee=v.stateNode;var at=v.memoizedProps,jt=pd(E,at);ee.props=jt;var Yt=ee.context,hn=E.contextType;Re=Au,typeof hn=="object"&&hn!==null&&(Re=ue(hn));var en=E.getDerivedStateFromProps;hn=typeof en=="function"||typeof ee.getSnapshotBeforeUpdate=="function",at=v.pendingProps!==at,hn||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(at||Yt!==Re)&&Dp(v,ee,k,Re),Rl=!1;var wn=v.memoizedState;ee.state=wn,Hn(v,k,ee,q),En(),Yt=v.memoizedState,at||wn!==Yt||Rl?(typeof en=="function"&&(hd(v,E,en,k),Yt=v.memoizedState),(jt=Rl||kp(v,E,jt,k,wn,Yt,Re))?(hn||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount()),typeof ee.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ee.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=k,v.memoizedState=Yt),ee.props=k,ee.state=Yt,ee.context=Re,k=jt):(typeof ee.componentDidMount=="function"&&(v.flags|=4194308),k=!1)}else{ee=v.stateNode,ct(g,v),Re=v.memoizedProps,hn=pd(E,Re),ee.props=hn,en=v.pendingProps,wn=ee.context,Yt=E.contextType,jt=Au,typeof Yt=="object"&&Yt!==null&&(jt=ue(Yt)),at=E.getDerivedStateFromProps,(Yt=typeof at=="function"||typeof ee.getSnapshotBeforeUpdate=="function")||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(Re!==en||wn!==jt)&&Dp(v,ee,k,jt),Rl=!1,wn=v.memoizedState,ee.state=wn,Hn(v,k,ee,q),En();var pr=v.memoizedState;Re!==en||wn!==pr||Rl||g!==null&&g.dependencies!==null&&Ue(g.dependencies)?(typeof at=="function"&&(hd(v,E,at,k),pr=v.memoizedState),(hn=Rl||kp(v,E,hn,k,wn,pr,jt)||g!==null&&g.dependencies!==null&&Ue(g.dependencies))?(Yt||typeof ee.UNSAFE_componentWillUpdate!="function"&&typeof ee.componentWillUpdate!="function"||(typeof ee.componentWillUpdate=="function"&&ee.componentWillUpdate(k,pr,jt),typeof ee.UNSAFE_componentWillUpdate=="function"&&ee.UNSAFE_componentWillUpdate(k,pr,jt)),typeof ee.componentDidUpdate=="function"&&(v.flags|=4),typeof ee.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ee.componentDidUpdate!="function"||Re===g.memoizedProps&&wn===g.memoizedState||(v.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Re===g.memoizedProps&&wn===g.memoizedState||(v.flags|=1024),v.memoizedProps=k,v.memoizedState=pr),ee.props=k,ee.state=pr,ee.context=jt,k=hn):(typeof ee.componentDidUpdate!="function"||Re===g.memoizedProps&&wn===g.memoizedState||(v.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Re===g.memoizedProps&&wn===g.memoizedState||(v.flags|=1024),k=!1)}return ee=k,tc(g,v),k=(v.flags&128)!==0,ee||k?(ee=v.stateNode,E=k&&typeof E.getDerivedStateFromError!="function"?null:ee.render(),v.flags|=1,g!==null&&k?(v.child=Jo(v,g.child,null,q),v.child=Jo(v,null,E,q)):Hs(g,v,E,q),v.memoizedState=ee.state,g=v.child):g=Xe(g,v,q),g}function ys(g,v,E,k){return Pe(),v.flags|=256,Hs(g,v,E,k),v.child}function Lp(g){return{baseLanes:g,cachePool:nt()}}function wh(g,v,E){return g=g!==null?g.childLanes&~E:0,v&&(g|=Fa),g}function vd(g,v,E){var k=v.pendingProps,q=!1,ee=(v.flags&128)!==0,Re;if((Re=ee)||(Re=g!==null&&g.memoizedState===null?!1:(Ls.current&2)!==0),Re&&(q=!0,v.flags&=-129),Re=(v.flags&32)!==0,v.flags&=-33,g===null){if(Gr){if(q?bt(v):Xt(),(g=cs)?(g=f3(g,La),g!==null&&(v.memoizedState={dehydrated:g,treeContext:dc!==null?{id:Zo,overflow:Uc}:null,retryLane:536870912,hydrationErrors:null},E=qy(g),E.return=v,v.child=E,_o=v,cs=null)):g=null,g===null)throw re(v);return rv(g)?v.lanes=32:v.lanes=536870912,null}var at=k.children;return k=k.fallback,q?(Xt(),q=v.mode,at=vu({mode:"hidden",children:at},q),k=oc(k,q,E,null),at.return=v,k.return=v,at.sibling=k,v.child=at,k=v.child,k.memoizedState=Lp(E),k.childLanes=wh(g,Re,E),v.memoizedState=Bh,gu(null,k)):(bt(v),jp(v,at))}var jt=g.memoizedState;if(jt!==null&&(at=jt.dehydrated,at!==null)){if(ee)v.flags&256?(bt(v),v.flags&=-257,v=jc(g,v,E)):v.memoizedState!==null?(Xt(),v.child=g.child,v.flags|=128,v=null):(Xt(),at=k.fallback,q=v.mode,k=vu({mode:"visible",children:k.children},q),at=oc(at,q,E,null),at.flags|=2,k.return=v,at.return=v,k.sibling=at,v.child=k,Jo(v,g.child,null,E),k=v.child,k.memoizedState=Lp(E),k.childLanes=wh(g,Re,E),v.memoizedState=Bh,v=gu(null,k));else if(bt(v),rv(at))Re=iv(at).digest,k=Error(i(419)),k.stack="",k.digest=Re,ke({value:k,source:null,stack:null}),v=jc(g,v,E);else if(es||Fe(g,v,E,!1),Re=(E&g.childLanes)!==0,es||Re){if(Re=Er,Re!==null&&(k=V(Re,E),k!==0&&k!==jt.retryLane))throw jt.retryLane=k,Qe(g,k),_s(Re,g,k),za;vf(at)||Hp(),v=jc(g,v,E)}else vf(at)?(v.flags|=192,v.child=g.child,v=null):(g=jt.treeContext,ls&&(cs=c3(at),_o=v,Gr=!0,ku=null,La=!1,g!==null&&ie(v,g)),v=jp(v,k.children),v.flags|=4096);return v}return q?(Xt(),at=k.fallback,q=v.mode,jt=g.child,ee=jt.sibling,k=El(jt,{mode:"hidden",children:k.children}),k.subtreeFlags=jt.subtreeFlags&65011712,ee!==null?at=El(ee,at):(at=oc(at,q,E,null),at.flags|=2),at.return=v,k.return=v,k.sibling=at,v.child=k,gu(null,k),k=v.child,at=g.child.memoizedState,at===null?at=Lp(E):(q=at.cachePool,q!==null?(jt=Gs?us._currentValue:us._currentValue2,q=q.parent!==jt?{parent:jt,pool:jt}:q):q=nt(),at={baseLanes:at.baseLanes|E,cachePool:q}),k.memoizedState=at,k.childLanes=wh(g,Re,E),v.memoizedState=Bh,gu(g.child,k)):(bt(v),E=g.child,g=E.sibling,E=El(E,{mode:"visible",children:k.children}),E.return=v,E.sibling=null,g!==null&&(Re=v.deletions,Re===null?(v.deletions=[g],v.flags|=16):Re.push(g)),v.child=E,v.memoizedState=null,E)}function jp(g,v){return v=vu({mode:"visible",children:v},g.mode),v.return=g,g.child=v}function vu(g,v){return g=n(22,g,null,v),g.lanes=0,g}function jc(g,v,E){return Jo(v,g.child,null,E),g=jp(v,v.pendingProps.children),g.flags|=2,v.memoizedState=null,g}function he(g,v,E){g.lanes|=v;var k=g.alternate;k!==null&&(k.lanes|=v),oe(g.return,v,E)}function Me(g,v,E,k,q,ee){var Re=g.memoizedState;Re===null?g.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:k,tail:E,tailMode:q,treeForkCount:ee}:(Re.isBackwards=v,Re.rendering=null,Re.renderingStartTime=0,Re.last=k,Re.tail=E,Re.tailMode=q,Re.treeForkCount=ee)}function Ge(g,v,E){var k=v.pendingProps,q=k.revealOrder,ee=k.tail;k=k.children;var Re=Ls.current,at=(Re&2)!==0;if(at?(Re=Re&1|2,v.flags|=128):Re&=1,b(Ls,Re),Hs(g,v,k,E),k=Gr?Qm:0,!at&&g!==null&&(g.flags&128)!==0)e:for(g=v.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&he(g,E,v);else if(g.tag===19)he(g,E,v);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===v)break e;for(;g.sibling===null;){if(g.return===null||g.return===v)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}switch(q){case"forwards":for(E=v.child,q=null;E!==null;)g=E.alternate,g!==null&&Kt(g)===null&&(q=E),E=E.sibling;E=q,E===null?(q=v.child,v.child=null):(q=E.sibling,E.sibling=null),Me(v,!1,q,E,ee,k);break;case"backwards":case"unstable_legacy-backwards":for(E=null,q=v.child,v.child=null;q!==null;){if(g=q.alternate,g!==null&&Kt(g)===null){v.child=q;break}g=q.sibling,q.sibling=E,E=q,q=g}Me(v,!0,E,null,ee,k);break;case"together":Me(v,!1,null,null,void 0,k);break;default:v.memoizedState=null}return v.child}function Xe(g,v,E){if(g!==null&&(v.dependencies=g.dependencies),Dd|=v.lanes,(E&v.childLanes)===0)if(g!==null){if(Fe(g,v,E,!1),(E&v.childLanes)===0)return null}else return null;if(g!==null&&v.child!==g.child)throw Error(i(153));if(v.child!==null){for(g=v.child,E=El(g,g.pendingProps),v.child=E,E.return=v;g.sibling!==null;)g=g.sibling,E=E.sibling=El(g,g.pendingProps),E.return=v;E.sibling=null}return v.child}function dt(g,v){return(g.lanes&v)!==0?!0:(g=g.dependencies,!!(g!==null&&Ue(g)))}function Mt(g,v,E){switch(v.tag){case 3:ce(v,v.stateNode.containerInfo),we(v,us,g.memoizedState.cache),Pe();break;case 27:case 5:se(v);break;case 4:ce(v,v.stateNode.containerInfo);break;case 10:we(v,v.type,v.memoizedProps.value);break;case 31:if(v.memoizedState!==null)return v.flags|=128,vt(v),null;break;case 13:var k=v.memoizedState;if(k!==null)return k.dehydrated!==null?(bt(v),v.flags|=128,null):(E&v.child.childLanes)!==0?vd(g,v,E):(bt(v),g=Xe(g,v,E),g!==null?g.sibling:null);bt(v);break;case 19:var q=(g.flags&128)!==0;if(k=(E&v.childLanes)!==0,k||(Fe(g,v,E,!1),k=(E&v.childLanes)!==0),q){if(k)return Ge(g,v,E);v.flags|=128}if(q=v.memoizedState,q!==null&&(q.rendering=null,q.tail=null,q.lastEffect=null),b(Ls,Ls.current),k)break;return null;case 22:return v.lanes=0,Dm(g,v,E,v.pendingProps);case 24:we(v,us,g.memoizedState.cache)}return Xe(g,v,E)}function Vt(g,v,E){if(g!==null)if(g.memoizedProps!==v.pendingProps)es=!0;else{if(!dt(g,E)&&(v.flags&128)===0)return es=!1,Mt(g,v,E);es=(g.flags&131072)!==0}else es=!1,Gr&&(v.flags&1048576)!==0&&B(v,Qm,v.index);switch(v.lanes=0,v.tag){case 16:e:{var k=v.pendingProps;if(g=et(v.elementType),v.type=g,typeof g=="function")Mh(g)?(k=pd(g,k),v.tag=1,v=xu(null,v,g,k,E)):(v.tag=0,v=xd(null,v,g,k,E));else{if(g!=null){var q=g.$$typeof;if(q===$p){v.tag=11,v=Nm(null,v,g,k,E);break e}else if(q===Zx){v.tag=14,v=Rm(null,v,g,k,E);break e}}throw v=p(g)||g,Error(i(306,v,""))}}return v;case 0:return xd(g,v,v.type,v.pendingProps,E);case 1:return k=v.type,q=pd(k,v.pendingProps),xu(g,v,k,q,E);case 3:e:{if(ce(v,v.stateNode.containerInfo),g===null)throw Error(i(387));var ee=v.pendingProps;q=v.memoizedState,k=q.element,ct(g,v),Hn(v,ee,null,E);var Re=v.memoizedState;if(ee=Re.cache,we(v,us,ee),ee!==q.cache&&_e(v,[us],E,!0),En(),ee=Re.element,ls&&q.isDehydrated)if(q={element:ee,isDehydrated:!1,cache:Re.cache},v.updateQueue.baseState=q,v.memoizedState=q,v.flags&256){v=ys(g,v,ee,E);break e}else if(ee!==k){k=ne(Error(i(424)),v),ke(k),v=ys(g,v,ee,E);break e}else for(ls&&(cs=a3(v.stateNode.containerInfo),_o=v,Gr=!0,ku=null,La=!0),E=Pb(v,null,ee,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Pe(),ee===k){v=Xe(g,v,E);break e}Hs(g,v,ee,E)}v=v.child}return v;case 26:if(cc)return tc(g,v),g===null?(E=Sb(v.type,null,v.pendingProps,null))?v.memoizedState=E:Gr||(v.stateNode=lv(v.type,v.pendingProps,Qo.current,v)):v.memoizedState=Sb(v.type,g.memoizedProps,v.pendingProps,g.memoizedState),null;case 27:if(bo)return se(v),g===null&&bo&&Gr&&(k=v.stateNode=cv(v.type,v.pendingProps,Qo.current,jo.current,!1),_o=v,La=!0,cs=gb(v.type,k,cs)),Hs(g,v,v.pendingProps.children,E),tc(g,v),g===null&&(v.flags|=4194304),v.child;case 5:return g===null&&Gr&&(_3(v.type,v.pendingProps,jo.current),(q=k=cs)&&(k=u3(k,v.type,v.pendingProps,La),k!==null?(v.stateNode=k,_o=v,cs=o3(k),La=!1,q=!0):q=!1),q||re(v)),se(v),q=v.type,ee=v.pendingProps,Re=g!==null?g.memoizedProps:null,k=ee.children,Oa(q,ee)?k=null:Re!==null&&Oa(q,Re)&&(v.flags|=32),v.memoizedState!==null&&(q=On(g,v,or,null,null,E),Gs?Ph._currentValue=q:Ph._currentValue2=q),tc(g,v),Hs(g,v,k,E),v.child;case 6:return g===null&&Gr&&(_b(v.pendingProps,jo.current),(g=E=cs)&&(E=d3(E,v.pendingProps,La),E!==null?(v.stateNode=E,_o=v,cs=null,g=!0):g=!1),g||re(v)),null;case 13:return vd(g,v,E);case 4:return ce(v,v.stateNode.containerInfo),k=v.pendingProps,g===null?v.child=Jo(v,null,k,E):Hs(g,v,k,E),v.child;case 11:return Nm(g,v,v.type,v.pendingProps,E);case 7:return Hs(g,v,v.pendingProps,E),v.child;case 8:return Hs(g,v,v.pendingProps.children,E),v.child;case 12:return Hs(g,v,v.pendingProps.children,E),v.child;case 10:return k=v.pendingProps,we(v,v.type,k.value),Hs(g,v,k.children,E),v.child;case 9:return q=v.type._context,k=v.pendingProps.children,Oe(v),q=ue(q),k=k(q),v.flags|=1,Hs(g,v,k,E),v.child;case 14:return Rm(g,v,v.type,v.pendingProps,E);case 15:return km(g,v,v.type,v.pendingProps,E);case 19:return Ge(g,v,E);case 31:return Pm(g,v,E);case 22:return Dm(g,v,E,v.pendingProps);case 24:return Oe(v),k=ue(us),g===null?(q=$e(),q===null&&(q=Er,ee=Se(),q.pooledCache=ee,ee.refCount++,ee!==null&&(q.pooledCacheLanes|=E),q=ee),v.memoizedState={parent:k,cache:q},Tt(v),we(v,us,q)):((g.lanes&E)!==0&&(ct(g,v),Hn(v,null,null,E),En()),q=g.memoizedState,ee=v.memoizedState,q.parent!==k?(q={parent:k,cache:k},v.memoizedState=q,v.lanes===0&&(v.memoizedState=v.updateQueue.baseState=q),we(v,us,k)):(k=ee.cache,we(v,us,k),k!==q.cache&&_e(v,[us],E,!0))),Hs(g,v,v.pendingProps.children,E),v.child;case 29:throw v.pendingProps}throw Error(i(156,v.tag))}function qt(g){g.flags|=4}function rn(g){Al&&(g.flags|=8)}function yn(g,v){if(g!==null&&g.child===v.child)return!1;if((v.flags&16)!==0)return!0;for(g=v.child;g!==null;){if((g.flags&8218)!==0||(g.subtreeFlags&8218)!==0)return!0;g=g.sibling}return!1}function _n(g,v,E,k){if(Yr)for(E=v.child;E!==null;){if(E.tag===5||E.tag===6)Gm(g,E.stateNode);else if(!(E.tag===4||bo&&E.tag===27)&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===v)break;for(;E.sibling===null;){if(E.return===null||E.return===v)return;E=E.return}E.sibling.return=E.return,E=E.sibling}else if(Al)for(var q=v.child;q!==null;){if(q.tag===5){var ee=q.stateNode;E&&k&&(ee=n3(ee,q.type,q.memoizedProps)),Gm(g,ee)}else if(q.tag===6)ee=q.stateNode,E&&k&&(ee=pb(ee,q.memoizedProps)),Gm(g,ee);else if(q.tag!==4){if(q.tag===22&&q.memoizedState!==null)ee=q.child,ee!==null&&(ee.return=q),_n(g,q,!0,!0);else if(q.child!==null){q.child.return=q,q=q.child;continue}}if(q===v)break;for(;q.sibling===null;){if(q.return===null||q.return===v)return;q=q.return}q.sibling.return=q.return,q=q.sibling}}function Cn(g,v,E,k){var q=!1;if(Al)for(var ee=v.child;ee!==null;){if(ee.tag===5){var Re=ee.stateNode;E&&k&&(Re=n3(Re,ee.type,ee.memoizedProps)),fb(g,Re)}else if(ee.tag===6)Re=ee.stateNode,E&&k&&(Re=pb(Re,ee.memoizedProps)),fb(g,Re);else if(ee.tag!==4){if(ee.tag===22&&ee.memoizedState!==null)q=ee.child,q!==null&&(q.return=ee),Cn(g,ee,!0,!0),q=!0;else if(ee.child!==null){ee.child.return=ee,ee=ee.child;continue}}if(ee===v)break;for(;ee.sibling===null;){if(ee.return===null||ee.return===v)return q;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}return q}function tr(g,v){if(Al&&yn(g,v)){g=v.stateNode;var E=g.containerInfo,k=db();Cn(k,v,!1,!1),g.pendingChildren=k,qt(v),t3(E,k)}}function Zr(g,v,E,k){if(Yr)g.memoizedProps!==k&&qt(v);else if(Al){var q=g.stateNode,ee=g.memoizedProps;if((g=yn(g,v))||ee!==k){var Re=jo.current;ee=e3(q,E,ee,k,!g,null),ee===q?v.stateNode=q:(rn(v),tl(ee,E,k,Re)&&qt(v),v.stateNode=ee,g&&_n(ee,v,!1,!1))}else v.stateNode=q}}function nr(g,v,E,k,q){if((g.mode&32)!==0&&(E===null?Wm(v,k):Zp(v,E,k))){if(g.flags|=16777216,(q&335544128)===q||eb(v,k))if(Ss(g.stateNode,v,k))g.flags|=8192;else if(Xr())g.flags|=8192;else throw ja=Du,bv}else g.flags&=-16777217}function hr(g,v){if(Cb(v)){if(g.flags|=16777216,!Eb(v))if(Xr())g.flags|=8192;else throw ja=Du,bv}else g.flags&=-16777217}function Bn(g,v){v!==null&&(g.flags|=4),g.flags&16384&&(v=g.tag!==22?N():536870912,g.lanes|=v,o0|=v)}function kn(g,v){if(!Gr)switch(g.tailMode){case"hidden":v=g.tail;for(var E=null;v!==null;)v.alternate!==null&&(E=v),v=v.sibling;E===null?g.tail=null:E.sibling=null;break;case"collapsed":E=g.tail;for(var k=null;E!==null;)E.alternate!==null&&(k=E),E=E.sibling;k===null?v||g.tail===null?g.tail=null:g.tail.sibling=null:k.sibling=null}}function $n(g){var v=g.alternate!==null&&g.alternate.child===g.child,E=0,k=0;if(v)for(var q=g.child;q!==null;)E|=q.lanes|q.childLanes,k|=q.subtreeFlags&65011712,k|=q.flags&65011712,q.return=g,q=q.sibling;else for(q=g.child;q!==null;)E|=q.lanes|q.childLanes,k|=q.subtreeFlags,k|=q.flags,q.return=g,q=q.sibling;return g.subtreeFlags|=k,g.childLanes=E,v}function Ji(g,v,E){var k=v.pendingProps;switch(j(v),v.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $n(v),null;case 1:return $n(v),null;case 3:return E=v.stateNode,k=null,g!==null&&(k=g.memoizedState.cache),v.memoizedState.cache!==k&&(v.flags|=2048),Te(us),te(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(g===null||g.child===null)&&(xe(v)?qt(v):g===null||g.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,me())),tr(g,v),$n(v),null;case 26:if(cc){var q=v.type,ee=v.memoizedState;return g===null?(qt(v),ee!==null?($n(v),hr(v,ee)):($n(v),nr(v,q,null,k,E))):ee?ee!==g.memoizedState?(qt(v),$n(v),hr(v,ee)):($n(v),v.flags&=-16777217):(ee=g.memoizedProps,Yr?ee!==k&&qt(v):Zr(g,v,q,k),$n(v),nr(v,q,ee,k,E)),null}case 27:if(bo){if(le(v),E=Qo.current,q=v.type,g!==null&&v.stateNode!=null)Yr?g.memoizedProps!==k&&qt(v):Zr(g,v,q,k);else{if(!k){if(v.stateNode===null)throw Error(i(166));return $n(v),null}g=jo.current,xe(v)?pe(v,g):(g=cv(q,k,E,g,!0),v.stateNode=g,qt(v))}return $n(v),null}case 5:if(le(v),q=v.type,g!==null&&v.stateNode!=null)Zr(g,v,q,k);else{if(!k){if(v.stateNode===null)throw Error(i(166));return $n(v),null}if(ee=jo.current,xe(v))pe(v,ee),v3(v.stateNode,q,k,ee)&&(v.flags|=64);else{var Re=Qy(q,k,Qo.current,ee,v);rn(v),_n(Re,v,!1,!1),v.stateNode=Re,tl(Re,q,k,ee)&&qt(v)}}return $n(v),nr(v,v.type,g===null?null:g.memoizedProps,v.pendingProps,E),null;case 6:if(g&&v.stateNode!=null)E=g.memoizedProps,Yr?E!==k&&qt(v):Al&&(E!==k?(g=Qo.current,E=jo.current,rn(v),v.stateNode=Cd(k,g,E,v)):v.stateNode=g.stateNode);else{if(typeof k!="string"&&v.stateNode===null)throw Error(i(166));if(g=Qo.current,E=jo.current,xe(v)){if(!ls)throw Error(i(176));if(g=v.stateNode,E=v.memoizedProps,k=null,q=_o,q!==null)switch(q.tag){case 27:case 5:k=q.memoizedProps}JC(g,E,v,k)||re(v,!0)}else rn(v),v.stateNode=Cd(k,g,E,v)}return $n(v),null;case 31:if(E=v.memoizedState,g===null||g.memoizedState!==null){if(k=xe(v),E!==null){if(g===null){if(!k)throw Error(i(318));if(!ls)throw Error(i(556));if(g=v.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(557));vb(g,v)}else Pe(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;$n(v),g=!1}else E=me(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=E),g=!0;if(!g)return v.flags&256?(Jt(v),v):(Jt(v),null);if((v.flags&128)!==0)throw Error(i(558))}return $n(v),null;case 13:if(k=v.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(q=xe(v),k!==null&&k.dehydrated!==null){if(g===null){if(!q)throw Error(i(318));if(!ls)throw Error(i(344));if(q=v.memoizedState,q=q!==null?q.dehydrated:null,!q)throw Error(i(317));p3(q,v)}else Pe(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;$n(v),q=!1}else q=me(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=q),q=!0;if(!q)return v.flags&256?(Jt(v),v):(Jt(v),null)}return Jt(v),(v.flags&128)!==0?(v.lanes=E,v):(E=k!==null,g=g!==null&&g.memoizedState!==null,E&&(k=v.child,q=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(q=k.alternate.memoizedState.cachePool.pool),ee=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(ee=k.memoizedState.cachePool.pool),ee!==q&&(k.flags|=2048)),E!==g&&E&&(v.child.flags|=8192),Bn(v,v.updateQueue),$n(v),null);case 4:return te(),tr(g,v),g===null&&Oi(v.stateNode.containerInfo),$n(v),null;case 10:return Te(v.type),$n(v),null;case 19:if(x(Ls),k=v.memoizedState,k===null)return $n(v),null;if(q=(v.flags&128)!==0,ee=k.rendering,ee===null)if(q)kn(k,!1);else{if(Ts!==0||g!==null&&(g.flags&128)!==0)for(g=v.child;g!==null;){if(ee=Kt(g),ee!==null){for(v.flags|=128,kn(k,!1),g=ee.updateQueue,v.updateQueue=g,Bn(v,g),v.subtreeFlags=0,g=E,E=v.child;E!==null;)$x(E,g),E=E.sibling;return b(Ls,Ls.current&1|2),Gr&&H(v,k.treeForkCount),v.child}g=g.sibling}k.tail!==null&&ya()>Nf&&(v.flags|=128,q=!0,kn(k,!1),v.lanes=4194304)}else{if(!q)if(g=Kt(ee),g!==null){if(v.flags|=128,q=!0,g=g.updateQueue,v.updateQueue=g,Bn(v,g),kn(k,!0),k.tail===null&&k.tailMode==="hidden"&&!ee.alternate&&!Gr)return $n(v),null}else 2*ya()-k.renderingStartTime>Nf&&E!==536870912&&(v.flags|=128,q=!0,kn(k,!1),v.lanes=4194304);k.isBackwards?(ee.sibling=v.child,v.child=ee):(g=k.last,g!==null?g.sibling=ee:v.child=ee,k.last=ee)}return k.tail!==null?(g=k.tail,k.rendering=g,k.tail=g.sibling,k.renderingStartTime=ya(),g.sibling=null,E=Ls.current,b(Ls,q?E&1|2:E&1),Gr&&H(v,k.treeForkCount),g):($n(v),null);case 22:case 23:return Jt(v),rt(),k=v.memoizedState!==null,g!==null?g.memoizedState!==null!==k&&(v.flags|=8192):k&&(v.flags|=8192),k?(E&536870912)!==0&&(v.flags&128)===0&&($n(v),v.subtreeFlags&6&&(v.flags|=8192)):$n(v),E=v.updateQueue,E!==null&&Bn(v,E.retryQueue),E=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),k=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(k=v.memoizedState.cachePool.pool),k!==E&&(v.flags|=2048),g!==null&&x(_f),null;case 24:return E=null,g!==null&&(E=g.memoizedState.cache),v.memoizedState.cache!==E&&(v.flags|=2048),Te(us),$n(v),null;case 25:return null;case 30:return null}throw Error(i(156,v.tag))}function Ps(g,v){switch(j(v),v.tag){case 1:return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 3:return Te(us),te(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 26:case 27:case 5:return le(v),null;case 31:if(v.memoizedState!==null){if(Jt(v),v.alternate===null)throw Error(i(340));Pe()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 13:if(Jt(v),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(i(340));Pe()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return x(Ls),null;case 4:return te(),null;case 10:return Te(v.type),null;case 22:case 23:return Jt(v),rt(),g!==null&&x(_f),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 24:return Te(us),null;case 25:return null;default:return null}}function xi(g,v){switch(j(v),v.tag){case 3:Te(us),te();break;case 26:case 27:case 5:le(v);break;case 4:te();break;case 31:v.memoizedState!==null&&Jt(v);break;case 13:Jt(v);break;case 19:x(Ls);break;case 10:Te(v.type);break;case 22:case 23:Jt(v),rt(),g!==null&&x(_f);break;case 24:Te(us)}}function li(g,v){try{var E=v.updateQueue,k=E!==null?E.lastEffect:null;if(k!==null){var q=k.next;E=q;do{if((E.tag&g)===g){k=void 0;var ee=E.create,Re=E.inst;k=ee(),Re.destroy=k}E=E.next}while(E!==q)}}catch(at){rr(v,v.return,at)}}function os(g,v,E){try{var k=v.updateQueue,q=k!==null?k.lastEffect:null;if(q!==null){var ee=q.next;k=ee;do{if((k.tag&g)===g){var Re=k.inst,at=Re.destroy;if(at!==void 0){Re.destroy=void 0,q=v;var jt=E,Yt=at;try{Yt()}catch(hn){rr(q,jt,hn)}}}k=k.next}while(k!==ee)}}catch(hn){rr(v,v.return,hn)}}function Is(g){var v=g.updateQueue;if(v!==null){var E=g.stateNode;try{Br(v,E)}catch(k){rr(g,g.return,k)}}}function Ko(g,v,E){E.props=pd(g.type,g.memoizedProps),E.state=g.memoizedState;try{E.componentWillUnmount()}catch(k){rr(g,v,k)}}function ko(g,v){try{var E=g.ref;if(E!==null){switch(g.tag){case 26:case 27:case 5:var k=Xp(g.stateNode);break;case 30:k=g.stateNode;break;default:k=g.stateNode}typeof E=="function"?g.refCleanup=E(k):E.current=k}}catch(q){rr(g,v,q)}}function Gi(g,v){var E=g.ref,k=g.refCleanup;if(E!==null)if(typeof k=="function")try{k()}catch(q){rr(g,v,q)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof E=="function")try{E(null)}catch(q){rr(g,v,q)}else E.current=null}function Vs(g){var v=g.type,E=g.memoizedProps,k=g.stateNode;try{$w(k,v,E,g)}catch(q){rr(g,g.return,q)}}function Do(g,v,E){try{qw(g.stateNode,g.type,E,v,g)}catch(k){rr(g,g.return,k)}}function Da(g){return g.tag===5||g.tag===3||(cc?g.tag===26:!1)||(bo?g.tag===27&&Ih(g.type):!1)||g.tag===4}function so(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||Da(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(bo&&g.tag===27&&Ih(g.type)||g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function oo(g,v,E){var k=g.tag;if(k===5||k===6)g=g.stateNode,v?Yw(E,g,v):ab(E,g);else if(k!==4&&(bo&&k===27&&Ih(g.type)&&(E=g.stateNode,v=null),g=g.child,g!==null))for(oo(g,v,E),g=g.sibling;g!==null;)oo(g,v,E),g=g.sibling}function vo(g,v,E){var k=g.tag;if(k===5||k===6)g=g.stateNode,v?Xw(E,g,v):ob(E,g);else if(k!==4&&(bo&&k===27&&Ih(g.type)&&(E=g.stateNode),g=g.child,g!==null))for(vo(g,v,E),g=g.sibling;g!==null;)vo(g,v,E),g=g.sibling}function zc(g,v,E){g=g.containerInfo;try{hb(g,E)}catch(k){rr(v,v.return,k)}}function Po(g){var v=g.stateNode,E=g.memoizedProps;try{lo(g.type,E,v,g)}catch(k){rr(g,g.return,k)}}function Lx(g,v){for(Qx(g.containerInfo),qs=v;qs!==null;)if(g=qs,v=g.child,(g.subtreeFlags&1028)!==0&&v!==null)v.return=g,qs=v;else for(;qs!==null;){g=qs;var E=g.alternate;switch(v=g.flags,g.tag){case 0:if((v&4)!==0&&(v=g.updateQueue,v=v!==null?v.events:null,v!==null))for(var k=0;k<v.length;k++){var q=v[k];q.ref.impl=q.nextImpl}break;case 11:case 15:break;case 1:if((v&1024)!==0&&E!==null){v=void 0,k=g,q=E.memoizedProps,E=E.memoizedState;var ee=k.stateNode;try{var Re=pd(k.type,q);v=ee.getSnapshotBeforeUpdate(Re,E),ee.__reactInternalSnapshotBeforeUpdate=v}catch(at){rr(k,k.return,at)}}break;case 3:(v&1024)!==0&&Yr&&ub(g.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((v&1024)!==0)throw Error(i(163))}if(v=g.sibling,v!==null){v.return=g.return,qs=v;break}qs=g.return}}function Iw(g,v,E){var k=E.flags;switch(E.tag){case 0:case 11:case 15:Pa(g,E),k&4&&li(5,E);break;case 1:if(Pa(g,E),k&4)if(g=E.stateNode,v===null)try{g.componentDidMount()}catch(Re){rr(E,E.return,Re)}else{var q=pd(E.type,v.memoizedProps);v=v.memoizedState;try{g.componentDidUpdate(q,v,g.__reactInternalSnapshotBeforeUpdate)}catch(Re){rr(E,E.return,Re)}}k&64&&Is(E),k&512&&ko(E,E.return);break;case 3:if(Pa(g,E),k&64&&(k=E.updateQueue,k!==null)){if(g=null,E.child!==null)switch(E.child.tag){case 27:case 5:g=Xp(E.child.stateNode);break;case 1:g=E.child.stateNode}try{Br(k,g)}catch(Re){rr(E,E.return,Re)}}break;case 27:bo&&v===null&&k&4&&Po(E);case 26:case 5:if(Pa(g,E),v===null){if(k&4)Vs(E);else if(k&64){g=E.type,v=E.memoizedProps,q=E.stateNode;try{g3(q,g,v,E)}catch(Re){rr(E,E.return,Re)}}}k&512&&ko(E,E.return);break;case 12:Pa(g,E);break;case 31:Pa(g,E),k&4&&rc(g,E);break;case 13:Pa(g,E),k&4&&Om(g,E),k&64&&(k=E.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(E=KC.bind(null,E),sv(k,E))));break;case 22:if(k=E.memoizedState!==null||js,!k){v=v!==null&&v.memoizedState!==null||zs,q=js;var ee=zs;js=k,(zs=v)&&!ee?sc(g,E,(E.subtreeFlags&8772)!==0):Pa(g,E),js=q,zs=ee}break;case 30:break;default:Pa(g,E)}}function Vy(g){var v=g.alternate;v!==null&&(g.alternate=null,Vy(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&Jx(v)),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function nc(g,v,E){for(E=E.child;E!==null;)Im(g,v,E),E=E.sibling}function Im(g,v,E){if(il&&typeof il.onCommitFiberUnmount=="function")try{il.onCommitFiberUnmount(jh,E)}catch{}switch(E.tag){case 26:if(cc){zs||Gi(E,v),nc(g,v,E),E.memoizedState?yf(E.memoizedState):E.stateNode&&Tb(E.stateNode);break}case 27:if(bo){zs||Gi(E,v);var k=Ms,q=Xs;Ih(E.type)&&(Ms=E.stateNode,Xs=!1),nc(g,v,E),Lo(E.stateNode),Ms=k,Xs=q;break}case 5:zs||Gi(E,v);case 6:if(Yr){if(k=Ms,q=Xs,Ms=null,nc(g,v,E),Ms=k,Xs=q,Ms!==null)if(Xs)try{lb(Ms,E.stateNode)}catch(ee){rr(E,v,ee)}else try{Kw(Ms,E.stateNode)}catch(ee){rr(E,v,ee)}}else nc(g,v,E);break;case 18:Yr&&Ms!==null&&(Xs?ov(Ms,E.stateNode):bb(Ms,E.stateNode));break;case 4:Yr?(k=Ms,q=Xs,Ms=E.stateNode.containerInfo,Xs=!0,nc(g,v,E),Ms=k,Xs=q):(Al&&zc(E.stateNode,E,db()),nc(g,v,E));break;case 0:case 11:case 14:case 15:os(2,E,v),zs||os(4,E,v),nc(g,v,E);break;case 1:zs||(Gi(E,v),k=E.stateNode,typeof k.componentWillUnmount=="function"&&Ko(E,v,k)),nc(g,v,E);break;case 21:nc(g,v,E);break;case 22:zs=(k=zs)||E.memoizedState!==null,nc(g,v,E),zs=k;break;default:nc(g,v,E)}}function rc(g,v){if(ls&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null))){g=g.dehydrated;try{eE(g)}catch(E){rr(v,v.return,E)}}}function Om(g,v){if(ls&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null&&(g=g.dehydrated,g!==null))))try{tE(g)}catch(E){rr(v,v.return,E)}}function ic(g){switch(g.tag){case 31:case 13:case 19:var v=g.stateNode;return v===null&&(v=g.stateNode=new Ob),v;case 22:return g=g.stateNode,v=g._retryCache,v===null&&(v=g._retryCache=new Ob),v;default:throw Error(i(435,g.tag))}}function yd(g,v){var E=ic(g);v.forEach(function(k){if(!E.has(k)){E.add(k);var q=ZC.bind(null,g,k);k.then(q,q)}})}function Io(g,v){var E=v.deletions;if(E!==null)for(var k=0;k<E.length;k++){var q=E[k],ee=g,Re=v;if(Yr){var at=Re;e:for(;at!==null;){switch(at.tag){case 27:if(bo){if(Ih(at.type)){Ms=at.stateNode,Xs=!1;break e}break}case 5:Ms=at.stateNode,Xs=!1;break e;case 3:case 4:Ms=at.stateNode.containerInfo,Xs=!0;break e}at=at.return}if(Ms===null)throw Error(i(160));Im(ee,Re,q),Ms=null,Xs=!1}else Im(ee,Re,q);ee=q.alternate,ee!==null&&(ee.return=null),q.return=null}if(v.subtreeFlags&13886)for(v=v.child;v!==null;)Lm(v,g),v=v.sibling}function Lm(g,v){var E=g.alternate,k=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:Io(v,g),Oo(g),k&4&&(os(3,g,g.return),li(3,g),os(5,g,g.return));break;case 1:Io(v,g),Oo(g),k&512&&(zs||E===null||Gi(E,E.return)),k&64&&js&&(g=g.updateQueue,g!==null&&(k=g.callbacks,k!==null&&(E=g.shared.hiddenCallbacks,g.shared.hiddenCallbacks=E===null?k:E.concat(k))));break;case 26:if(cc){var q=Ai;if(Io(v,g),Oo(g),k&512&&(zs||E===null||Gi(E,E.return)),k&4){k=E!==null?E.memoizedState:null;var ee=g.memoizedState;E===null?ee===null?g.stateNode===null?g.stateNode=S3(q,g.type,g.memoizedProps,g):Mb(q,g.type,g.stateNode):g.stateNode=wb(q,ee,g.memoizedProps):k!==ee?(k===null?E.stateNode!==null&&Tb(E.stateNode):yf(k),ee===null?Mb(q,g.type,g.stateNode):wb(q,ee,g.memoizedProps)):ee===null&&g.stateNode!==null&&Do(g,g.memoizedProps,E.memoizedProps)}break}case 27:if(bo){Io(v,g),Oo(g),k&512&&(zs||E===null||Gi(E,E.return)),E!==null&&k&4&&Do(g,g.memoizedProps,E.memoizedProps);break}case 5:if(Io(v,g),Oo(g),k&512&&(zs||E===null||Gi(E,E.return)),Yr){if(g.flags&32){q=g.stateNode;try{cb(q)}catch(en){rr(g,g.return,en)}}k&4&&g.stateNode!=null&&(q=g.memoizedProps,Do(g,q,E!==null?E.memoizedProps:q)),k&1024&&(t0=!0)}else Al&&g.alternate!==null&&(g.alternate.stateNode=g.stateNode);break;case 6:if(Io(v,g),Oo(g),k&4&&Yr){if(g.stateNode===null)throw Error(i(162));k=g.memoizedProps,E=E!==null?E.memoizedProps:k,q=g.stateNode;try{Ww(q,E,k)}catch(en){rr(g,g.return,en)}}break;case 3:if(cc?(w3(),q=Ai,Ai=Xm(v.containerInfo),Io(v,g),Ai=q):Io(v,g),Oo(g),k&4){if(Yr&&ls&&E!==null&&E.memoizedState.isDehydrated)try{x3(v.containerInfo)}catch(en){rr(g,g.return,en)}if(Al){k=v.containerInfo,E=v.pendingChildren;try{hb(k,E)}catch(en){rr(g,g.return,en)}}}t0&&(t0=!1,jx(g));break;case 4:cc?(E=Ai,Ai=Xm(g.stateNode.containerInfo),Io(v,g),Oo(g),Ai=E):(Io(v,g),Oo(g)),k&4&&Al&&zc(g.stateNode,g,g.stateNode.pendingChildren);break;case 12:Io(v,g),Oo(g);break;case 31:Io(v,g),Oo(g),k&4&&(k=g.updateQueue,k!==null&&(g.updateQueue=null,yd(g,k)));break;case 13:Io(v,g),Oo(g),g.child.flags&8192&&g.memoizedState!==null!=(E!==null&&E.memoizedState!==null)&&(ig=ya()),k&4&&(k=g.updateQueue,k!==null&&(g.updateQueue=null,yd(g,k)));break;case 22:q=g.memoizedState!==null;var Re=E!==null&&E.memoizedState!==null,at=js,jt=zs;if(js=at||q,zs=jt||Re,Io(v,g),zs=jt,js=at,Oo(g),k&8192&&(v=g.stateNode,v._visibility=q?v._visibility&-2:v._visibility|1,q&&(E===null||Re||js||zs||of(g)),Yr)){e:if(E=null,Yr)for(v=g;;){if(v.tag===5||cc&&v.tag===26){if(E===null){Re=E=v;try{ee=Re.stateNode,q?QC(ee):Qw(Re.stateNode,Re.memoizedProps)}catch(en){rr(Re,Re.return,en)}}}else if(v.tag===6){if(E===null){Re=v;try{var Yt=Re.stateNode;q?Zw(Yt):Jw(Yt,Re.memoizedProps)}catch(en){rr(Re,Re.return,en)}}}else if(v.tag===18){if(E===null){Re=v;try{var hn=Re.stateNode;q?y3(hn):b3(Re.stateNode)}catch(en){rr(Re,Re.return,en)}}}else if((v.tag!==22&&v.tag!==23||v.memoizedState===null||v===g)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===g)break e;for(;v.sibling===null;){if(v.return===null||v.return===g)break e;E===v&&(E=null),v=v.return}E===v&&(E=null),v.sibling.return=v.return,v=v.sibling}}k&4&&(k=g.updateQueue,k!==null&&(E=k.retryQueue,E!==null&&(k.retryQueue=null,yd(g,E))));break;case 19:Io(v,g),Oo(g),k&4&&(k=g.updateQueue,k!==null&&(g.updateQueue=null,yd(g,k)));break;case 30:break;case 21:break;default:Io(v,g),Oo(g)}}function Oo(g){var v=g.flags;if(v&2){try{for(var E,k=g.return;k!==null;){if(Da(k)){E=k;break}k=k.return}if(Yr){if(E==null)throw Error(i(160));switch(E.tag){case 27:if(bo){var q=E.stateNode,ee=so(g);vo(g,ee,q);break}case 5:var Re=E.stateNode;E.flags&32&&(cb(Re),E.flags&=-33);var at=so(g);vo(g,at,Re);break;case 3:case 4:var jt=E.stateNode.containerInfo,Yt=so(g);oo(g,Yt,jt);break;default:throw Error(i(161))}}}catch(hn){rr(g,g.return,hn)}g.flags&=-3}v&4096&&(g.flags&=-4097)}function jx(g){if(g.subtreeFlags&1024)for(g=g.child;g!==null;){var v=g;jx(v),v.tag===5&&v.flags&1024&&nb(v.stateNode),g=g.sibling}}function Pa(g,v){if(v.subtreeFlags&8772)for(v=v.child;v!==null;)Iw(g,v.alternate,v),v=v.sibling}function of(g){for(g=g.child;g!==null;){var v=g;switch(v.tag){case 0:case 11:case 14:case 15:os(4,v,v.return),of(v);break;case 1:Gi(v,v.return);var E=v.stateNode;typeof E.componentWillUnmount=="function"&&Ko(v,v.return,E),of(v);break;case 27:bo&&Lo(v.stateNode);case 26:case 5:Gi(v,v.return),of(v);break;case 22:v.memoizedState===null&&of(v);break;case 30:of(v);break;default:of(v)}g=g.sibling}}function sc(g,v,E){for(E=E&&(v.subtreeFlags&8772)!==0,v=v.child;v!==null;){var k=v.alternate,q=g,ee=v,Re=ee.flags;switch(ee.tag){case 0:case 11:case 15:sc(q,ee,E),li(4,ee);break;case 1:if(sc(q,ee,E),k=ee,q=k.stateNode,typeof q.componentDidMount=="function")try{q.componentDidMount()}catch(Yt){rr(k,k.return,Yt)}if(k=ee,q=k.updateQueue,q!==null){var at=k.stateNode;try{var jt=q.shared.hiddenCallbacks;if(jt!==null)for(q.shared.hiddenCallbacks=null,q=0;q<jt.length;q++)Nn(jt[q],at)}catch(Yt){rr(k,k.return,Yt)}}E&&Re&64&&Is(ee),ko(ee,ee.return);break;case 27:bo&&Po(ee);case 26:case 5:sc(q,ee,E),E&&k===null&&Re&4&&Vs(ee),ko(ee,ee.return);break;case 12:sc(q,ee,E);break;case 31:sc(q,ee,E),E&&Re&4&&rc(q,ee);break;case 13:sc(q,ee,E),E&&Re&4&&Om(q,ee);break;case 22:ee.memoizedState===null&&sc(q,ee,E),ko(ee,ee.return);break;case 30:break;default:sc(q,ee,E)}v=v.sibling}}function af(g,v){var E=null;g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),g=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(g=v.memoizedState.cachePool.pool),g!==E&&(g!=null&&g.refCount++,E!=null&&Ae(E))}function Gy(g,v){g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Ae(g))}function bs(g,v,E,k){if(v.subtreeFlags&10256)for(v=v.child;v!==null;)zx(g,v,E,k),v=v.sibling}function zx(g,v,E,k){var q=v.flags;switch(v.tag){case 0:case 11:case 15:bs(g,v,E,k),q&2048&&li(9,v);break;case 1:bs(g,v,E,k);break;case 3:bs(g,v,E,k),q&2048&&(g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Ae(g)));break;case 12:if(q&2048){bs(g,v,E,k),g=v.stateNode;try{var ee=v.memoizedProps,Re=ee.id,at=ee.onPostCommit;typeof at=="function"&&at(Re,v.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(jt){rr(v,v.return,jt)}}else bs(g,v,E,k);break;case 31:bs(g,v,E,k);break;case 13:bs(g,v,E,k);break;case 23:break;case 22:ee=v.stateNode,Re=v.alternate,v.memoizedState!==null?ee._visibility&2?bs(g,v,E,k):zp(g,v):ee._visibility&2?bs(g,v,E,k):(ee._visibility|=2,Qa(g,v,E,k,(v.subtreeFlags&10256)!==0||!1)),q&2048&&af(Re,v);break;case 24:bs(g,v,E,k),q&2048&&Gy(v.alternate,v);break;default:bs(g,v,E,k)}}function Qa(g,v,E,k,q){for(q=q&&((v.subtreeFlags&10256)!==0||!1),v=v.child;v!==null;){var ee=g,Re=v,at=E,jt=k,Yt=Re.flags;switch(Re.tag){case 0:case 11:case 15:Qa(ee,Re,at,jt,q),li(8,Re);break;case 23:break;case 22:var hn=Re.stateNode;Re.memoizedState!==null?hn._visibility&2?Qa(ee,Re,at,jt,q):zp(ee,Re):(hn._visibility|=2,Qa(ee,Re,at,jt,q)),q&&Yt&2048&&af(Re.alternate,Re);break;case 24:Qa(ee,Re,at,jt,q),q&&Yt&2048&&Gy(Re.alternate,Re);break;default:Qa(ee,Re,at,jt,q)}v=v.sibling}}function zp(g,v){if(v.subtreeFlags&10256)for(v=v.child;v!==null;){var E=g,k=v,q=k.flags;switch(k.tag){case 22:zp(E,k),q&2048&&af(k.alternate,k);break;case 24:zp(E,k),q&2048&&Gy(k.alternate,k);break;default:zp(E,k)}v=v.sibling}}function yu(g,v,E){if(g.subtreeFlags&Dl)for(g=g.child;g!==null;)lf(g,v,E),g=g.sibling}function lf(g,v,E){switch(g.tag){case 26:if(yu(g,v,E),g.flags&Dl)if(g.memoizedState!==null)M3(E,Ai,g.memoizedState,g.memoizedProps);else{var k=g.stateNode,q=g.type;g=g.memoizedProps,((v&335544128)===v||eb(q,g))&&ev(E,k,q,g)}break;case 5:yu(g,v,E),g.flags&Dl&&(k=g.stateNode,q=g.type,g=g.memoizedProps,((v&335544128)===v||eb(q,g))&&ev(E,k,q,g));break;case 3:case 4:cc?(k=Ai,Ai=Xm(g.stateNode.containerInfo),yu(g,v,E),Ai=k):yu(g,v,E);break;case 22:g.memoizedState===null&&(k=g.alternate,k!==null&&k.memoizedState!==null?(k=Dl,Dl=16777216,yu(g,v,E),Dl=k):yu(g,v,E));break;default:yu(g,v,E)}}function Fx(g){var v=g.alternate;if(v!==null&&(g=v.child,g!==null)){v.child=null;do v=g.sibling,g.sibling=null,g=v;while(g!==null)}}function Fp(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var k=v[E];qs=k,Tl(k,g)}Fx(g)}if(g.subtreeFlags&10256)for(g=g.child;g!==null;)Ux(g),g=g.sibling}function Ux(g){switch(g.tag){case 0:case 11:case 15:Fp(g),g.flags&2048&&os(9,g,g.return);break;case 3:Fp(g);break;case 12:Fp(g);break;case 22:var v=g.stateNode;g.memoizedState!==null&&v._visibility&2&&(g.return===null||g.return.tag!==13)?(v._visibility&=-3,jm(g)):Fp(g);break;default:Fp(g)}}function jm(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var k=v[E];qs=k,Tl(k,g)}Fx(g)}for(g=g.child;g!==null;){switch(v=g,v.tag){case 0:case 11:case 15:os(8,v,v.return),jm(v);break;case 22:E=v.stateNode,E._visibility&2&&(E._visibility&=-3,jm(v));break;default:jm(v)}g=g.sibling}}function Tl(g,v){for(;qs!==null;){var E=qs;switch(E.tag){case 0:case 11:case 15:os(8,E,v);break;case 23:case 22:if(E.memoizedState!==null&&E.memoizedState.cachePool!==null){var k=E.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:Ae(E.memoizedState.cache)}if(k=E.child,k!==null)k.return=E,qs=k;else e:for(E=g;qs!==null;){k=qs;var q=k.sibling,ee=k.return;if(Vy(k),k===E){qs=null;break e}if(q!==null){q.return=ee,qs=q;break e}qs=ee}}}function cf(g){var v=yr(g);if(v!=null){if(typeof v.memoizedProps["data-testname"]!="string")throw Error(i(364));return v}if(g=Ws(g),g===null)throw Error(i(362));return g.stateNode.current}function uf(g,v){var E=g.tag;switch(v.$$typeof){case xc:if(g.type===v.value)return!0;break;case r0:e:{for(v=v.value,g=[g,0],E=0;E<g.length;){var k=g[E++],q=k.tag,ee=g[E++],Re=v[ee];if(q!==5&&q!==26&&q!==27||!xf(k)){for(;Re!=null&&uf(k,Re);)ee++,Re=v[ee];if(ee===v.length){v=!0;break e}else for(k=k.child;k!==null;)g.push(k,ee),k=k.sibling}}v=!1}return v;case i0:if((E===5||E===26||E===27)&&sb(g.stateNode,v.value))return!0;break;case Tf:if((E===5||E===6||E===26||E===27)&&(g=$m(g),g!==null&&0<=g.indexOf(v.value)))return!0;break;case ng:if((E===5||E===26||E===27)&&(g=g.memoizedProps["data-testname"],typeof g=="string"&&g.toLowerCase()===v.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Up(g){switch(g.$$typeof){case xc:return"<"+(p(g.value)||"Unknown")+">";case r0:return":has("+(Up(g)||"")+")";case i0:return'[role="'+g.value+'"]';case Tf:return'"'+g.value+'"';case ng:return'[data-testname="'+g.value+'"]';default:throw Error(i(365))}}function Bp(g,v){var E=[];g=[g,0];for(var k=0;k<g.length;){var q=g[k++],ee=q.tag,Re=g[k++],at=v[Re];if(ee!==5&&ee!==26&&ee!==27||!xf(q)){for(;at!=null&&uf(q,at);)Re++,at=v[Re];if(Re===v.length)E.push(q);else for(q=q.child;q!==null;)g.push(q,Re),q=q.sibling}}return E}function Ja(g,v){if(!yo)throw Error(i(363));g=cf(g),g=Bp(g,v),v=[],g=Array.from(g);for(var E=0;E<g.length;){var k=g[E++],q=k.tag;if(q===5||q===26||q===27)xf(k)||v.push(k.stateNode);else for(k=k.child;k!==null;)g.push(k),k=k.sibling}return v}function as(){return(jr&2)!==0&&Wr!==0?Wr&-Wr:Vn.T!==null?Ve():Kp()}function bd(){if(Fa===0)if((Wr&536870912)===0||Gr){var g=Lh;Lh<<=1,(Lh&3932160)===0&&(Lh=262144),Fa=g}else Fa=536870912;return g=sl.current,g!==null&&(g.flags|=32),Fa}function _s(g,v,E){(g===Er&&(Ni===2||Ni===9)||g.cancelPendingCommit!==null)&&(Os(g,0),_u(g,Wr,Fa,!1)),P(g,E),((jr&2)===0||g!==Er)&&(g===Er&&((jr&2)===0&&(Af|=E),Ts===4&&_u(g,Wr,Fa,!1)),qe(g))}function Fc(g,v,E){if((jr&6)!==0)throw Error(i(327));var k=!E&&(v&127)===0&&(v&g.expiredLanes)===0||C(g,v),q=k?jw(g,v):Su(g,v,!0),ee=k;do{if(q===0){Cf&&!k&&_u(g,v,0,!1);break}else{if(E=g.current.alternate,ee&&!Ow(E)){q=Su(g,v,!1),ee=!1;continue}if(q===2){if(ee=v,g.errorRecoveryDisabledLanes&ee)var Re=0;else Re=g.pendingLanes&-536870913,Re=Re!==0?Re:Re&536870912?536870912:0;if(Re!==0){v=Re;e:{var at=g;q=rg;var jt=ls&&at.current.memoizedState.isDehydrated;if(jt&&(Os(at,Re).flags|=256),Re=Su(at,Re,!1),Re!==2){if(Ef&&!jt){at.errorRecoveryDisabledLanes|=ee,Af|=ee,q=4;break e}ee=al,al=q,ee!==null&&(al===null?al=ee:al.push.apply(al,ee))}q=Re}if(ee=!1,q!==2)continue}}if(q===1){Os(g,0),_u(g,v,0,!0);break}e:{switch(k=g,ee=q,ee){case 0:case 1:throw Error(i(345));case 4:if((v&4194048)!==v)break;case 6:_u(k,v,Fa,!Vc);break e;case 2:al=null;break;case 3:case 5:break;default:throw Error(i(329))}if((v&62914560)===v&&(q=ig+300-ya(),10<q)){if(_u(k,v,Fa,!Vc),w(k,0,!0)!==0)break e;Lu=v,k.timeoutHandle=Jy(bu.bind(null,k,E,al,sg,Sv,v,Fa,Af,o0,Vc,ee,"Throttled",-0,0),q);break e}bu(k,E,al,sg,Sv,v,Fa,Af,o0,Vc,ee,null,-0,0)}}break}while(!0);qe(g)}function bu(g,v,E,k,q,ee,Re,at,jt,Yt,hn,en,wn,pr){if(g.timeoutHandle=nl,en=v.subtreeFlags,en&8192||(en&16785408)===16785408){en=tb(),lf(v,ee,en);var Ys=(ee&62914560)===ee?ig-ya():(ee&4194048)===ee?Vh-ya():0;if(Ys=Gw(en,Ys),Ys!==null){Lu=ee,g.cancelPendingCommit=Ys(Mu.bind(null,g,v,ee,E,k,q,Re,at,jt,hn,en,null,wn,pr)),_u(g,ee,Re,!Yt);return}}Mu(g,v,ee,E,k,q,Re,at,jt)}function Ow(g){for(var v=g;;){var E=v.tag;if((E===0||E===11||E===15)&&v.flags&16384&&(E=v.updateQueue,E!==null&&(E=E.stores,E!==null)))for(var k=0;k<E.length;k++){var q=E[k],ee=q.getSnapshot;q=q.value;try{if(!$s(ee(),q))return!1}catch{return!1}}if(E=v.child,v.subtreeFlags&16384&&E!==null)E.return=v,v=E;else{if(v===g)break;for(;v.sibling===null;){if(v.return===null||v.return===g)return!0;v=v.return}v.sibling.return=v.return,v=v.sibling}}return!0}function _u(g,v,E,k){v&=~s0,v&=~Af,g.suspendedLanes|=v,g.pingedLanes&=~v,k&&(g.warmLanes|=v),k=g.expirationTimes;for(var q=v;0<q;){var ee=31-rl(q),Re=1<<ee;k[ee]=-1,q&=~Re}E!==0&&R(g,E,v)}function Bx(){return(jr&6)===0?(Ee(0),!1):!0}function Hx(){if(zr!==null){if(Ni===0)var g=zr.return;else g=zr,Bc=Yi=null,fr(g),Sf=null,zh=0,g=zr;for(;g!==null;)xi(g.alternate,g),g=g.return;zr=null}}function Os(g,v){var E=g.timeoutHandle;E!==nl&&(g.timeoutHandle=nl,Vw(E)),E=g.cancelPendingCommit,E!==null&&(g.cancelPendingCommit=null,E()),Lu=0,Hx(),Er=g,zr=E=El(g.current,null),Wr=v,Ni=0,co=null,Vc=!1,Cf=C(g,v),Ef=!1,o0=Fa=s0=Af=Dd=Ts=0,al=rg=null,Sv=!1,(v&8)!==0&&(v|=v&32);var k=g.entangledLanes;if(k!==0)for(g=g.entanglements,k&=v;0<k;){var q=31-rl(k),ee=1<<q;v|=g[q],k&=~ee}return Ou=v,Dt(),E}function Xi(g,v){br=null,Vn.H=kl,v===wo||v===mc?(v=pt(),Ni=3):v===bv?(v=pt(),Ni=4):Ni=v===za?8:v!==null&&typeof v=="object"&&typeof v.then=="function"?6:1,co=v,zr===null&&(Ts=1,Jl(g,ne(v,g.current)))}function Xr(){var g=sl.current;return g===null?!0:(Wr&4194048)===Wr?ol===null:(Wr&62914560)===Wr||(Wr&536870912)!==0?g===ol:!1}function _d(){var g=Vn.H;return Vn.H=kl,g===null?kl:g}function Cl(){var g=Vn.A;return Vn.A=n0,g}function Hp(){Ts=4,Vc||(Wr&4194048)!==Wr&&sl.current!==null||(Cf=!0),(Dd&134217727)===0&&(Af&134217727)===0||Er===null||_u(Er,Wr,Fa,!1)}function Su(g,v,E){var k=jr;jr|=2;var q=_d(),ee=Cl();(Er!==g||Wr!==v)&&(sg=null,Os(g,v)),v=!1;var Re=Ts;e:do try{if(Ni!==0&&zr!==null){var at=zr,jt=co;switch(Ni){case 8:Hx(),Re=6;break e;case 3:case 2:case 9:case 6:sl.current===null&&(v=!0);var Yt=Ni;if(Ni=0,co=null,wu(g,at,jt,Yt),E&&Cf){Re=0;break e}break;default:Yt=Ni,Ni=0,co=null,wu(g,at,jt,Yt)}}Lw(),Re=Ts;break}catch(hn){Xi(g,hn)}while(!0);return v&&g.shellSuspendCounter++,Bc=Yi=null,jr=k,Vn.H=q,Vn.A=ee,zr===null&&(Er=null,Wr=0,Dt()),Re}function Lw(){for(;zr!==null;)df(zr)}function jw(g,v){var E=jr;jr|=2;var k=_d(),q=Cl();Er!==g||Wr!==v?(sg=null,Nf=ya()+500,Os(g,v)):Cf=C(g,v);e:do try{if(Ni!==0&&zr!==null){v=zr;var ee=co;t:switch(Ni){case 1:Ni=0,co=null,wu(g,v,ee,1);break;case 2:case 9:if(Ke(ee)){Ni=0,co=null,Vx(v);break}v=function(){Ni!==2&&Ni!==9||Er!==g||(Ni=7),qe(g)},ee.then(v,v);break e;case 3:Ni=7;break e;case 4:Ni=5;break e;case 7:Ke(ee)?(Ni=0,co=null,Vx(v)):(Ni=0,co=null,wu(g,v,ee,7));break;case 5:var Re=null;switch(zr.tag){case 26:Re=zr.memoizedState;case 5:case 27:var at=zr,jt=at.type,Yt=at.pendingProps;if(Re?Eb(Re):Ss(at.stateNode,jt,Yt)){Ni=0,co=null;var hn=at.sibling;if(hn!==null)zr=hn;else{var en=at.return;en!==null?(zr=en,Gp(en)):zr=null}break t}}Ni=0,co=null,wu(g,v,ee,5);break;case 6:Ni=0,co=null,wu(g,v,ee,6);break;case 8:Hx(),Ts=6;break e;default:throw Error(i(462))}}Vp();break}catch(wn){Xi(g,wn)}while(!0);return Bc=Yi=null,Vn.H=k,Vn.A=q,jr=E,zr!==null?0:(Er=null,Wr=0,Dt(),Ts)}function Vp(){for(;zr!==null&&!C3();)df(zr)}function df(g){var v=Vt(g.alternate,g,Ou);g.memoizedProps=g.pendingProps,v===null?Gp(g):zr=v}function Vx(g){var v=g,E=v.alternate;switch(v.tag){case 15:case 0:v=Ds(E,v,v.pendingProps,v.type,void 0,Wr);break;case 11:v=Ds(E,v,v.pendingProps,v.type.render,v.ref,Wr);break;case 5:fr(v);default:xi(E,v),v=zr=$x(v,Ou),v=Vt(E,v,Ou)}g.memoizedProps=g.pendingProps,v===null?Gp(g):zr=v}function wu(g,v,E,k){Bc=Yi=null,fr(v),Sf=null,zh=0;var q=v.return;try{if(Am(g,q,v,E,Wr)){Ts=1,Jl(g,ne(E,g.current)),zr=null;return}}catch(ee){if(q!==null)throw zr=q,ee;Ts=1,Jl(g,ne(E,g.current)),zr=null;return}v.flags&32768?(Gr||k===1?g=!0:Cf||(Wr&536870912)!==0?g=!1:(Vc=g=!0,(k===2||k===9||k===3||k===6)&&(k=sl.current,k!==null&&k.tag===13&&(k.flags|=16384))),ff(v,g)):Gp(v)}function Gp(g){var v=g;do{if((v.flags&32768)!==0){ff(v,Vc);return}g=v.return;var E=Ji(v.alternate,v,Ou);if(E!==null){zr=E;return}if(v=v.sibling,v!==null){zr=v;return}zr=v=g}while(v!==null);Ts===0&&(Ts=5)}function ff(g,v){do{var E=Ps(g.alternate,g);if(E!==null){E.flags&=32767,zr=E;return}if(E=g.return,E!==null&&(E.flags|=32768,E.subtreeFlags=0,E.deletions=null),!v&&(g=g.sibling,g!==null)){zr=g;return}zr=g=E}while(g!==null);Ts=6,zr=null}function Mu(g,v,E,k,q,ee,Re,at,jt){g.cancelPendingCommit=null;do Cu();while(uo!==0);if((jr&6)!==0)throw Error(i(327));if(v!==null){if(v===g.current)throw Error(i(177));if(ee=v.lanes|v.childLanes,ee|=Fh,O(g,E,ee,Re,at,jt),g===Er&&(zr=Er=null,Wr=0),Gh=v,Id=g,Lu=E,a0=ee,wv=q,Lb=k,(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?(g.callbackNode=null,g.callbackPriority=0,ao(Km,function(){return zm(),null})):(g.callbackNode=null,g.callbackPriority=0),k=(v.flags&13878)!==0,(v.subtreeFlags&13878)!==0||k){k=Vn.T,Vn.T=null,q=lc(),Vr(2),Re=jr,jr|=4;try{Lx(g,v,E)}finally{jr=Re,Vr(q),Vn.T=k}}uo=1,Sd(),Tu(),Gx()}}function Sd(){if(uo===1){uo=0;var g=Id,v=Gh,E=(v.flags&13878)!==0;if((v.subtreeFlags&13878)!==0||E){E=Vn.T,Vn.T=null;var k=lc();Vr(2);var q=jr;jr|=4;try{Lm(v,g),Hw(g.containerInfo)}finally{jr=q,Vr(k),Vn.T=E}}g.current=v,uo=2}}function Tu(){if(uo===2){uo=0;var g=Id,v=Gh,E=(v.flags&8772)!==0;if((v.subtreeFlags&8772)!==0||E){E=Vn.T,Vn.T=null;var k=lc();Vr(2);var q=jr;jr|=4;try{Iw(g,v.alternate,v)}finally{jr=q,Vr(k),Vn.T=E}}uo=3}}function Gx(){if(uo===4||uo===3){uo=0,Nb();var g=Id,v=Gh,E=Lu,k=Lb;(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?uo=5:(uo=0,Gh=Id=null,Wx(g,g.pendingLanes));var q=g.pendingLanes;if(q===0&&(Pd=null),U(E),v=v.stateNode,il&&typeof il.onCommitFiberRoot=="function")try{il.onCommitFiberRoot(jh,v,void 0,(v.current.flags&128)===128)}catch{}if(k!==null){v=Vn.T,q=lc(),Vr(2),Vn.T=null;try{for(var ee=g.onRecoverableError,Re=0;Re<k.length;Re++){var at=k[Re];ee(at.value,{componentStack:at.stack})}}finally{Vn.T=v,Vr(q)}}(Lu&3)!==0&&Cu(),qe(g),q=g.pendingLanes,(E&261930)!==0&&(q&42)!==0?g===og?ci++:(ci=0,og=g):ci=0,ls&&qm(),Ee(0)}}function Wx(g,v){(g.pooledCacheLanes&=v)===0&&(v=g.pooledCache,v!=null&&(g.pooledCache=null,Ae(v)))}function Cu(){return Sd(),Tu(),Gx(),zm()}function zm(){if(uo!==5)return!1;var g=Id,v=a0;a0=0;var E=U(Lu),k=32>E?32:E;E=Vn.T;var q=lc();try{Vr(k),Vn.T=null,k=wv,wv=null;var ee=Id,Re=Lu;if(uo=0,Gh=Id=null,Lu=0,(jr&6)!==0)throw Error(i(331));var at=jr;if(jr|=4,Ux(ee.current),zx(ee,ee.current,Re,k),jr=at,Ee(0,!1),il&&typeof il.onPostCommitFiberRoot=="function")try{il.onPostCommitFiberRoot(jh,ee)}catch{}return!0}finally{Vr(q),Vn.T=E,Wx(g,v)}}function hf(g,v,E){v=ne(E,v),v=md(g.stateNode,v,2),g=Gt(g,v,2),g!==null&&(P(g,2),qe(g))}function rr(g,v,E){if(g.tag===3)hf(g,g,E);else for(;v!==null;){if(v.tag===3){hf(v,g,E);break}else if(v.tag===1){var k=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(Pd===null||!Pd.has(k))){g=ne(E,g),E=Em(2),k=Gt(v,E,2),k!==null&&(Pp(E,k,v,g),P(k,2),qe(k));break}}v=v.return}}function Wp(g,v,E){var k=g.pingCache;if(k===null){k=g.pingCache=new Pl;var q=new Set;k.set(v,q)}else q=k.get(v),q===void 0&&(q=new Set,k.set(v,q));q.has(E)||(Ef=!0,q.add(E),g=zw.bind(null,g,v,E),v.then(g,g))}function zw(g,v,E){var k=g.pingCache;k!==null&&k.delete(v),g.pingedLanes|=g.suspendedLanes&E,g.warmLanes&=~E,Er===g&&(Wr&E)===E&&(Ts===4||Ts===3&&(Wr&62914560)===Wr&&300>ya()-ig?(jr&2)===0&&Os(g,0):s0|=E,o0===Wr&&(o0=0)),qe(g)}function Fw(g,v){v===0&&(v=N()),g=Qe(g,v),g!==null&&(P(g,v),qe(g))}function KC(g){var v=g.memoizedState,E=0;v!==null&&(E=v.retryLane),Fw(g,E)}function ZC(g,v){var E=0;switch(g.tag){case 31:case 13:var k=g.stateNode,q=g.memoizedState;q!==null&&(E=q.retryLane);break;case 19:k=g.stateNode;break;case 22:k=g.stateNode._retryCache;break;default:throw Error(i(314))}k!==null&&k.delete(v),Fw(g,E)}function ao(g,v){return Ym(g,v)}function Wy(g,v,E,k){this.tag=g,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mh(g){return g=g.prototype,!(!g||!g.isReactComponent)}function El(g,v){var E=g.alternate;return E===null?(E=n(g.tag,v,g.key,g.mode),E.elementType=g.elementType,E.type=g.type,E.stateNode=g.stateNode,E.alternate=g,g.alternate=E):(E.pendingProps=v,E.type=g.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=g.flags&65011712,E.childLanes=g.childLanes,E.lanes=g.lanes,E.child=g.child,E.memoizedProps=g.memoizedProps,E.memoizedState=g.memoizedState,E.updateQueue=g.updateQueue,v=g.dependencies,E.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},E.sibling=g.sibling,E.index=g.index,E.ref=g.ref,E.refCleanup=g.refCleanup,E}function $x(g,v){g.flags&=65011714;var E=g.alternate;return E===null?(g.childLanes=0,g.lanes=v,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=E.childLanes,g.lanes=E.lanes,g.child=E.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=E.memoizedProps,g.memoizedState=E.memoizedState,g.updateQueue=E.updateQueue,g.type=E.type,v=E.dependencies,g.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext}),g}function wd(g,v,E,k,q,ee){var Re=0;if(k=g,typeof g=="function")Mh(g)&&(Re=1);else if(typeof g=="string")Re=cc&&bo?av(g,E,jo.current)?26:Ab(g)?27:5:cc?av(g,E,jo.current)?26:5:bo&&Ab(g)?27:5;else e:switch(g){case Hm:return g=n(31,E,v,q),g.elementType=Hm,g.lanes=ee,g;case Ah:return oc(E.children,q,ee,v);case Nh:Re=8,q|=24;break;case Rh:return g=n(12,E,v,q|2),g.elementType=Rh,g.lanes=ee,g;case Kx:return g=n(13,E,v,q),g.elementType=Kx,g.lanes=ee,g;case Md:return g=n(19,E,v,q),g.elementType=Md,g.lanes=ee,g;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case ac:Re=10;break e;case Bm:Re=9;break e;case $p:Re=11;break e;case Zx:Re=14;break e;case Ia:Re=16,k=null;break e}Re=29,E=Error(i(130,g===null?"null":typeof g,"")),k=null}return v=n(Re,E,v,q),v.elementType=g,v.type=k,v.lanes=ee,v}function oc(g,v,E,k){return g=n(7,g,k,v),g.lanes=E,g}function $y(g,v,E){return g=n(6,g,null,v),g.lanes=E,g}function qy(g){var v=n(18,null,null,0);return v.stateNode=g,v}function Xy(g,v,E){return v=n(4,g.children!==null?g.children:[],g.key,v),v.lanes=E,v.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},v}function Uw(g,v,E,k,q,ee,Re,at,jt){this.tag=1,this.containerInfo=g,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=nl,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=D(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=D(0),this.hiddenUpdates=D(null),this.identifierPrefix=k,this.onUncaughtError=q,this.onCaughtError=ee,this.onRecoverableError=Re,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=jt,this.incompleteTransitions=new Map}function pf(g,v,E,k,q,ee,Re,at,jt,Yt,hn,en){return g=new Uw(g,v,E,Re,jt,Yt,hn,en,at),v=1,ee===!0&&(v|=24),ee=n(3,null,null,v),g.current=ee,ee.stateNode=g,v=Se(),v.refCount++,g.pooledCache=v,v.refCount++,ee.memoizedState={element:k,isDehydrated:E,cache:v},Tt(ee),g}function qx(g){return g?(g=Au,g):Au}function Fm(g){var v=g._reactInternals;if(v===void 0)throw typeof g.render=="function"?Error(i(188)):(g=Object.keys(g).join(","),Error(i(268,g)));return g=a(v),g=g!==null?l(g):null,g===null?null:Xp(g.stateNode)}function Yy(g,v,E,k,q,ee){q=qx(q),k.context===null?k.context=q:k.pendingContext=q,k=Ut(v),k.payload={element:E},ee=ee===void 0?null:ee,ee!==null&&(k.callback=ee),E=Gt(g,k,v),E!==null&&(_s(E,g,v),sn(E,g,v))}function Th(g,v){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var E=g.retryLane;g.retryLane=E!==0&&E<v?E:v}}function Um(g,v){Th(g,v),(g=g.alternate)&&Th(g,v)}var Tr={},Xx=ei,el=UCe,Yx=Object.assign,Ch=Symbol.for("react.element"),Eu=Symbol.for("react.transitional.element"),Eh=Symbol.for("react.portal"),Ah=Symbol.for("react.fragment"),Nh=Symbol.for("react.strict_mode"),Rh=Symbol.for("react.profiler"),Bm=Symbol.for("react.consumer"),ac=Symbol.for("react.context"),$p=Symbol.for("react.forward_ref"),Kx=Symbol.for("react.suspense"),Md=Symbol.for("react.suspense_list"),Zx=Symbol.for("react.memo"),Ia=Symbol.for("react.lazy"),Hm=Symbol.for("react.activity"),Ky=Symbol.for("react.memo_cache_sentinel"),Td=Symbol.iterator,mf=Symbol.for("react.client.reference"),gf=Array.isArray,Vn=Xx.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Zy=e.rendererVersion,Vm=e.rendererPackageName,qp=e.extraDevToolsConfig,Xp=e.getPublicInstance,Bw=e.getRootHostContext,Yp=e.getChildHostContext,Qx=e.prepareForCommit,Hw=e.resetAfterCommit,Qy=e.createInstance;e.cloneMutableInstance;var Gm=e.appendInitialChild,tl=e.finalizeInitialChildren,Oa=e.shouldSetTextContent,Cd=e.createTextInstance;e.cloneMutableTextInstance;var Jy=e.scheduleTimeout,Vw=e.cancelTimeout,nl=e.noTimeout,Gs=e.isPrimaryRenderer;e.warnsIfNotActing;var Yr=e.supportsMutation,Al=e.supportsPersistence,ls=e.supportsHydration,yr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Oi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Vr=e.setCurrentUpdatePriority,lc=e.getCurrentUpdatePriority,Kp=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var kh=e.shouldAttemptEagerTransition,Jx=e.detachDeletedInstance;e.requestPostPaintCallback;var Wm=e.maySuspendCommit,Zp=e.maySuspendCommitOnUpdate,eb=e.maySuspendCommitInSyncRender,Ss=e.preloadInstance,tb=e.startSuspendingCommit,ev=e.suspendInstance;e.suspendOnActiveViewTransition;var Gw=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Dh=e.NotPendingTransition,Ph=e.HostTransitionContext,nb=e.resetFormInstance;e.bindToConsole;var rb=e.supportsMicrotasks,ib=e.scheduleMicrotask,yo=e.supportsTestSelectors,Ws=e.findFiberRoot,tv=e.getBoundingRect,$m=e.getTextContent,xf=e.isHiddenSubtree,sb=e.matchAccessibilityRole,Ed=e.setFocusIfFocusable,nv=e.setupIntersectionObserver,ob=e.appendChild,ab=e.appendChildToContainer,Ww=e.commitTextUpdate,$w=e.commitMount,qw=e.commitUpdate,Xw=e.insertBefore,Yw=e.insertInContainerBefore,Kw=e.removeChild,lb=e.removeChildFromContainer,cb=e.resetTextContent,QC=e.hideInstance,Zw=e.hideTextInstance,Qw=e.unhideInstance,Jw=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var ub=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var e3=e.cloneInstance,db=e.createContainerChildSet,fb=e.appendChildToContainerChildSet,t3=e.finalizeContainerChildren,hb=e.replaceContainerChildren,n3=e.cloneHiddenInstance,pb=e.cloneHiddenTextInstance,vf=e.isSuspenseInstancePending,rv=e.isSuspenseInstanceFallback,iv=e.getSuspenseInstanceFallbackErrorDetails,sv=e.registerSuspenseInstanceRetry,r3=e.canHydrateFormStateMarker,mb=e.isFormStateMarkerMatching,i3=e.getNextHydratableSibling,s3=e.getNextHydratableSiblingAfterSingleton,o3=e.getFirstHydratableChild,a3=e.getFirstHydratableChildWithinContainer,l3=e.getFirstHydratableChildWithinActivityInstance,c3=e.getFirstHydratableChildWithinSuspenseInstance,gb=e.getFirstHydratableChildWithinSingleton,u3=e.canHydrateInstance,d3=e.canHydrateTextInstance,xb=e.canHydrateActivityInstance,f3=e.canHydrateSuspenseInstance,h3=e.hydrateInstance,JC=e.hydrateTextInstance,vb=e.hydrateActivityInstance,p3=e.hydrateSuspenseInstance,m3=e.getNextHydratableInstanceAfterActivityInstance,yb=e.getNextHydratableInstanceAfterSuspenseInstance,g3=e.commitHydratedInstance,x3=e.commitHydratedContainer,eE=e.commitHydratedActivityInstance,tE=e.commitHydratedSuspenseInstance,v3=e.finalizeHydratedChildren,qm=e.flushHydrationEvents;e.clearActivityBoundary;var bb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var ov=e.clearSuspenseBoundaryFromContainer,y3=e.hideDehydratedBoundary,b3=e.unhideDehydratedBoundary,Qp=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var _3=e.validateHydratableInstance,_b=e.validateHydratableTextInstance,cc=e.supportsResources,av=e.isHostHoistableType,Xm=e.getHoistableRoot,Sb=e.getResource,wb=e.acquireResource,yf=e.releaseResource,S3=e.hydrateHoistable,Mb=e.mountHoistable,Tb=e.unmountHoistable,lv=e.createHoistableInstance,w3=e.prepareToCommitHoistables,Cb=e.mayResourceSuspendCommit,Eb=e.preloadResource,M3=e.suspendResource,bo=e.supportsSingletons,cv=e.resolveSingletonInstance,lo=e.acquireSingletonInstance,Lo=e.releaseSingletonInstance,Ab=e.isHostSingletonType,Ih=e.isSingletonScope,uv=[],Oh=-1,Au={},rl=Math.clz32?Math.clz32:_,dv=Math.log,T3=Math.LN2,fv=256,Lh=262144,Jp=4194304,Ym=el.unstable_scheduleCallback,hv=el.unstable_cancelCallback,C3=el.unstable_shouldYield,Nb=el.unstable_requestPaint,ya=el.unstable_now,pv=el.unstable_ImmediatePriority,E3=el.unstable_UserBlockingPriority,Km=el.unstable_NormalPriority,mv=el.unstable_IdlePriority,Rb=el.log,A3=el.unstable_setDisableYieldValue,jh=null,il=null,$s=typeof Object.is=="function"?Object.is:Y,gv=typeof reportError=="function"?reportError:function(g){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var v=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g=="object"&&g!==null&&typeof g.message=="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(v))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",g);return}console.error(g)},nE=Object.prototype.hasOwnProperty,xv,Nu,Zm=!1,kb=new WeakMap,Ad=[],Ru=0,Li=null,Qm=0,uc=[],Nl=0,dc=null,Zo=1,Uc="",jo=m(null),Nd=m(null),Qo=m(null),Jm=m(null),_o=null,cs=null,Gr=!1,ku=null,La=!1,vv=Error(i(519)),fc=m(null),Yi=null,Bc=null,N3=typeof AbortController<"u"?AbortController:function(){var g=[],v=this.signal={aborted:!1,addEventListener:function(E,k){g.push(k)}};this.abort=function(){v.aborted=!0,g.forEach(function(E){return E()})}},zo=el.unstable_scheduleCallback,rE=el.unstable_NormalPriority,us={$$typeof:ac,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},eg=null,Ei=null,ba=!1,hc=!1,yv=!1,bf=0,e0=null,Db=0,Rd=0,So=null,pc=Vn.S;Vn.S=function(g,v){Vh=ya(),typeof v=="object"&&v!==null&&typeof v.then=="function"&&lt(g,v),pc!==null&&pc(g,v)};var _f=m(null),wo=Error(i(460)),bv=Error(i(474)),mc=Error(i(542)),Du={then:function(){}},ja=null,Sf=null,zh=0,Jo=zt(!0),Pb=zt(!1),ea=[],Pu=0,Fh=0,Rl=!1,_v=!1,Uh=m(null),wf=m(0),sl=m(null),ol=null,Ls=m(0),kd=0,br=null,Fn=null,ur=null,Cr=!1,Mr=!1,Qr=!1,_a=0,gc=0,Hc=null,Ib=0,kl={readContext:ue,use:ms,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};kl.useEffectEvent=Zt;var ws={readContext:ue,use:ms,useCallback:function(g,v){return kr().memoizedState=[g,v===void 0?null:v],g},useContext:ue,useEffect:ri,useImperativeHandle:function(g,v,E){E=E!=null?E.concat([g]):null,Za(4194308,4,qr.bind(null,v,g),E)},useLayoutEffect:function(g,v){return Za(4194308,4,g,v)},useInsertionEffect:function(g,v){Za(4,2,g,v)},useMemo:function(g,v){var E=kr();v=v===void 0?null:v;var k=g();if(Qr){W(!0);try{g()}finally{W(!1)}}return E.memoizedState=[k,v],k},useReducer:function(g,v,E){var k=kr();if(E!==void 0){var q=E(v);if(Qr){W(!0);try{E(v)}finally{W(!1)}}}else q=v;return k.memoizedState=k.baseState=q,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:q},k.queue=g,g=g.dispatch=vs.bind(null,br,g),[k.memoizedState,g]},useRef:function(g){var v=kr();return g={current:g},v.memoizedState=g},useState:function(g){g=_l(g);var v=g.queue,E=Ml.bind(null,br,v);return v.dispatch=E,[g.memoizedState,E]},useDebugValue:wl,useDeferredValue:function(g,v){var E=kr();return gi(E,g,v)},useTransition:function(){var g=_l(!1);return g=dd.bind(null,br,g.queue,!0,!1),kr().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,v,E){var k=br,q=kr();if(Gr){if(E===void 0)throw Error(i(407));E=E()}else{if(E=v(),Er===null)throw Error(i(349));(Wr&127)!==0||Pi(k,v,E)}q.memoizedState=E;var ee={value:E,getSnapshot:v};return q.queue=ee,ri(ga.bind(null,k,ee,g),[g]),k.flags|=2048,xs(9,{destroy:void 0},qo.bind(null,k,ee,E,v),null),E},useId:function(){var g=kr(),v=Er.identifierPrefix;if(Gr){var E=Uc,k=Zo;E=(k&~(1<<32-rl(k)-1)).toString(32)+E,v="_"+v+"R_"+E,E=_a++,0<E&&(v+="H"+E.toString(32)),v+="_"}else E=Ib++,v="_"+v+"r_"+E.toString(32)+"_";return g.memoizedState=v},useHostTransitionStatus:rf,useFormState:Zl,useActionState:Zl,useOptimistic:function(g){var v=kr();v.memoizedState=v.baseState=g;var E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return v.queue=E,v=Rp.bind(null,br,!0,E),E.dispatch=v,[g,v]},useMemoCache:Ns,useCacheRefresh:function(){return kr().memoizedState=Bs.bind(null,br)},useEffectEvent:function(g){var v=kr(),E={impl:g};return v.memoizedState=E,function(){if((jr&2)!==0)throw Error(i(440));return E.impl.apply(void 0,arguments)}}},Iu={readContext:ue,use:ms,useCallback:Ql,useContext:ue,useEffect:Hr,useImperativeHandle:ka,useInsertionEffect:Si,useLayoutEffect:Ii,useMemo:go,useReducer:gs,useRef:Ka,useState:function(){return gs(Di)},useDebugValue:wl,useDeferredValue:function(g,v){var E=ln();return _h(E,Fn.memoizedState,g,v)},useTransition:function(){var g=gs(Di)[0],v=ln().memoizedState;return[typeof g=="boolean"?g:Dn(g),v]},useSyncExternalStore:Rs,useId:va,useHostTransitionStatus:rf,useFormState:Xo,useActionState:Xo,useOptimistic:function(g,v){var E=ln();return xa(E,Fn,g,v)},useMemoCache:Ns,useCacheRefresh:qi};Iu.useEffectEvent=vr;var Mf={readContext:ue,use:ms,useCallback:Ql,useContext:ue,useEffect:Hr,useImperativeHandle:ka,useInsertionEffect:Si,useLayoutEffect:Ii,useMemo:go,useReducer:hi,useRef:Ka,useState:function(){return hi(Di)},useDebugValue:wl,useDeferredValue:function(g,v){var E=ln();return Fn===null?gi(E,g,v):_h(E,Fn.memoizedState,g,v)},useTransition:function(){var g=hi(Di)[0],v=ln().memoizedState;return[typeof g=="boolean"?g:Dn(g),v]},useSyncExternalStore:Rs,useId:va,useHostTransitionStatus:rf,useFormState:Sl,useActionState:Sl,useOptimistic:function(g,v){var E=ln();return Fn!==null?xa(E,Fn,g,v):(E.baseState=g,[g,E.queue.dispatch])},useMemoCache:Ns,useCacheRefresh:qi};Mf.useEffectEvent=vr;var tg={enqueueSetState:function(g,v,E){g=g._reactInternals;var k=as(),q=Ut(k);q.payload=v,E!=null&&(q.callback=E),v=Gt(g,q,k),v!==null&&(_s(v,g,k),sn(v,g,k))},enqueueReplaceState:function(g,v,E){g=g._reactInternals;var k=as(),q=Ut(k);q.tag=1,q.payload=v,E!=null&&(q.callback=E),v=Gt(g,q,k),v!==null&&(_s(v,g,k),sn(v,g,k))},enqueueForceUpdate:function(g,v){g=g._reactInternals;var E=as(),k=Ut(E);k.tag=2,v!=null&&(k.callback=v),v=Gt(g,k,E),v!==null&&(_s(v,g,E),sn(v,g,E))}},za=Error(i(461)),es=!1,Bh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},js=!1,zs=!1,t0=!1,Ob=typeof WeakSet=="function"?WeakSet:Set,qs=null,Ms=null,Xs=!1,Ai=null,Dl=8192,n0={getCacheForType:function(g){var v=ue(us),E=v.data.get(g);return E===void 0&&(E=g(),v.data.set(g,E)),E},cacheSignal:function(){return ue(us).controller.signal}},xc=0,r0=1,i0=2,ng=3,Tf=4;if(typeof Symbol=="function"&&Symbol.for){var Hh=Symbol.for;xc=Hh("selector.component"),r0=Hh("selector.has_pseudo_class"),i0=Hh("selector.role"),ng=Hh("selector.test_id"),Tf=Hh("selector.text")}var Pl=typeof WeakMap=="function"?WeakMap:Map,jr=0,Er=null,zr=null,Wr=0,Ni=0,co=null,Vc=!1,Cf=!1,Ef=!1,Ou=0,Ts=0,Dd=0,Af=0,s0=0,Fa=0,o0=0,rg=null,al=null,Sv=!1,ig=0,Vh=0,Nf=1/0,sg=null,Pd=null,uo=0,Id=null,Gh=null,Lu=0,a0=0,wv=null,Lb=null,ci=0,og=null;return Tr.attemptContinuousHydration=function(g){if(g.tag===13||g.tag===31){var v=Qe(g,67108864);v!==null&&_s(v,g,67108864),Um(g,67108864)}},Tr.attemptHydrationAtCurrentPriority=function(g){if(g.tag===13||g.tag===31){var v=as();v=F(v);var E=Qe(g,v);E!==null&&_s(E,g,v),Um(g,v)}},Tr.attemptSynchronousHydration=function(g){switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var v=S(g.pendingLanes);if(v!==0){for(g.pendingLanes|=2,g.entangledLanes|=2;v;){var E=1<<31-rl(v);g.entanglements[1]|=E,v&=~E}qe(g),(jr&6)===0&&(Nf=ya()+500,Ee(0))}}break;case 31:case 13:v=Qe(g,2),v!==null&&_s(v,g,2),Bx(),Um(g,2)}},Tr.batchedUpdates=function(g,v){return g(v)},Tr.createComponentSelector=function(g){return{$$typeof:xc,value:g}},Tr.createContainer=function(g,v,E,k,q,ee,Re,at,jt,Yt){return pf(g,v,!1,null,E,k,ee,null,Re,at,jt,Yt)},Tr.createHasPseudoClassSelector=function(g){return{$$typeof:r0,value:g}},Tr.createHydrationContainer=function(g,v,E,k,q,ee,Re,at,jt,Yt,hn,en,wn,pr){var Ys;return g=pf(E,k,!0,g,q,ee,at,pr,jt,Yt,hn,en),g.context=qx(null),E=g.current,k=as(),k=F(k),q=Ut(k),q.callback=(Ys=v)!=null?Ys:null,Gt(E,q,k),v=k,g.current.lanes=v,P(g,v),qe(g),g},Tr.createPortal=function(g,v,E){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Eh,key:k==null?null:""+k,children:g,containerInfo:v,implementation:E}},Tr.createRoleSelector=function(g){return{$$typeof:i0,value:g}},Tr.createTestNameSelector=function(g){return{$$typeof:ng,value:g}},Tr.createTextSelector=function(g){return{$$typeof:Tf,value:g}},Tr.defaultOnCaughtError=function(g){console.error(g)},Tr.defaultOnRecoverableError=function(g){gv(g)},Tr.defaultOnUncaughtError=function(g){gv(g)},Tr.deferredUpdates=function(g){var v=Vn.T,E=lc();try{return Vr(32),Vn.T=null,g()}finally{Vr(E),Vn.T=v}},Tr.discreteUpdates=function(g,v,E,k,q){var ee=Vn.T,Re=lc();try{return Vr(2),Vn.T=null,g(v,E,k,q)}finally{Vr(Re),Vn.T=ee,jr===0&&(Nf=ya()+500)}},Tr.findAllNodes=Ja,Tr.findBoundingRects=function(g,v){if(!yo)throw Error(i(363));v=Ja(g,v),g=[];for(var E=0;E<v.length;E++)g.push(tv(v[E]));for(v=g.length-1;0<v;v--){E=g[v];for(var k=E.x,q=k+E.width,ee=E.y,Re=ee+E.height,at=v-1;0<=at;at--)if(v!==at){var jt=g[at],Yt=jt.x,hn=Yt+jt.width,en=jt.y,wn=en+jt.height;if(k>=Yt&&ee>=en&&q<=hn&&Re<=wn){g.splice(v,1);break}else if(k!==Yt||E.width!==jt.width||wn<ee||en>Re){if(!(ee!==en||E.height!==jt.height||hn<k||Yt>q)){Yt>k&&(jt.width+=Yt-k,jt.x=k),hn<q&&(jt.width=q-Yt),g.splice(v,1);break}}else{en>ee&&(jt.height+=en-ee,jt.y=ee),wn<Re&&(jt.height=Re-en),g.splice(v,1);break}}}return g},Tr.findHostInstance=Fm,Tr.findHostInstanceWithNoPortals=function(g){return g=a(g),g=g!==null?c(g):null,g===null?null:Xp(g.stateNode)},Tr.findHostInstanceWithWarning=function(g){return Fm(g)},Tr.flushPassiveEffects=Cu,Tr.flushSyncFromReconciler=function(g){var v=jr;jr|=1;var E=Vn.T,k=lc();try{if(Vr(2),Vn.T=null,g)return g()}finally{Vr(k),Vn.T=E,jr=v,(jr&6)===0&&Ee(0)}},Tr.flushSyncWork=Bx,Tr.focusWithin=function(g,v){if(!yo)throw Error(i(363));for(g=cf(g),v=Bp(g,v),v=Array.from(v),g=0;g<v.length;){var E=v[g++],k=E.tag;if(!xf(E)){if((k===5||k===26||k===27)&&Ed(E.stateNode))return!0;for(E=E.child;E!==null;)v.push(E),E=E.sibling}}return!1},Tr.getFindAllNodesFailureDescription=function(g,v){if(!yo)throw Error(i(363));var E=0,k=[];g=[cf(g),0];for(var q=0;q<g.length;){var ee=g[q++],Re=ee.tag,at=g[q++],jt=v[at];if((Re!==5&&Re!==26&&Re!==27||!xf(ee))&&(uf(ee,jt)&&(k.push(Up(jt)),at++,at>E&&(E=at)),at<v.length))for(ee=ee.child;ee!==null;)g.push(ee,at),ee=ee.sibling}if(E<v.length){for(g=[];E<v.length;E++)g.push(Up(v[E]));return`findAllNodes was able to match part of the selector:
  `+(k.join(" > ")+`

No matching component was found for:
  `)+g.join(" > ")}return null},Tr.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 27:case 5:return Xp(g.child.stateNode);default:return g.child.stateNode}},Tr.injectIntoDevTools=function(){var g={bundleType:0,version:Zy,rendererPackageName:Vm,currentDispatcherRef:Vn,reconcilerVersion:"19.2.0"};if(qp!==null&&(g.rendererConfig=qp),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")g=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)g=!0;else{try{jh=v.inject(g),il=v}catch{}g=!!v.checkDCE}}return g},Tr.isAlreadyRendering=function(){return(jr&6)!==0},Tr.observeVisibleRects=function(g,v,E,k){if(!yo)throw Error(i(363));g=Ja(g,v);var q=nv(g,E,k).disconnect;return{disconnect:function(){q()}}},Tr.shouldError=function(){return null},Tr.shouldSuspend=function(){return!1},Tr.startHostTransition=function(g,v,E,k){if(g.tag!==5)throw Error(i(476));var q=fd(g).queue;dd(g,q,v,Dh,E===null?r:function(){var ee=fd(g);return ee.next===null&&(ee=g.alternate.memoizedState),xo(g,ee.next.queue,{},as()),E(k)})},Tr.updateContainer=function(g,v,E,k){var q=v.current,ee=as();return Yy(q,ee,g,v,E,k),ee},Tr.updateContainerSync=function(g,v,E,k){return Yy(v.current,2,g,v,E,k),2},Tr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(Vz)),Vz.exports}var Wz;function hEe(){return Wz||(Wz=1,Hz.exports=fEe()),Hz.exports}var pEe=hEe();const mEe=dEe(pEe);function gEe(t){const e=mEe(t);return e.injectIntoDevTools(),e}const GK=0,my={},xEe=/^three(?=[A-Z])/,$C=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let vEe=0;const yEe=t=>typeof t=="function";function bEe(t){if(yEe(t)){const e=`${vEe++}`;return my[e]=t,e}else Object.assign(my,t)}function WK(t,e){const n=$C(t),r=my[n];if(t!=="primitive"&&!r)throw new Error(`R3F: ${n} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(t==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function _Ee(t,e,n){var r;return t=$C(t)in my?t:t.replace(xEe,""),WK(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,U5(e.object,n,t,e)}function SEe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?H5(t.parent,t):wc(t.object)&&(t.object.visible=!1),t.isHidden=!0,By(t)}}function $K(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?B5(t.parent,t):wc(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,By(t)}}function B9(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const o=my[$C(e.type)];e.object=(i=e.props.object)!=null?i:new o(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(I0(e.object,e.props),e.props.attach)B5(t,e);else if(wc(e.object)&&wc(t.object)){const o=t.object.children.indexOf(n==null?void 0:n.object);if(n&&o!==-1){const a=t.object.children.indexOf(e.object);if(a!==-1){t.object.children.splice(a,1);const l=a<o?o-1:o;t.object.children.splice(l,0,e.object)}else e.object.parent=t.object,t.object.children.splice(o,0,e.object),e.object.dispatchEvent({type:"added"}),t.object.dispatchEvent({type:"childadded",child:e.object})}else t.object.add(e.object)}for(const o of e.children)B9(e,o);By(e)}}function G6(t,e){e&&(e.parent=t,t.children.push(e),B9(t,e))}function $z(t,e,n){if(!e||!n)return;e.parent=t;const r=t.children.indexOf(n);r!==-1?t.children.splice(r,0,e):t.children.push(e),B9(t,e,n)}function qK(t){if(typeof t.dispose=="function"){const e=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():sk.unstable_scheduleCallback(sk.unstable_IdlePriority,e)}}function ak(t,e,n){if(!e)return;e.parent=null;const r=t.children.indexOf(e);r!==-1&&t.children.splice(r,1),e.props.attach?H5(t,e):wc(e.object)&&wc(t.object)&&(t.object.remove(e.object),rEe(LK(e),e.object));const i=e.props.dispose!==null&&n!==!1;for(let s=e.children.length-1;s>=0;s--){const o=e.children[s];ak(e,o,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&qK(e.object),n===void 0&&By(e)}function wEe(t,e){for(const n of[t,t.alternate])if(n!==null)if(typeof n.ref=="function"){n.refCleanup==null||n.refCleanup();const r=n.ref(e);typeof r=="function"&&(n.refCleanup=r)}else n.ref&&(n.ref.current=e)}const XM=[];function MEe(){for(const[n]of XM){const r=n.parent;if(r){n.props.attach?H5(r,n):wc(n.object)&&wc(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?H5(n,i):wc(i.object)&&wc(n.object)&&n.object.remove(i.object)}n.isHidden&&$K(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&qK(n.object)}for(const[n,r,i]of XM){n.props=r;const s=n.parent;if(s){var t,e;const o=my[$C(n.type)];n.object=(t=n.props.object)!=null?t:new o(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,wEe(i,n.object),I0(n.object,n.props),n.props.attach?B5(s,n):wc(n.object)&&wc(s.object)&&s.object.add(n.object);for(const a of n.children)a.props.attach?B5(n,a):wc(a.object)&&wc(n.object)&&n.object.add(a.object);By(n)}}XM.length=0}const W6=()=>{},qz={};let MM=GK;const TEe=0,CEe=4,lk=gEe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:_Ee,removeChild:ak,appendChild:G6,appendInitialChild:G6,insertBefore:$z,appendChildToContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||G6(n,e)},removeChildFromContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||ak(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||$z(r,e,n)},getRootHostContext:()=>qz,getChildHostContext:()=>qz,commitUpdate(t,e,n,r,i){var s,o,a;WK(e,r);let l=!1;if((t.type==="primitive"&&n.object!==r.object||((s=r.args)==null?void 0:s.length)!==((o=n.args)==null?void 0:o.length)||(a=r.args)!=null&&a.some((d,p)=>{var m;return d!==((m=n.args)==null?void 0:m[p])}))&&(l=!0),l)XM.push([t,{...r},i]);else{const d=JCe(t,r);Object.keys(d).length&&(Object.assign(t.props,d),I0(t.object,d))}(i.sibling===null||(i.flags&CEe)===TEe)&&MEe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>U5(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:SEe,unhideInstance:$K,createTextInstance:W6,hideTextInstance:W6,unhideTextInstance:W6,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:M.createContext(null),setCurrentUpdatePriority(t){MM=t},getCurrentUpdatePriority(){return MM},resolveUpdatePriority(){var t;if(MM!==GK)return MM;switch(typeof window<"u"&&((t=window.event)==null?void 0:t.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return cEe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return aEe;default:return lEe}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:uEe.version,applyViewTransitionName(t,e,n){},restoreViewTransitionName(t,e){},cancelViewTransitionName(t,e,n){},cancelRootViewTransitionName(t){},restoreRootViewTransitionName(t){},InstanceMeasurement:null,measureInstance:t=>null,wasInstanceInViewport:t=>!0,hasInstanceChanged:(t,e)=>!1,hasInstanceAffectedParent:(t,e)=>!1,suspendOnActiveViewTransition(t,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(t){},createViewTransitionInstance:t=>null,getCurrentGestureOffset(t){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(t,e){return t},cloneMutableTextInstance(t){return t},cloneRootViewTransitionContainer(t){throw new Error("Not implemented.")},removeRootViewTransitionClone(t,e){throw new Error("Not implemented.")},createFragmentInstance:t=>null,updateFragmentInstanceFiber(t,e){},commitNewChildToFragmentInstance(t,e){},deleteChildFromFragmentInstance(t,e){},measureClonedInstance:t=>null,maySuspendCommitOnUpdate:(t,e,n)=>!1,maySuspendCommitInSyncRender:(t,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(t,e)=>null}),yx=new Map,r1={objects:"shallow",strict:!1};function EEe(t,e){if(!e&&typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:n,height:r,top:i,left:s}=t.parentElement.getBoundingClientRect();return{width:n,height:r,top:i,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function AEe(t){const e=yx.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||sEe(dk,Yz),o=n||lk.createContainer(s,oEe,null,!1,null,"",i,i,i,null);e||yx.set(t,{fiber:o,store:s});let a,l,c=!1,d=null;return{async configure(p={}){let m;d=new Promise(B=>m=B);let{gl:x,size:b,scene:_,events:S,onCreated:w,shadows:C=!1,linear:A=!1,flat:N=!1,legacy:D=!1,orthographic:P=!1,frameloop:O="always",dpr:R=[1,2],performance:L,raycaster:V,camera:F,onPointerMissed:U}=p,W=s.getState(),Y=W.gl;if(!W.gl){const B={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},G=typeof x=="function"?await x(B):x;Bz(G)?Y=G:Y=new DK({...B,...x}),W.set({gl:Y})}let $=W.raycaster;$||W.set({raycaster:$=new SK});const{params:X,...Z}=V||{};if(Zs.equ(Z,$,r1)||I0($,{...Z}),Zs.equ(X,$.params,r1)||I0($,{params:{...$.params,...X}}),!W.camera||W.camera===l&&!Zs.equ(l,F,r1)){l=F;const B=F==null?void 0:F.isCamera,G=B?F:P?new Kd(0,0,0,0,.1,1e3):new Js(75,0,.1,1e3);B||(G.position.z=5,F&&(I0(G,F),G.manual||("aspect"in F||"left"in F||"right"in F||"bottom"in F||"top"in F)&&(G.manual=!0,G.updateProjectionMatrix())),!W.camera&&!(F!=null&&F.rotation)&&G.lookAt(0,0,0)),W.set({camera:G}),$.camera=G}if(!W.scene){let B;_!=null&&_.isScene?(B=_,U5(B,s,"",{})):(B=new u9,U5(B,s,"",{}),_&&I0(B,_)),W.set({scene:B})}S&&!W.events.handlers&&W.set({events:S(s)});const K=EEe(t,b);if(Zs.equ(K,W.size,r1)||W.setSize(K.width,K.height,K.top,K.left),R&&W.viewport.dpr!==FK(R)&&W.setDpr(R),W.frameloop!==O&&W.setFrameloop(O),W.onPointerMissed||W.set({onPointerMissed:U}),L&&!Zs.equ(L,W.performance,r1)&&W.set(B=>({performance:{...B.performance,...L}})),!W.xr){var ne;const B=(ie,ce)=>{const te=s.getState();te.frameloop!=="never"&&Yz(ie,!0,te,ce)},G=()=>{const ie=s.getState();ie.gl.xr.enabled=ie.gl.xr.isPresenting,ie.gl.xr.setAnimationLoop(ie.gl.xr.isPresenting?B:null),ie.gl.xr.isPresenting||dk(ie)},j={connect(){const ie=s.getState().gl;ie.xr.addEventListener("sessionstart",G),ie.xr.addEventListener("sessionend",G)},disconnect(){const ie=s.getState().gl;ie.xr.removeEventListener("sessionstart",G),ie.xr.removeEventListener("sessionend",G)}};typeof((ne=Y.xr)==null?void 0:ne.addEventListener)=="function"&&j.connect(),W.set({xr:j})}if(Y.shadowMap){const B=Y.shadowMap.enabled,G=Y.shadowMap.type;if(Y.shadowMap.enabled=!!C,Zs.boo(C))Y.shadowMap.type=U_;else if(Zs.str(C)){var H;const j={basic:HX,percentage:A1,soft:U_,variance:zg};Y.shadowMap.type=(H=j[C])!=null?H:U_}else Zs.obj(C)&&Object.assign(Y.shadowMap,C);(B!==Y.shadowMap.enabled||G!==Y.shadowMap.type)&&(Y.shadowMap.needsUpdate=!0)}return ai.enabled=!D,c||(Y.outputColorSpace=A?am:pl,Y.toneMapping=N?ou:oC),W.legacy!==D&&W.set(()=>({legacy:D})),W.linear!==A&&W.set(()=>({linear:A})),W.flat!==N&&W.set(()=>({flat:N})),x&&!Zs.fun(x)&&!Bz(x)&&!Zs.equ(x,Y,r1)&&I0(Y,x),a=w,c=!0,m(),this},render(p){return!c&&!d&&this.configure(),d.then(()=>{lk.updateContainer(f.jsx(NEe,{store:s,children:p,onCreated:a,rootElement:t}),o,null,()=>{})}),s},unmount(){XK(t)}}}function NEe({store:t,children:e,onCreated:n,rootElement:r}){return Dw(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),f.jsx(HK.Provider,{value:t,children:e})}function XK(t,e){const n=yx.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),lk.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),KCe(i.scene),yx.delete(t)}catch{}},500)})}}const REe=new Set,kEe=new Set,DEe=new Set;function $6(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Z_(t,e){switch(t){case"before":return $6(REe,e);case"after":return $6(kEe,e);case"tail":return $6(DEe,e)}}let q6,X6;function ck(t,e,n){let r=e.clock.getDelta();e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),q6=e.internal.subscribers;for(let i=0;i<q6.length;i++)X6=q6[i],X6.ref.current(X6.store.getState(),r,n);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let V5=!1,uk=!1,Y6,Xz,i1;function YK(t){Xz=requestAnimationFrame(YK),V5=!0,Y6=0,Z_("before",t),uk=!0;for(const n of yx.values()){var e;i1=n.store.getState(),i1.internal.active&&(i1.frameloop==="always"||i1.internal.frames>0)&&!((e=i1.gl.xr)!=null&&e.isPresenting)&&(Y6+=ck(t,i1))}if(uk=!1,Z_("after",t),Y6===0)return Z_("tail",t),V5=!1,cancelAnimationFrame(Xz)}function dk(t,e=1){var n;if(!t)return yx.forEach(r=>dk(r.store.getState(),e));(n=t.gl.xr)!=null&&n.isPresenting||!t.internal.active||t.frameloop==="never"||(e>1?t.internal.frames=Math.min(60,t.internal.frames+e):uk?t.internal.frames=2:t.internal.frames=1,V5||(V5=!0,requestAnimationFrame(YK)))}function Yz(t,e=!0,n,r){if(e&&Z_("before",t),n)ck(t,n,r);else for(const i of yx.values())ck(t,i.store.getState());e&&Z_("after",t)}const K6={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function PEe(t){const{handlePointer:e}=iEe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(K6).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{const{set:r,events:i}=t.getState();if(i.disconnect==null||i.disconnect(),r(s=>({events:{...s.events,connected:n}})),i.handlers)for(const s in i.handlers){const o=i.handlers[s],[a,l]=K6[s];n.addEventListener(a,o,{passive:l})}},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){if(r.handlers)for(const i in r.handlers){const s=r.handlers[i],[o]=K6[i];r.connected.removeEventListener(o,s)}n(i=>({events:{...i.events,connected:void 0}}))}}}}function Kz(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function IEe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=M.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=M.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=M.useRef(!1);M.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,x]=M.useMemo(()=>{const w=()=>{if(!a.current.element)return;const{left:C,top:A,width:N,height:D,bottom:P,right:O,x:R,y:L}=a.current.element.getBoundingClientRect(),V={left:C,top:A,width:N,height:D,bottom:P,right:O,x:R,y:L};a.current.element instanceof HTMLElement&&r&&(V.height=a.current.element.offsetHeight,V.width=a.current.element.offsetWidth),Object.freeze(V),d.current&&!zEe(a.current.lastBounds,V)&&o(a.current.lastBounds=V)};return[w,c?Kz(w,c):w,l?Kz(w,l):w]},[o,r,l,c]);function b(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",x,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function _(){a.current.element&&(a.current.resizeObserver=new i(x),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(w=>w.addEventListener("scroll",x,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{x()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const S=w=>{!w||w===a.current.element||(b(),a.current.element=w,a.current.scrollContainers=KK(w),_())};return LEe(x,!!e),OEe(m),M.useEffect(()=>{b(),_()},[e,x,m]),M.useEffect(()=>b,[]),[S,s,p]}function OEe(t){M.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function LEe(t,e){M.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function KK(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...KK(t.parentElement)]}const jEe=["x","y","top","bottom","left","right","width","height"],zEe=(t,e)=>jEe.every(n=>t[n]===e[n]);function FEe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:o=PEe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:w,camera:C,scene:A,onPointerMissed:N,onCreated:D,...P}){M.useMemo(()=>bEe(CCe),[]);const O=qCe(),[R,L]=IEe({scroll:!0,debounce:{scroll:50,resize:0},...r}),V=M.useRef(null),F=M.useRef(null);M.useImperativeHandle(t,()=>V.current);const U=zK(N),[W,Y]=M.useState(!1),[$,X]=M.useState(!1);if(W)throw W;if($)throw $;const Z=M.useRef(null);Dw(()=>{const ne=V.current;if(L.width>0&&L.height>0&&ne){Z.current||(Z.current=AEe(ne));async function H(){await Z.current.configure({gl:s,scene:A,events:o,shadows:c,linear:d,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:w,camera:C,size:L,onPointerMissed:(...B)=>U.current==null?void 0:U.current(...B),onCreated:B=>{B.events.connect==null||B.events.connect(a?WCe(a)?a.current:a:F.current),l&&B.setEvents({compute:(G,j)=>{const ie=G[l+"X"],ce=G[l+"Y"];j.pointer.set(ie/j.size.width*2-1,-(ce/j.size.height)*2+1),j.raycaster.setFromCamera(j.pointer,j.camera)}}),D==null||D(B)}}),Z.current.render(f.jsx(O,{children:f.jsx(YCe,{set:X,children:f.jsx(M.Suspense,{fallback:f.jsx(XCe,{set:Y}),children:e??null})})}))}H()}}),M.useEffect(()=>{const ne=V.current;if(ne)return()=>XK(ne)},[]);const K=a?"none":"auto";return f.jsx("div",{ref:F,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...P,children:f.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:f.jsx("canvas",{ref:V,style:{display:"block"},children:n})})})}function UEe(t){return f.jsx(IK,{children:f.jsx(FEe,{...t})})}function fh(){return fh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fh.apply(null,arguments)}const Pw=new He,H9=new He,BEe=new He,Zz=new Ht;function HEe(t,e,n){const r=Pw.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,s=n.height/2;return[r.x*i+i,-(r.y*s)+s]}function VEe(t,e){const n=Pw.setFromMatrixPosition(t.matrixWorld),r=H9.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(BEe);return i.angleTo(s)>Math.PI/2}function GEe(t,e,n,r){const i=Pw.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),Zz.set(s.x,s.y),n.setFromCamera(Zz,e);const o=n.intersectObjects(r,!0);if(o.length){const a=o[0].distance;return i.distanceTo(n.ray.origin)<a}return!0}function WEe(t,e){if(e instanceof Kd)return e.zoom;if(e instanceof Js){const n=Pw.setFromMatrixPosition(t.matrixWorld),r=H9.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=n.distanceTo(r);return 1/(2*Math.tan(i/2)*s)}else return 1}function $Ee(t,e,n){if(e instanceof Js||e instanceof Kd){const r=Pw.setFromMatrixPosition(t.matrixWorld),i=H9.setFromMatrixPosition(e.matrixWorld),s=r.distanceTo(i),o=(n[1]-n[0])/(e.far-e.near),a=n[1]-o*e.far;return Math.round(o*s+a)}}const fk=t=>Math.abs(t)<1e-10?0:t;function ZK(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=fk(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const qEe=(t=>e=>ZK(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),XEe=(t=>(e,n)=>ZK(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]);function YEe(t){return t&&typeof t=="object"&&"current"in t}const V9=M.forwardRef(({children:t,eps:e=.001,style:n,className:r,prepend:i,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:c=!1,transform:d=!1,occlude:p,onOcclude:m,castShadow:x,receiveShadow:b,material:_,geometry:S,zIndexRange:w=[16777271,0],calculatePosition:C=HEe,as:A="div",wrapperClass:N,pointerEvents:D="auto",...P},O)=>{const{gl:R,camera:L,scene:V,size:F,raycaster:U,events:W,viewport:Y}=Mc(),[$]=M.useState(()=>document.createElement(A)),X=M.useRef(null),Z=M.useRef(null),K=M.useRef(0),ne=M.useRef([0,0]),H=M.useRef(null),B=M.useRef(null),G=(a==null?void 0:a.current)||W.connected||R.domElement.parentNode,j=M.useRef(null),ie=M.useRef(!1),ce=M.useMemo(()=>p&&p!=="blending"||Array.isArray(p)&&p.length&&YEe(p[0]),[p]);M.useLayoutEffect(()=>{const pe=R.domElement;p&&p==="blending"?(pe.style.zIndex=`${Math.floor(w[0]/2)}`,pe.style.position="absolute",pe.style.pointerEvents="none"):(pe.style.zIndex=null,pe.style.position=null,pe.style.pointerEvents=null)},[p]),M.useLayoutEffect(()=>{if(Z.current){const pe=X.current=WF.createRoot($);if(V.updateMatrixWorld(),d)$.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const be=C(Z.current,L,F);$.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${be[0]}px,${be[1]}px,0);transform-origin:0 0;`}return G&&(i?G.prepend($):G.appendChild($)),()=>{G&&G.removeChild($),pe.unmount()}}},[G,d]),M.useLayoutEffect(()=>{N&&($.className=N)},[N]);const te=M.useMemo(()=>d?{position:"absolute",top:0,left:0,width:F.width,height:F.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-F.height/2,left:-F.width/2,width:F.width,height:F.height},...n},[n,s,o,F,d]),se=M.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);M.useLayoutEffect(()=>{if(ie.current=!1,d){var pe;(pe=X.current)==null||pe.render(M.createElement("div",{ref:H,style:te},M.createElement("div",{ref:B,style:se},M.createElement("div",{ref:O,className:r,style:n,children:t}))))}else{var be;(be=X.current)==null||be.render(M.createElement("div",{ref:O,style:te,className:r,children:t}))}});const le=M.useRef(!0);WC(pe=>{if(Z.current){L.updateMatrixWorld(),Z.current.updateWorldMatrix(!0,!1);const be=d?ne.current:C(Z.current,L,F);if(d||Math.abs(K.current-L.zoom)>e||Math.abs(ne.current[0]-be[0])>e||Math.abs(ne.current[1]-be[1])>e){const xe=VEe(Z.current,L);let Pe=!1;ce&&(Array.isArray(p)?Pe=p.map(Te=>Te.current):p!=="blending"&&(Pe=[V]));const me=le.current;if(Pe){const Te=GEe(Z.current,L,U,Pe);le.current=Te&&!xe}else le.current=!xe;me!==le.current&&(m?m(!le.current):$.style.display=le.current?"block":"none");const ke=Math.floor(w[0]/2),we=p?ce?[w[0],ke]:[ke-1,0]:w;if($.style.zIndex=`${$Ee(Z.current,L,we)}`,d){const[Te,oe]=[F.width/2,F.height/2],_e=L.projectionMatrix.elements[5]*oe,{isOrthographicCamera:Fe,top:Ue,left:Oe,bottom:ue,right:Q}=L,fe=qEe(L.matrixWorldInverse),Se=Fe?`scale(${_e})translate(${fk(-(Q+Oe)/2)}px,${fk((Ue+ue)/2)}px)`:`translateZ(${_e}px)`;let Ae=Z.current.matrixWorld;c&&(Ae=L.matrixWorldInverse.clone().transpose().copyPosition(Ae).scale(Z.current.scale),Ae.elements[3]=Ae.elements[7]=Ae.elements[11]=0,Ae.elements[15]=1),$.style.width=F.width+"px",$.style.height=F.height+"px",$.style.perspective=Fe?"":`${_e}px`,H.current&&B.current&&(H.current.style.transform=`${Se}${fe}translate(${Te}px,${oe}px)`,B.current.style.transform=XEe(Ae,1/((l||10)/400)))}else{const Te=l===void 0?1:WEe(Z.current,L)*l;$.style.transform=`translate3d(${be[0]}px,${be[1]}px,0) scale(${Te})`}ne.current=be,K.current=L.zoom}}if(!ce&&j.current&&!ie.current)if(d){if(H.current){const be=H.current.children[0];if(be!=null&&be.clientWidth&&be!=null&&be.clientHeight){const{isOrthographicCamera:xe}=L;if(xe||S)P.scale&&(Array.isArray(P.scale)?P.scale instanceof He?j.current.scale.copy(P.scale.clone().divideScalar(1)):j.current.scale.set(1/P.scale[0],1/P.scale[1],1/P.scale[2]):j.current.scale.setScalar(1/P.scale));else{const Pe=(l||10)/400,me=be.clientWidth*Pe,ke=be.clientHeight*Pe;j.current.scale.set(me,ke,1)}ie.current=!0}}}else{const be=$.children[0];if(be!=null&&be.clientWidth&&be!=null&&be.clientHeight){const xe=1/Y.factor,Pe=be.clientWidth*xe,me=be.clientHeight*xe;j.current.scale.set(Pe,me,1),ie.current=!0}j.current.lookAt(pe.camera.position)}});const re=M.useMemo(()=>({vertexShader:d?void 0:`
          /*
            This shader is from the THREE's SpriteMaterial.
            We need to turn the backing plane into a Sprite
            (make it always face the camera) if "transfrom"
            is false.
          */
          #include <common>

          void main() {
            vec2 center = vec2(0., 1.);
            float rotation = 0.0;

            // This is somewhat arbitrary, but it seems to work well
            // Need to figure out how to derive this dynamically if it even matters
            float size = 0.03;

            vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
            vec2 scale;
            scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
            scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );

            bool isPerspective = isPerspectiveMatrix( projectionMatrix );
            if ( isPerspective ) scale *= - mvPosition.z;

            vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
            vec2 rotatedPosition;
            rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
            rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
            mvPosition.xy += rotatedPosition;

            gl_Position = projectionMatrix * mvPosition;
          }
      `,fragmentShader:`
        void main() {
          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
        }
      `}),[d]);return M.createElement("group",fh({},P,{ref:Z}),p&&!ce&&M.createElement("mesh",{castShadow:x,receiveShadow:b,ref:j},S||M.createElement("planeGeometry",null),_||M.createElement("shaderMaterial",{side:Kc,vertexShader:re.vertexShader,fragmentShader:re.fragmentShader})))}),QK=parseInt(ww.replace(/\D+/g,"")),JK=QK>=125?"uv1":"uv2";function KEe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new He,new He,new He],s=new He,o=new He,a=new He,l=new He;function c(_){const S=~~(_.x*r),w=~~(_.y*r),C=~~(_.z*r);return`${S},${w},${C}`}const d=t.index?t.toNonIndexed():t,p=d.attributes.position,m={};for(let _=0,S=p.count/3;_<S;_++){const w=3*_,C=i[0].fromBufferAttribute(p,w+0),A=i[1].fromBufferAttribute(p,w+1),N=i[2].fromBufferAttribute(p,w+2);s.subVectors(N,A),o.subVectors(C,A);const D=new He().crossVectors(s,o).normalize();for(let P=0;P<3;P++){const O=i[P],R=c(O);R in m||(m[R]=[]),m[R].push(D)}}const x=new Float32Array(p.count*3),b=new Wi(x,3,!1);for(let _=0,S=p.count/3;_<S;_++){const w=3*_,C=i[0].fromBufferAttribute(p,w+0),A=i[1].fromBufferAttribute(p,w+1),N=i[2].fromBufferAttribute(p,w+2);s.subVectors(N,A),o.subVectors(C,A),a.crossVectors(s,o).normalize();for(let D=0;D<3;D++){const P=i[D],O=c(P),R=m[O];l.set(0,0,0);for(let L=0,V=R.length;L<V;L++){const F=R[L];a.dot(F)>n&&l.add(F)}l.normalize(),b.setXYZ(w+D,l.x,l.y,l.z)}}return d.setAttribute("normal",b),d}var ZEe=Object.defineProperty,QEe=(t,e,n)=>e in t?ZEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,JEe=(t,e,n)=>(QEe(t,e+"",n),n);class eAe{constructor(){JEe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var tAe=Object.defineProperty,nAe=(t,e,n)=>e in t?tAe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kn=(t,e,n)=>(nAe(t,typeof e!="symbol"?e+"":e,n),n);const TM=new Dx,Qz=new rp,rAe=Math.cos(70*(Math.PI/180)),Jz=(t,e)=>(t%e+e)%e;let iAe=class extends eAe{constructor(e,n){super(),Kn(this,"object"),Kn(this,"domElement"),Kn(this,"enabled",!0),Kn(this,"target",new He),Kn(this,"minDistance",0),Kn(this,"maxDistance",1/0),Kn(this,"minZoom",0),Kn(this,"maxZoom",1/0),Kn(this,"minPolarAngle",0),Kn(this,"maxPolarAngle",Math.PI),Kn(this,"minAzimuthAngle",-1/0),Kn(this,"maxAzimuthAngle",1/0),Kn(this,"enableDamping",!1),Kn(this,"dampingFactor",.05),Kn(this,"enableZoom",!0),Kn(this,"zoomSpeed",1),Kn(this,"enableRotate",!0),Kn(this,"rotateSpeed",1),Kn(this,"enablePan",!0),Kn(this,"panSpeed",1),Kn(this,"screenSpacePanning",!0),Kn(this,"keyPanSpeed",7),Kn(this,"zoomToCursor",!1),Kn(this,"autoRotate",!1),Kn(this,"autoRotateSpeed",2),Kn(this,"reverseOrbit",!1),Kn(this,"reverseHorizontalOrbit",!1),Kn(this,"reverseVerticalOrbit",!1),Kn(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Kn(this,"mouseButtons",{LEFT:kg.ROTATE,MIDDLE:kg.DOLLY,RIGHT:kg.PAN}),Kn(this,"touches",{ONE:Dg.ROTATE,TWO:Dg.DOLLY_PAN}),Kn(this,"target0"),Kn(this,"position0"),Kn(this,"zoom0"),Kn(this,"_domElementKeyEvents",null),Kn(this,"getPolarAngle"),Kn(this,"getAzimuthalAngle"),Kn(this,"setPolarAngle"),Kn(this,"setAzimuthalAngle"),Kn(this,"getDistance"),Kn(this,"getZoomScale"),Kn(this,"listenToKeyEvents"),Kn(this,"stopListenToKeyEvents"),Kn(this,"saveState"),Kn(this,"reset"),Kn(this,"update"),Kn(this,"connect"),Kn(this,"dispose"),Kn(this,"dollyIn"),Kn(this,"dollyOut"),Kn(this,"getScale"),Kn(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=De=>{let Ve=Jz(De,2*Math.PI),lt=d.phi;lt<0&&(lt+=2*Math.PI),Ve<0&&(Ve+=2*Math.PI);let Le=Math.abs(Ve-lt);2*Math.PI-Le<Le&&(Ve<lt?Ve+=2*Math.PI:lt+=2*Math.PI),p.phi=Ve-lt,r.update()},this.setAzimuthalAngle=De=>{let Ve=Jz(De,2*Math.PI),lt=d.theta;lt<0&&(lt+=2*Math.PI),Ve<0&&(Ve+=2*Math.PI);let Le=Math.abs(Ve-lt);2*Math.PI-Le<Le&&(Ve<lt?Ve+=2*Math.PI:lt+=2*Math.PI),p.theta=Ve-lt,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=De=>{De.addEventListener("keydown",ve),this._domElementKeyEvents=De},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ve),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const De=new He,Ve=new He(0,1,0),lt=new $a().setFromUnitVectors(e.up,Ve),Le=lt.clone().invert(),Ne=new He,$e=new $a,ft=2*Math.PI;return function(){const We=r.object.position;lt.setFromUnitVectors(e.up,Ve),Le.copy(lt).invert(),De.copy(We).sub(r.target),De.applyQuaternion(lt),d.setFromVector3(De),r.autoRotate&&l===a.NONE&&Y(U()),r.enableDamping?(d.theta+=p.theta*r.dampingFactor,d.phi+=p.phi*r.dampingFactor):(d.theta+=p.theta,d.phi+=p.phi);let Ke=r.minAzimuthAngle,je=r.maxAzimuthAngle;isFinite(Ke)&&isFinite(je)&&(Ke<-Math.PI?Ke+=ft:Ke>Math.PI&&(Ke-=ft),je<-Math.PI?je+=ft:je>Math.PI&&(je-=ft),Ke<=je?d.theta=Math.max(Ke,Math.min(je,d.theta)):d.theta=d.theta>(Ke+je)/2?Math.max(Ke,d.theta):Math.min(je,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(x,r.dampingFactor):r.target.add(x),r.zoomToCursor&&L||r.object.isOrthographicCamera?d.radius=j(d.radius):d.radius=j(d.radius*m),De.setFromSpherical(d),De.applyQuaternion(Le),We.copy(r.target).add(De),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(p.theta*=1-r.dampingFactor,p.phi*=1-r.dampingFactor,x.multiplyScalar(1-r.dampingFactor)):(p.set(0,0,0),x.set(0,0,0));let et=!1;if(r.zoomToCursor&&L){let pt=null;if(r.object instanceof Js&&r.object.isPerspectiveCamera){const Lt=De.length();pt=j(Lt*m);const wt=Lt-pt;r.object.position.addScaledVector(O,wt),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const Lt=new He(R.x,R.y,0);Lt.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),et=!0;const wt=new He(R.x,R.y,0);wt.unproject(r.object),r.object.position.sub(wt).add(Lt),r.object.updateMatrixWorld(),pt=De.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;pt!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(pt).add(r.object.position):(TM.origin.copy(r.object.position),TM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(TM.direction))<rAe?e.lookAt(r.target):(Qz.setFromNormalAndCoplanarPoint(r.object.up,r.target),TM.intersectPlane(Qz,r.target))))}else r.object instanceof Kd&&r.object.isOrthographicCamera&&(et=m!==1,et&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix()));return m=1,L=!1,et||Ne.distanceToSquared(r.object.position)>c||8*(1-$e.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Ne.copy(r.object.position),$e.copy(r.object.quaternion),et=!1,!0):!1}})(),this.connect=De=>{r.domElement=De,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Ce),r.domElement.addEventListener("pointerdown",Oe),r.domElement.addEventListener("pointercancel",Q),r.domElement.addEventListener("wheel",Ae)},this.dispose=()=>{var De,Ve,lt,Le,Ne,$e;r.domElement&&(r.domElement.style.touchAction="auto"),(De=r.domElement)==null||De.removeEventListener("contextmenu",Ce),(Ve=r.domElement)==null||Ve.removeEventListener("pointerdown",Oe),(lt=r.domElement)==null||lt.removeEventListener("pointercancel",Q),(Le=r.domElement)==null||Le.removeEventListener("wheel",Ae),(Ne=r.domElement)==null||Ne.ownerDocument.removeEventListener("pointermove",ue),($e=r.domElement)==null||$e.ownerDocument.removeEventListener("pointerup",Q),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ve)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new ek,p=new ek;let m=1;const x=new He,b=new Ht,_=new Ht,S=new Ht,w=new Ht,C=new Ht,A=new Ht,N=new Ht,D=new Ht,P=new Ht,O=new He,R=new Ht;let L=!1;const V=[],F={};function U(){return 2*Math.PI/60/60*r.autoRotateSpeed}function W(){return Math.pow(.95,r.zoomSpeed)}function Y(De){r.reverseOrbit||r.reverseHorizontalOrbit?p.theta+=De:p.theta-=De}function $(De){r.reverseOrbit||r.reverseVerticalOrbit?p.phi+=De:p.phi-=De}const X=(()=>{const De=new He;return function(lt,Le){De.setFromMatrixColumn(Le,0),De.multiplyScalar(-lt),x.add(De)}})(),Z=(()=>{const De=new He;return function(lt,Le){r.screenSpacePanning===!0?De.setFromMatrixColumn(Le,1):(De.setFromMatrixColumn(Le,0),De.crossVectors(r.object.up,De)),De.multiplyScalar(lt),x.add(De)}})(),K=(()=>{const De=new He;return function(lt,Le){const Ne=r.domElement;if(Ne&&r.object instanceof Js&&r.object.isPerspectiveCamera){const $e=r.object.position;De.copy($e).sub(r.target);let ft=De.length();ft*=Math.tan(r.object.fov/2*Math.PI/180),X(2*lt*ft/Ne.clientHeight,r.object.matrix),Z(2*Le*ft/Ne.clientHeight,r.object.matrix)}else Ne&&r.object instanceof Kd&&r.object.isOrthographicCamera?(X(lt*(r.object.right-r.object.left)/r.object.zoom/Ne.clientWidth,r.object.matrix),Z(Le*(r.object.top-r.object.bottom)/r.object.zoom/Ne.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function ne(De){r.object instanceof Js&&r.object.isPerspectiveCamera||r.object instanceof Kd&&r.object.isOrthographicCamera?m=De:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function H(De){ne(m/De)}function B(De){ne(m*De)}function G(De){if(!r.zoomToCursor||!r.domElement)return;L=!0;const Ve=r.domElement.getBoundingClientRect(),lt=De.clientX-Ve.left,Le=De.clientY-Ve.top,Ne=Ve.width,$e=Ve.height;R.x=lt/Ne*2-1,R.y=-(Le/$e)*2+1,O.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function j(De){return Math.max(r.minDistance,Math.min(r.maxDistance,De))}function ie(De){b.set(De.clientX,De.clientY)}function ce(De){G(De),N.set(De.clientX,De.clientY)}function te(De){w.set(De.clientX,De.clientY)}function se(De){_.set(De.clientX,De.clientY),S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ve=r.domElement;Ve&&(Y(2*Math.PI*S.x/Ve.clientHeight),$(2*Math.PI*S.y/Ve.clientHeight)),b.copy(_),r.update()}function le(De){D.set(De.clientX,De.clientY),P.subVectors(D,N),P.y>0?H(W()):P.y<0&&B(W()),N.copy(D),r.update()}function re(De){C.set(De.clientX,De.clientY),A.subVectors(C,w).multiplyScalar(r.panSpeed),K(A.x,A.y),w.copy(C),r.update()}function pe(De){G(De),De.deltaY<0?B(W()):De.deltaY>0&&H(W()),r.update()}function be(De){let Ve=!1;switch(De.code){case r.keys.UP:K(0,r.keyPanSpeed),Ve=!0;break;case r.keys.BOTTOM:K(0,-r.keyPanSpeed),Ve=!0;break;case r.keys.LEFT:K(r.keyPanSpeed,0),Ve=!0;break;case r.keys.RIGHT:K(-r.keyPanSpeed,0),Ve=!0;break}Ve&&(De.preventDefault(),r.update())}function xe(){if(V.length==1)b.set(V[0].pageX,V[0].pageY);else{const De=.5*(V[0].pageX+V[1].pageX),Ve=.5*(V[0].pageY+V[1].pageY);b.set(De,Ve)}}function Pe(){if(V.length==1)w.set(V[0].pageX,V[0].pageY);else{const De=.5*(V[0].pageX+V[1].pageX),Ve=.5*(V[0].pageY+V[1].pageY);w.set(De,Ve)}}function me(){const De=V[0].pageX-V[1].pageX,Ve=V[0].pageY-V[1].pageY,lt=Math.sqrt(De*De+Ve*Ve);N.set(0,lt)}function ke(){r.enableZoom&&me(),r.enablePan&&Pe()}function we(){r.enableZoom&&me(),r.enableRotate&&xe()}function Te(De){if(V.length==1)_.set(De.pageX,De.pageY);else{const lt=ut(De),Le=.5*(De.pageX+lt.x),Ne=.5*(De.pageY+lt.y);_.set(Le,Ne)}S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ve=r.domElement;Ve&&(Y(2*Math.PI*S.x/Ve.clientHeight),$(2*Math.PI*S.y/Ve.clientHeight)),b.copy(_)}function oe(De){if(V.length==1)C.set(De.pageX,De.pageY);else{const Ve=ut(De),lt=.5*(De.pageX+Ve.x),Le=.5*(De.pageY+Ve.y);C.set(lt,Le)}A.subVectors(C,w).multiplyScalar(r.panSpeed),K(A.x,A.y),w.copy(C)}function _e(De){const Ve=ut(De),lt=De.pageX-Ve.x,Le=De.pageY-Ve.y,Ne=Math.sqrt(lt*lt+Le*Le);D.set(0,Ne),P.set(0,Math.pow(D.y/N.y,r.zoomSpeed)),H(P.y),N.copy(D)}function Fe(De){r.enableZoom&&_e(De),r.enablePan&&oe(De)}function Ue(De){r.enableZoom&&_e(De),r.enableRotate&&Te(De)}function Oe(De){var Ve,lt;r.enabled!==!1&&(V.length===0&&((Ve=r.domElement)==null||Ve.ownerDocument.addEventListener("pointermove",ue),(lt=r.domElement)==null||lt.ownerDocument.addEventListener("pointerup",Q)),Ye(De),De.pointerType==="touch"?qe(De):fe(De))}function ue(De){r.enabled!==!1&&(De.pointerType==="touch"?Ee(De):Se(De))}function Q(De){var Ve,lt,Le;Ze(De),V.length===0&&((Ve=r.domElement)==null||Ve.releasePointerCapture(De.pointerId),(lt=r.domElement)==null||lt.ownerDocument.removeEventListener("pointermove",ue),(Le=r.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",Q)),r.dispatchEvent(o),l=a.NONE}function fe(De){let Ve;switch(De.button){case 0:Ve=r.mouseButtons.LEFT;break;case 1:Ve=r.mouseButtons.MIDDLE;break;case 2:Ve=r.mouseButtons.RIGHT;break;default:Ve=-1}switch(Ve){case kg.DOLLY:if(r.enableZoom===!1)return;ce(De),l=a.DOLLY;break;case kg.ROTATE:if(De.ctrlKey||De.metaKey||De.shiftKey){if(r.enablePan===!1)return;te(De),l=a.PAN}else{if(r.enableRotate===!1)return;ie(De),l=a.ROTATE}break;case kg.PAN:if(De.ctrlKey||De.metaKey||De.shiftKey){if(r.enableRotate===!1)return;ie(De),l=a.ROTATE}else{if(r.enablePan===!1)return;te(De),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Se(De){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;se(De);break;case a.DOLLY:if(r.enableZoom===!1)return;le(De);break;case a.PAN:if(r.enablePan===!1)return;re(De);break}}function Ae(De){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(De.preventDefault(),r.dispatchEvent(s),pe(De),r.dispatchEvent(o))}function ve(De){r.enabled===!1||r.enablePan===!1||be(De)}function qe(De){switch(it(De),V.length){case 1:switch(r.touches.ONE){case Dg.ROTATE:if(r.enableRotate===!1)return;xe(),l=a.TOUCH_ROTATE;break;case Dg.PAN:if(r.enablePan===!1)return;Pe(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Dg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ke(),l=a.TOUCH_DOLLY_PAN;break;case Dg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;we(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ee(De){switch(it(De),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Te(De),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;oe(De),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Fe(De),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ue(De),r.update();break;default:l=a.NONE}}function Ce(De){r.enabled!==!1&&De.preventDefault()}function Ye(De){V.push(De)}function Ze(De){delete F[De.pointerId];for(let Ve=0;Ve<V.length;Ve++)if(V[Ve].pointerId==De.pointerId){V.splice(Ve,1);return}}function it(De){let Ve=F[De.pointerId];Ve===void 0&&(Ve=new Ht,F[De.pointerId]=Ve),Ve.set(De.pageX,De.pageY)}function ut(De){const Ve=De.pointerId===V[0].pointerId?V[1]:V[0];return F[Ve.pointerId]}this.dollyIn=(De=W())=>{B(De),r.update()},this.dollyOut=(De=W())=>{H(De),r.update()},this.getScale=()=>m,this.setScale=De=>{ne(De),r.update()},this.getZoomScale=()=>W(),n!==void 0&&this.connect(n),this.update()}};const eF=new Eo,CM=new He;class G9 extends HC{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new Rn(e,3)),this.setAttribute("uv",new Rn(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,r=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),r.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const r=new F5(n,6,1);return this.setAttribute("instanceStart",new nu(r,3,0)),this.setAttribute("instanceEnd",new nu(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,n=3){let r;e instanceof Float32Array?r=e:Array.isArray(e)&&(r=new Float32Array(e));const i=new F5(r,n*2,1);return this.setAttribute("instanceColorStart",new nu(i,n,0)),this.setAttribute("instanceColorEnd",new nu(i,n,n)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new M9(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Eo);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),eF.setFromBufferAttribute(n),this.boundingBox.union(eF))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wo),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)CM.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(CM)),CM.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(CM));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class eZ extends G9{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,r=new Float32Array(2*n);for(let i=0;i<n;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e,n=3){const r=e.length-n,i=new Float32Array(2*r);if(n===3)for(let s=0;s<r;s+=n)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];else for(let s=0;s<r;s+=n)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5],i[2*s+6]=e[s+6],i[2*s+7]=e[s+7];return super.setColors(i,n),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class W9 extends uu{constructor(e){super({type:"LineMaterial",uniforms:PS.clone(PS.merge([vn.common,vn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Ht(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
				#include <common>
				#include <fog_pars_vertex>
				#include <logdepthbuf_pars_vertex>
				#include <clipping_planes_pars_vertex>

				uniform float linewidth;
				uniform vec2 resolution;

				attribute vec3 instanceStart;
				attribute vec3 instanceEnd;

				#ifdef USE_COLOR
					#ifdef USE_LINE_COLOR_ALPHA
						varying vec4 vLineColor;
						attribute vec4 instanceColorStart;
						attribute vec4 instanceColorEnd;
					#else
						varying vec3 vLineColor;
						attribute vec3 instanceColorStart;
						attribute vec3 instanceColorEnd;
					#endif
				#endif

				#ifdef WORLD_UNITS

					varying vec4 worldPos;
					varying vec3 worldStart;
					varying vec3 worldEnd;

					#ifdef USE_DASH

						varying vec2 vUv;

					#endif

				#else

					varying vec2 vUv;

				#endif

				#ifdef USE_DASH

					uniform float dashScale;
					attribute float instanceDistanceStart;
					attribute float instanceDistanceEnd;
					varying float vLineDistance;

				#endif

				void trimSegment( const in vec4 start, inout vec4 end ) {

					// trim end segment so it terminates between the camera plane and the near plane

					// conservative estimate of the near plane
					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
					float nearEstimate = - 0.5 * b / a;

					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

					end.xyz = mix( start.xyz, end.xyz, alpha );

				}

				void main() {

					#ifdef USE_COLOR

						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

					#endif

					#ifdef USE_DASH

						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
						vUv = uv;

					#endif

					float aspect = resolution.x / resolution.y;

					// camera space
					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

					#ifdef WORLD_UNITS

						worldStart = start.xyz;
						worldEnd = end.xyz;

					#else

						vUv = uv;

					#endif

					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
					// perhaps there is a more elegant solution -- WestLangley

					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

					if ( perspective ) {

						if ( start.z < 0.0 && end.z >= 0.0 ) {

							trimSegment( start, end );

						} else if ( end.z < 0.0 && start.z >= 0.0 ) {

							trimSegment( end, start );

						}

					}

					// clip space
					vec4 clipStart = projectionMatrix * start;
					vec4 clipEnd = projectionMatrix * end;

					// ndc space
					vec3 ndcStart = clipStart.xyz / clipStart.w;
					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;

					// direction
					vec2 dir = ndcEnd.xy - ndcStart.xy;

					// account for clip-space aspect ratio
					dir.x *= aspect;
					dir = normalize( dir );

					#ifdef WORLD_UNITS

						// get the offset direction as perpendicular to the view vector
						vec3 worldDir = normalize( end.xyz - start.xyz );
						vec3 offset;
						if ( position.y < 0.5 ) {

							offset = normalize( cross( start.xyz, worldDir ) );

						} else {

							offset = normalize( cross( end.xyz, worldDir ) );

						}

						// sign flip
						if ( position.x < 0.0 ) offset *= - 1.0;

						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );

						// don't extend the line if we're rendering dashes because we
						// won't be rendering the endcaps
						#ifndef USE_DASH

							// extend the line bounds to encompass  endcaps
							start.xyz += - worldDir * linewidth * 0.5;
							end.xyz += worldDir * linewidth * 0.5;

							// shift the position of the quad so it hugs the forward edge of the line
							offset.xy -= dir * forwardOffset;
							offset.z += 0.5;

						#endif

						// endcaps
						if ( position.y > 1.0 || position.y < 0.0 ) {

							offset.xy += dir * 2.0 * forwardOffset;

						}

						// adjust for linewidth
						offset *= linewidth * 0.5;

						// set the world position
						worldPos = ( position.y < 0.5 ) ? start : end;
						worldPos.xyz += offset;

						// project the worldpos
						vec4 clip = projectionMatrix * worldPos;

						// shift the depth of the projected points so the line
						// segments overlap neatly
						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
						clip.z = clipPose.z * clip.w;

					#else

						vec2 offset = vec2( dir.y, - dir.x );
						// undo aspect ratio adjustment
						dir.x /= aspect;
						offset.x /= aspect;

						// sign flip
						if ( position.x < 0.0 ) offset *= - 1.0;

						// endcaps
						if ( position.y < 0.0 ) {

							offset += - dir;

						} else if ( position.y > 1.0 ) {

							offset += dir;

						}

						// adjust for linewidth
						offset *= linewidth;

						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
						offset /= resolution.y;

						// select end
						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;

						// back to clip space
						offset *= clip.w;

						clip.xy += offset;

					#endif

					gl_Position = clip;

					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

					#include <logdepthbuf_vertex>
					#include <clipping_planes_vertex>
					#include <fog_vertex>

				}
			`,fragmentShader:`
				uniform vec3 diffuse;
				uniform float opacity;
				uniform float linewidth;

				#ifdef USE_DASH

					uniform float dashOffset;
					uniform float dashSize;
					uniform float gapSize;

				#endif

				varying float vLineDistance;

				#ifdef WORLD_UNITS

					varying vec4 worldPos;
					varying vec3 worldStart;
					varying vec3 worldEnd;

					#ifdef USE_DASH

						varying vec2 vUv;

					#endif

				#else

					varying vec2 vUv;

				#endif

				#include <common>
				#include <fog_pars_fragment>
				#include <logdepthbuf_pars_fragment>
				#include <clipping_planes_pars_fragment>

				#ifdef USE_COLOR
					#ifdef USE_LINE_COLOR_ALPHA
						varying vec4 vLineColor;
					#else
						varying vec3 vLineColor;
					#endif
				#endif

				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {

					float mua;
					float mub;

					vec3 p13 = p1 - p3;
					vec3 p43 = p4 - p3;

					vec3 p21 = p2 - p1;

					float d1343 = dot( p13, p43 );
					float d4321 = dot( p43, p21 );
					float d1321 = dot( p13, p21 );
					float d4343 = dot( p43, p43 );
					float d2121 = dot( p21, p21 );

					float denom = d2121 * d4343 - d4321 * d4321;

					float numer = d1343 * d4321 - d1321 * d4343;

					mua = numer / denom;
					mua = clamp( mua, 0.0, 1.0 );
					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
					mub = clamp( mub, 0.0, 1.0 );

					return vec2( mua, mub );

				}

				void main() {

					#include <clipping_planes_fragment>

					#ifdef USE_DASH

						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

					#endif

					float alpha = opacity;

					#ifdef WORLD_UNITS

						// Find the closest points on the view ray and the line segment
						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
						vec3 lineDir = worldEnd - worldStart;
						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );

						vec3 p1 = worldStart + lineDir * params.x;
						vec3 p2 = rayEnd * params.y;
						vec3 delta = p1 - p2;
						float len = length( delta );
						float norm = len / linewidth;

						#ifndef USE_DASH

							#ifdef USE_ALPHA_TO_COVERAGE

								float dnorm = fwidth( norm );
								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );

							#else

								if ( norm > 0.5 ) {

									discard;

								}

							#endif

						#endif

					#else

						#ifdef USE_ALPHA_TO_COVERAGE

							// artifacts appear on some hardware if a derivative is taken within a conditional
							float a = vUv.x;
							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
							float len2 = a * a + b * b;
							float dlen = fwidth( len2 );

							if ( abs( vUv.y ) > 1.0 ) {

								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

							}

						#else

							if ( abs( vUv.y ) > 1.0 ) {

								float a = vUv.x;
								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
								float len2 = a * a + b * b;

								if ( len2 > 1.0 ) discard;

							}

						#endif

					#endif

					vec4 diffuseColor = vec4( diffuse, alpha );
					#ifdef USE_COLOR
						#ifdef USE_LINE_COLOR_ALPHA
							diffuseColor *= vLineColor;
						#else
							diffuseColor.rgb *= vLineColor;
						#endif
					#endif

					#include <logdepthbuf_fragment>

					gl_FragColor = diffuseColor;

					#include <tonemapping_fragment>
					#include <${QK>=154?"colorspace_fragment":"encodings_fragment"}>
					#include <fog_fragment>
					#include <premultiplied_alpha_fragment>

				}
			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const Z6=new fi,tF=new He,nF=new He,Ba=new fi,Ha=new fi,Lf=new fi,Q6=new He,J6=new sr,Ga=new MK,rF=new He,EM=new Eo,AM=new Wo,jf=new fi;let Yf,nx;function iF(t,e,n){return jf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),jf.multiplyScalar(1/jf.w),jf.x=nx/n.width,jf.y=nx/n.height,jf.applyMatrix4(t.projectionMatrixInverse),jf.multiplyScalar(1/jf.w),Math.abs(Math.max(jf.x,jf.y))}function sAe(t,e){const n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,s=r.attributes.instanceEnd,o=Math.min(r.instanceCount,i.count);for(let a=0,l=o;a<l;a++){Ga.start.fromBufferAttribute(i,a),Ga.end.fromBufferAttribute(s,a),Ga.applyMatrix4(n);const c=new He,d=new He;Yf.distanceSqToSegment(Ga.start,Ga.end,d,c),d.distanceTo(c)<nx*.5&&e.push({point:d,pointOnLine:c,distance:Yf.origin.distanceTo(d),object:t,face:null,faceIndex:a,uv:null,[JK]:null})}}function oAe(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,o=t.matrixWorld,a=t.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,d=Math.min(a.instanceCount,l.count),p=-e.near;Yf.at(1,Lf),Lf.w=1,Lf.applyMatrix4(e.matrixWorldInverse),Lf.applyMatrix4(r),Lf.multiplyScalar(1/Lf.w),Lf.x*=s.x/2,Lf.y*=s.y/2,Lf.z=0,Q6.copy(Lf),J6.multiplyMatrices(e.matrixWorldInverse,o);for(let m=0,x=d;m<x;m++){if(Ba.fromBufferAttribute(l,m),Ha.fromBufferAttribute(c,m),Ba.w=1,Ha.w=1,Ba.applyMatrix4(J6),Ha.applyMatrix4(J6),Ba.z>p&&Ha.z>p)continue;if(Ba.z>p){const A=Ba.z-Ha.z,N=(Ba.z-p)/A;Ba.lerp(Ha,N)}else if(Ha.z>p){const A=Ha.z-Ba.z,N=(Ha.z-p)/A;Ha.lerp(Ba,N)}Ba.applyMatrix4(r),Ha.applyMatrix4(r),Ba.multiplyScalar(1/Ba.w),Ha.multiplyScalar(1/Ha.w),Ba.x*=s.x/2,Ba.y*=s.y/2,Ha.x*=s.x/2,Ha.y*=s.y/2,Ga.start.copy(Ba),Ga.start.z=0,Ga.end.copy(Ha),Ga.end.z=0;const _=Ga.closestPointToPointParameter(Q6,!0);Ga.at(_,rF);const S=TY.lerp(Ba.z,Ha.z,_),w=S>=-1&&S<=1,C=Q6.distanceTo(rF)<nx*.5;if(w&&C){Ga.start.fromBufferAttribute(l,m),Ga.end.fromBufferAttribute(c,m),Ga.start.applyMatrix4(o),Ga.end.applyMatrix4(o);const A=new He,N=new He;Yf.distanceSqToSegment(Ga.start,Ga.end,N,A),n.push({point:N,pointOnLine:A,distance:Yf.origin.distanceTo(N),object:t,face:null,faceIndex:m,uv:null,[JK]:null})}}}class tZ extends Fs{constructor(e=new G9,n=new W9({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let o=0,a=0,l=n.count;o<l;o++,a+=2)tF.fromBufferAttribute(n,o),nF.fromBufferAttribute(r,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+tF.distanceTo(nF);const s=new F5(i,2,1);return e.setAttribute("instanceDistanceStart",new nu(s,1,0)),e.setAttribute("instanceDistanceEnd",new nu(s,1,1)),this}raycast(e,n){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Yf=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;nx=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),AM.copy(a.boundingSphere).applyMatrix4(o);let c;if(r)c=nx*.5;else{const p=Math.max(i.near,AM.distanceToPoint(Yf.origin));c=iF(i,p,l.resolution)}if(AM.radius+=c,Yf.intersectsSphere(AM)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),EM.copy(a.boundingBox).applyMatrix4(o);let d;if(r)d=nx*.5;else{const p=Math.max(i.near,EM.distanceToPoint(Yf.origin));d=iF(i,p,l.resolution)}EM.expandByScalar(d),Yf.intersectsBox(EM)!==!1&&(r?sAe(this,n):oAe(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(Z6),this.material.uniforms.resolution.value.set(Z6.z,Z6.w))}}class aAe extends tZ{constructor(e=new eZ,n=new W9({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const lAe=M.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:o,dashed:a,...l},c){var d,p;const m=Mc(w=>w.size),x=M.useMemo(()=>o?new tZ:new aAe,[o]),[b]=M.useState(()=>new W9),_=(r==null||(d=r[0])==null?void 0:d.length)===4?4:3,S=M.useMemo(()=>{const w=o?new G9:new eZ,C=e.map(A=>{const N=Array.isArray(A);return A instanceof He||A instanceof fi?[A.x,A.y,A.z]:A instanceof Ht?[A.x,A.y,0]:N&&A.length===3?[A[0],A[1],A[2]]:N&&A.length===2?[A[0],A[1],0]:A});if(w.setPositions(C.flat()),r){n=16777215;const A=r.map(N=>N instanceof Sn?N.toArray():N);w.setColors(A.flat(),_)}return w},[e,o,r,_]);return M.useLayoutEffect(()=>{x.computeLineDistances()},[e,x]),M.useLayoutEffect(()=>{a?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[a,b]),M.useEffect(()=>()=>{S.dispose(),b.dispose()},[S]),M.createElement("primitive",fh({object:x,ref:c},l),M.createElement("primitive",{object:S,attach:"geometry"}),M.createElement("primitive",fh({object:b,attach:"material",color:n,vertexColors:!!r,resolution:[m.width,m.height],linewidth:(p=i??s)!==null&&p!==void 0?p:1,dashed:a,transparent:_===4},l)))});function cAe(){var t=Object.create(null);function e(i,s){var o=i.id,a=i.name,l=i.dependencies;l===void 0&&(l=[]);var c=i.init;c===void 0&&(c=function(){});var d=i.getTransferables;if(d===void 0&&(d=null),!t[o])try{l=l.map(function(m){return m&&m.isWorkerModule&&(e(m,function(x){if(x instanceof Error)throw x}),m=t[m.id].value),m}),c=r("<"+a+">.init",c),d&&(d=r("<"+a+">.getTransferables",d));var p=null;typeof c=="function"?p=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[o]={id:o,value:p,getTransferables:d},s(p)}catch(m){m&&m.noLog||console.error(m),s(m)}}function n(i,s){var o,a=i.id,l=i.args;(!t[a]||typeof t[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var c=(o=t[a]).value.apply(o,l);c&&typeof c.then=="function"?c.then(d,function(p){return s(p instanceof Error?p:new Error(""+p))}):d(c)}catch(p){s(p)}function d(p){try{var m=t[a].getTransferables&&t[a].getTransferables(p);(!m||!Array.isArray(m)||!m.length)&&(m=void 0),s(p,m)}catch(x){console.error(x),s(x)}}}function r(i,s){var o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/

troikaDefine(
`+s+`
)`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof c=="function"}})}),a==="callModule"&&n(l,function(c,d){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},d||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function uAe(t){var e=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,n);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var n=t.dependencies,r=t.init;n=Array.isArray(n)?n.map(function(s){return s&&(s=s.onMainThread||s,s._getInitResult&&(s=s._getInitResult())),s}):[];var i=Promise.all(n).then(function(s){return r.apply(null,s)});return e._getInitResult=function(){return i},i},e}var nZ=function(){var t=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),t=!0}catch(n){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+n.message+"]")}return nZ=function(){return t},t},dAe=0,fAe=0,eN=!1,Q_=Object.create(null),J_=Object.create(null),hk=Object.create(null);function Hy(t){if((!t||typeof t.init!="function")&&!eN)throw new Error("requires `options.init` function");var e=t.dependencies,n=t.init,r=t.getTransferables,i=t.workerId,s=uAe(t);i==null&&(i="#default");var o="workerModule"+ ++dAe,a=t.name||o,l=null;e=e&&e.map(function(d){return typeof d=="function"&&!d.workerModuleData&&(eN=!0,d=Hy({workerId:i,name:"<"+a+"> function dependency: "+d.name,init:`function(){return (
`+YM(d)+`
)}`}),eN=!1),d&&d.workerModuleData&&(d=d.workerModuleData),d});function c(){for(var d=[],p=arguments.length;p--;)d[p]=arguments[p];if(!nZ())return s.apply(void 0,d);if(!l){l=sF(i,"registerModule",c.workerModuleData);var m=function(){l=null,J_[i].delete(m)};(J_[i]||(J_[i]=new Set)).add(m)}return l.then(function(x){var b=x.isCallable;if(b)return sF(i,"callModule",{id:o,args:d});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:o,name:a,dependencies:e,init:YM(n),getTransferables:r&&YM(r)},c.onMainThread=s,c}function hAe(t){J_[t]&&J_[t].forEach(function(e){e()}),Q_[t]&&(Q_[t].terminate(),delete Q_[t])}function YM(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function pAe(t){var e=Q_[t];if(!e){var n=YM(cAe);e=Q_[t]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+t.replace(/\*/g,"")+` **/

;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(r){var i=r.data,s=i.messageId,o=hk[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete hk[s],o(i)}}return e}function sF(t,e,n){return new Promise(function(r,i){var s=++fAe;hk[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},pAe(t).postMessage({messageId:s,action:e,data:n})})}function rZ(){var t=(function(e){function n(ne,H,B,G,j,ie,ce,te){var se=1-ce;te.x=se*se*ne+2*se*ce*B+ce*ce*j,te.y=se*se*H+2*se*ce*G+ce*ce*ie}function r(ne,H,B,G,j,ie,ce,te,se,le){var re=1-se;le.x=re*re*re*ne+3*re*re*se*B+3*re*se*se*j+se*se*se*ce,le.y=re*re*re*H+3*re*re*se*G+3*re*se*se*ie+se*se*se*te}function i(ne,H){for(var B=/([MLQCZ])([^MLQCZ]*)/g,G,j,ie,ce,te;G=B.exec(ne);){var se=G[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(le){return parseFloat(le)});switch(G[1]){case"M":ce=j=se[0],te=ie=se[1];break;case"L":(se[0]!==ce||se[1]!==te)&&H("L",ce,te,ce=se[0],te=se[1]);break;case"Q":{H("Q",ce,te,ce=se[2],te=se[3],se[0],se[1]);break}case"C":{H("C",ce,te,ce=se[4],te=se[5],se[0],se[1],se[2],se[3]);break}case"Z":(ce!==j||te!==ie)&&H("L",ce,te,j,ie);break}}}function s(ne,H,B){B===void 0&&(B=16);var G={x:0,y:0};i(ne,function(j,ie,ce,te,se,le,re,pe,be){switch(j){case"L":H(ie,ce,te,se);break;case"Q":{for(var xe=ie,Pe=ce,me=1;me<B;me++)n(ie,ce,le,re,te,se,me/(B-1),G),H(xe,Pe,G.x,G.y),xe=G.x,Pe=G.y;break}case"C":{for(var ke=ie,we=ce,Te=1;Te<B;Te++)r(ie,ce,le,re,pe,be,te,se,Te/(B-1),G),H(ke,we,G.x,G.y),ke=G.x,we=G.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",a="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function d(ne,H){var B=ne.getContext?ne.getContext("webgl",c):ne,G=l.get(B);if(!G){let ke=function(Ue){var Oe=ie[Ue];if(!Oe&&(Oe=ie[Ue]=B.getExtension(Ue),!Oe))throw new Error(Ue+" not supported");return Oe},we=function(Ue,Oe){var ue=B.createShader(Oe);return B.shaderSource(ue,Ue),B.compileShader(ue),ue},Te=function(Ue,Oe,ue,Q){if(!ce[Ue]){var fe={},Se={},Ae=B.createProgram();B.attachShader(Ae,we(Oe,B.VERTEX_SHADER)),B.attachShader(Ae,we(ue,B.FRAGMENT_SHADER)),B.linkProgram(Ae),ce[Ue]={program:Ae,transaction:function(qe){B.useProgram(Ae),qe({setUniform:function(Ce,Ye){for(var Ze=[],it=arguments.length-2;it-- >0;)Ze[it]=arguments[it+2];var ut=Se[Ye]||(Se[Ye]=B.getUniformLocation(Ae,Ye));B["uniform"+Ce].apply(B,[ut].concat(Ze))},setAttribute:function(Ce,Ye,Ze,it,ut){var De=fe[Ce];De||(De=fe[Ce]={buf:B.createBuffer(),loc:B.getAttribLocation(Ae,Ce),data:null}),B.bindBuffer(B.ARRAY_BUFFER,De.buf),B.vertexAttribPointer(De.loc,Ye,B.FLOAT,!1,0,0),B.enableVertexAttribArray(De.loc),j?B.vertexAttribDivisor(De.loc,it):ke("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(De.loc,it),ut!==De.data&&(B.bufferData(B.ARRAY_BUFFER,ut,Ze),De.data=ut)}})}}}ce[Ue].transaction(Q)},oe=function(Ue,Oe){se++;try{B.activeTexture(B.TEXTURE0+se);var ue=te[Ue];ue||(ue=te[Ue]=B.createTexture(),B.bindTexture(B.TEXTURE_2D,ue),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.NEAREST),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.NEAREST)),B.bindTexture(B.TEXTURE_2D,ue),Oe(ue,se)}finally{se--}},_e=function(Ue,Oe,ue){var Q=B.createFramebuffer();le.push(Q),B.bindFramebuffer(B.FRAMEBUFFER,Q),B.activeTexture(B.TEXTURE0+Oe),B.bindTexture(B.TEXTURE_2D,Ue),B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Ue,0);try{ue(Q)}finally{B.deleteFramebuffer(Q),B.bindFramebuffer(B.FRAMEBUFFER,le[--le.length-1]||null)}},Fe=function(){ie={},ce={},te={},se=-1,le.length=0};var re=ke,pe=we,be=Te,xe=oe,Pe=_e,me=Fe,j=typeof WebGL2RenderingContext<"u"&&B instanceof WebGL2RenderingContext,ie={},ce={},te={},se=-1,le=[];B.canvas.addEventListener("webglcontextlost",function(Ue){Fe(),Ue.preventDefault()},!1),l.set(B,G={gl:B,isWebGL2:j,getExtension:ke,withProgram:Te,withTexture:oe,withTextureFramebuffer:_e,handleContextLoss:Fe})}H(G)}function p(ne,H,B,G,j,ie,ce,te){ce===void 0&&(ce=15),te===void 0&&(te=null),d(ne,function(se){var le=se.gl,re=se.withProgram,pe=se.withTexture;pe("copy",function(be,xe){le.texImage2D(le.TEXTURE_2D,0,le.RGBA,j,ie,0,le.RGBA,le.UNSIGNED_BYTE,H),re("copy",o,a,function(Pe){var me=Pe.setUniform,ke=Pe.setAttribute;ke("aUV",2,le.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),me("1i","image",xe),le.bindFramebuffer(le.FRAMEBUFFER,te||null),le.disable(le.BLEND),le.colorMask(ce&8,ce&4,ce&2,ce&1),le.viewport(B,G,j,ie),le.scissor(B,G,j,ie),le.drawArrays(le.TRIANGLES,0,3)})})})}function m(ne,H,B){var G=ne.width,j=ne.height;d(ne,function(ie){var ce=ie.gl,te=new Uint8Array(G*j*4);ce.readPixels(0,0,G,j,ce.RGBA,ce.UNSIGNED_BYTE,te),ne.width=H,ne.height=B,p(ce,te,0,0,G,j)})}var x=Object.freeze({__proto__:null,withWebGLContext:d,renderImageData:p,resizeWebGLCanvasWithoutClearing:m});function b(ne,H,B,G,j,ie){ie===void 0&&(ie=1);var ce=new Uint8Array(ne*H),te=G[2]-G[0],se=G[3]-G[1],le=[];s(B,function(ke,we,Te,oe){le.push({x1:ke,y1:we,x2:Te,y2:oe,minX:Math.min(ke,Te),minY:Math.min(we,oe),maxX:Math.max(ke,Te),maxY:Math.max(we,oe)})}),le.sort(function(ke,we){return ke.maxX-we.maxX});for(var re=0;re<ne;re++)for(var pe=0;pe<H;pe++){var be=Pe(G[0]+te*(re+.5)/ne,G[1]+se*(pe+.5)/H),xe=Math.pow(1-Math.abs(be)/j,ie)/2;be<0&&(xe=1-xe),xe=Math.max(0,Math.min(255,Math.round(xe*255))),ce[pe*ne+re]=xe}return ce;function Pe(ke,we){for(var Te=1/0,oe=1/0,_e=le.length;_e--;){var Fe=le[_e];if(Fe.maxX+oe<=ke)break;if(ke+oe>Fe.minX&&we-oe<Fe.maxY&&we+oe>Fe.minY){var Ue=w(ke,we,Fe.x1,Fe.y1,Fe.x2,Fe.y2);Ue<Te&&(Te=Ue,oe=Math.sqrt(Te))}}return me(ke,we)&&(oe=-oe),oe}function me(ke,we){for(var Te=0,oe=le.length;oe--;){var _e=le[oe];if(_e.maxX<=ke)break;var Fe=_e.y1>we!=_e.y2>we&&ke<(_e.x2-_e.x1)*(we-_e.y1)/(_e.y2-_e.y1)+_e.x1;Fe&&(Te+=_e.y1<_e.y2?1:-1)}return Te!==0}}function _(ne,H,B,G,j,ie,ce,te,se,le){ie===void 0&&(ie=1),te===void 0&&(te=0),se===void 0&&(se=0),le===void 0&&(le=0),S(ne,H,B,G,j,ie,ce,null,te,se,le)}function S(ne,H,B,G,j,ie,ce,te,se,le,re){ie===void 0&&(ie=1),se===void 0&&(se=0),le===void 0&&(le=0),re===void 0&&(re=0);for(var pe=b(ne,H,B,G,j,ie),be=new Uint8Array(pe.length*4),xe=0;xe<pe.length;xe++)be[xe*4+re]=pe[xe];p(ce,be,se,le,ne,H,1<<3-re,te)}function w(ne,H,B,G,j,ie){var ce=j-B,te=ie-G,se=ce*ce+te*te,le=se?Math.max(0,Math.min(1,((ne-B)*ce+(H-G)*te)/se)):0,re=ne-(B+le*ce),pe=H-(G+le*te);return re*re+pe*pe}var C=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:_,generateIntoFramebuffer:S}),A="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",N="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",D="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",P=new Float32Array([0,0,2,0,0,2]),O=null,R=!1,L={},V=new WeakMap;function F(ne){if(!R&&!$(ne))throw new Error("WebGL generation not supported")}function U(ne,H,B,G,j,ie,ce){if(ie===void 0&&(ie=1),ce===void 0&&(ce=null),!ce&&(ce=O,!ce)){var te=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!te)throw new Error("OffscreenCanvas or DOM canvas not supported");ce=O=te.getContext("webgl",{depth:!1})}F(ce);var se=new Uint8Array(ne*H*4);d(ce,function(be){var xe=be.gl,Pe=be.withTexture,me=be.withTextureFramebuffer;Pe("readable",function(ke,we){xe.texImage2D(xe.TEXTURE_2D,0,xe.RGBA,ne,H,0,xe.RGBA,xe.UNSIGNED_BYTE,null),me(ke,we,function(Te){Y(ne,H,B,G,j,ie,xe,Te,0,0,0),xe.readPixels(0,0,ne,H,xe.RGBA,xe.UNSIGNED_BYTE,se)})})});for(var le=new Uint8Array(ne*H),re=0,pe=0;re<se.length;re+=4)le[pe++]=se[re];return le}function W(ne,H,B,G,j,ie,ce,te,se,le){ie===void 0&&(ie=1),te===void 0&&(te=0),se===void 0&&(se=0),le===void 0&&(le=0),Y(ne,H,B,G,j,ie,ce,null,te,se,le)}function Y(ne,H,B,G,j,ie,ce,te,se,le,re){ie===void 0&&(ie=1),se===void 0&&(se=0),le===void 0&&(le=0),re===void 0&&(re=0),F(ce);var pe=[];s(B,function(be,xe,Pe,me){pe.push(be,xe,Pe,me)}),pe=new Float32Array(pe),d(ce,function(be){var xe=be.gl,Pe=be.isWebGL2,me=be.getExtension,ke=be.withProgram,we=be.withTexture,Te=be.withTextureFramebuffer,oe=be.handleContextLoss;if(we("rawDistances",function(_e,Fe){(ne!==_e._lastWidth||H!==_e._lastHeight)&&xe.texImage2D(xe.TEXTURE_2D,0,xe.RGBA,_e._lastWidth=ne,_e._lastHeight=H,0,xe.RGBA,xe.UNSIGNED_BYTE,null),ke("main",A,N,function(Ue){var Oe=Ue.setAttribute,ue=Ue.setUniform,Q=!Pe&&me("ANGLE_instanced_arrays"),fe=!Pe&&me("EXT_blend_minmax");Oe("aUV",2,xe.STATIC_DRAW,0,P),Oe("aLineSegment",4,xe.DYNAMIC_DRAW,1,pe),ue.apply(void 0,["4f","uGlyphBounds"].concat(G)),ue("1f","uMaxDistance",j),ue("1f","uExponent",ie),Te(_e,Fe,function(Se){xe.enable(xe.BLEND),xe.colorMask(!0,!0,!0,!0),xe.viewport(0,0,ne,H),xe.scissor(0,0,ne,H),xe.blendFunc(xe.ONE,xe.ONE),xe.blendEquationSeparate(xe.FUNC_ADD,Pe?xe.MAX:fe.MAX_EXT),xe.clear(xe.COLOR_BUFFER_BIT),Pe?xe.drawArraysInstanced(xe.TRIANGLES,0,3,pe.length/4):Q.drawArraysInstancedANGLE(xe.TRIANGLES,0,3,pe.length/4)})}),ke("post",o,D,function(Ue){Ue.setAttribute("aUV",2,xe.STATIC_DRAW,0,P),Ue.setUniform("1i","tex",Fe),xe.bindFramebuffer(xe.FRAMEBUFFER,te),xe.disable(xe.BLEND),xe.colorMask(re===0,re===1,re===2,re===3),xe.viewport(se,le,ne,H),xe.scissor(se,le,ne,H),xe.drawArrays(xe.TRIANGLES,0,3)})}),xe.isContextLost())throw oe(),new Error("webgl context lost")})}function $(ne){var H=!ne||ne===O?L:ne.canvas||ne,B=V.get(H);if(B===void 0){R=!0;var G=null;try{var j=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],ie=U(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,ne);B=ie&&j.length===ie.length&&ie.every(function(ce,te){return ce===j[te]}),B||(G="bad trial run results",console.info(j,ie))}catch(ce){B=!1,G=ce.message}G&&console.warn("WebGL SDF generation not supported:",G),R=!1,V.set(H,B)}return B}var X=Object.freeze({__proto__:null,generate:U,generateIntoCanvas:W,generateIntoFramebuffer:Y,isSupported:$});function Z(ne,H,B,G,j,ie){j===void 0&&(j=Math.max(G[2]-G[0],G[3]-G[1])/2),ie===void 0&&(ie=1);try{return U.apply(X,arguments)}catch(ce){return console.info("WebGL SDF generation failed, falling back to JS",ce),b.apply(C,arguments)}}function K(ne,H,B,G,j,ie,ce,te,se,le){j===void 0&&(j=Math.max(G[2]-G[0],G[3]-G[1])/2),ie===void 0&&(ie=1),te===void 0&&(te=0),se===void 0&&(se=0),le===void 0&&(le=0);try{return W.apply(X,arguments)}catch(re){return console.info("WebGL SDF generation failed, falling back to JS",re),_.apply(C,arguments)}}return e.forEachPathCommand=i,e.generate=Z,e.generateIntoCanvas=K,e.javascript=C,e.pathToLineSegments=s,e.webgl=X,e.webglUtils=x,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function mAe(){var t=(function(e){var n={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(n).forEach(function(oe,_e){r[oe]=1<<_e+1,i[r[oe]]=oe}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,a=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,l=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,c=r.S|r.WS|r.B|s|r.PDI|l,d=null;function p(){if(!d){d=new Map;var oe=function(Fe){if(n.hasOwnProperty(Fe)){var Ue=0;n[Fe].split(",").forEach(function(Oe){var ue=Oe.split("+"),Q=ue[0],fe=ue[1];Q=parseInt(Q,36),fe=fe?parseInt(fe,36):0,d.set(Ue+=Q,r[Fe]);for(var Se=0;Se<fe;Se++)d.set(++Ue,r[Fe])})}};for(var _e in n)oe(_e)}}function m(oe){return p(),d.get(oe.codePointAt(0))||r.L}function x(oe){return i[m(oe)]}var b={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function _(oe,_e){var Fe=36,Ue=0,Oe=new Map,ue=_e&&new Map,Q;return oe.split(",").forEach(function fe(Se){if(Se.indexOf("+")!==-1)for(var Ae=+Se;Ae--;)fe(Q);else{Q=Se;var ve=Se.split(">"),qe=ve[0],Ee=ve[1];qe=String.fromCodePoint(Ue+=parseInt(qe,Fe)),Ee=String.fromCodePoint(Ue+=parseInt(Ee,Fe)),Oe.set(qe,Ee),_e&&ue.set(Ee,qe)}}),{map:Oe,reverseMap:ue}}var S,w,C;function A(){if(!S){var oe=_(b.pairs,!0),_e=oe.map,Fe=oe.reverseMap;S=_e,w=Fe,C=_(b.canonical,!1).map}}function N(oe){return A(),S.get(oe)||null}function D(oe){return A(),w.get(oe)||null}function P(oe){return A(),C.get(oe)||null}var O=r.L,R=r.R,L=r.EN,V=r.ES,F=r.ET,U=r.AN,W=r.CS,Y=r.B,$=r.S,X=r.ON,Z=r.BN,K=r.NSM,ne=r.AL,H=r.LRO,B=r.RLO,G=r.LRE,j=r.RLE,ie=r.PDF,ce=r.LRI,te=r.RLI,se=r.FSI,le=r.PDI;function re(oe,_e){for(var Fe=125,Ue=new Uint32Array(oe.length),Oe=0;Oe<oe.length;Oe++)Ue[Oe]=m(oe[Oe]);var ue=new Map;function Q(qi,Bs){var vs=Ue[qi];Ue[qi]=Bs,ue.set(vs,ue.get(vs)-1),vs&a&&ue.set(a,ue.get(a)-1),ue.set(Bs,(ue.get(Bs)||0)+1),Bs&a&&ue.set(a,(ue.get(a)||0)+1)}for(var fe=new Uint8Array(oe.length),Se=new Map,Ae=[],ve=null,qe=0;qe<oe.length;qe++)ve||Ae.push(ve={start:qe,end:oe.length-1,level:_e==="rtl"?1:_e==="ltr"?0:rf(qe,!1)}),Ue[qe]&Y&&(ve.end=qe,ve=null);for(var Ee=j|G|B|H|s|le|ie|Y,Ce=function(qi){return qi+(qi&1?1:2)},Ye=function(qi){return qi+(qi&1?2:1)},Ze=0;Ze<Ae.length;Ze++){ve=Ae[Ze];var it=[{_level:ve.level,_override:0,_isolate:0}],ut=void 0,De=0,Ve=0,lt=0;ue.clear();for(var Le=ve.start;Le<=ve.end;Le++){var Ne=Ue[Le];if(ut=it[it.length-1],ue.set(Ne,(ue.get(Ne)||0)+1),Ne&a&&ue.set(a,(ue.get(a)||0)+1),Ne&Ee)if(Ne&(j|G)){fe[Le]=ut._level;var $e=(Ne===j?Ye:Ce)(ut._level);$e<=Fe&&!De&&!Ve?it.push({_level:$e,_override:0,_isolate:0}):De||Ve++}else if(Ne&(B|H)){fe[Le]=ut._level;var ft=(Ne===B?Ye:Ce)(ut._level);ft<=Fe&&!De&&!Ve?it.push({_level:ft,_override:Ne&B?R:O,_isolate:0}):De||Ve++}else if(Ne&s){Ne&se&&(Ne=rf(Le+1,!0)===1?te:ce),fe[Le]=ut._level,ut._override&&Q(Le,ut._override);var nt=(Ne===te?Ye:Ce)(ut._level);nt<=Fe&&De===0&&Ve===0?(lt++,it.push({_level:nt,_override:0,_isolate:1,_isolInitIndex:Le})):De++}else if(Ne&le){if(De>0)De--;else if(lt>0){for(Ve=0;!it[it.length-1]._isolate;)it.pop();var We=it[it.length-1]._isolInitIndex;We!=null&&(Se.set(We,Le),Se.set(Le,We)),it.pop(),lt--}ut=it[it.length-1],fe[Le]=ut._level,ut._override&&Q(Le,ut._override)}else Ne&ie?(De===0&&(Ve>0?Ve--:!ut._isolate&&it.length>1&&(it.pop(),ut=it[it.length-1])),fe[Le]=ut._level):Ne&Y&&(fe[Le]=ve.level);else fe[Le]=ut._level,ut._override&&Ne!==Z&&Q(Le,ut._override)}for(var Ke=[],je=null,et=ve.start;et<=ve.end;et++){var pt=Ue[et];if(!(pt&l)){var Lt=fe[et],wt=pt&s,yt=pt===le;je&&Lt===je._level?(je._end=et,je._endsWithIsolInit=wt):Ke.push(je={_start:et,_end:et,_level:Lt,_startsWithPDI:yt,_endsWithIsolInit:wt})}}for(var Pt=[],zt=0;zt<Ke.length;zt++){var Dt=Ke[zt];if(!Dt._startsWithPDI||Dt._startsWithPDI&&!Se.has(Dt._start)){for(var Et=[je=Dt],Be=void 0;je&&je._endsWithIsolInit&&(Be=Se.get(je._end))!=null;)for(var Qe=zt+1;Qe<Ke.length;Qe++)if(Ke[Qe]._start===Be){Et.push(je=Ke[Qe]);break}for(var ht=[],It=0;It<Et.length;It++)for(var Tt=Et[It],ct=Tt._start;ct<=Tt._end;ct++)ht.push(ct);for(var Ut=fe[ht[0]],Gt=ve.level,sn=ht[0]-1;sn>=0;sn--)if(!(Ue[sn]&l)){Gt=fe[sn];break}var nn=ht[ht.length-1],En=fe[nn],Hn=ve.level;if(!(Ue[nn]&s)){for(var Nn=nn+1;Nn<=ve.end;Nn++)if(!(Ue[Nn]&l)){Hn=fe[Nn];break}}Pt.push({_seqIndices:ht,_sosType:Math.max(Gt,Ut)%2?R:O,_eosType:Math.max(Hn,En)%2?R:O})}}for(var Br=0;Br<Pt.length;Br++){var er=Pt[Br],ge=er._seqIndices,rt=er._sosType,bt=er._eosType,vt=fe[ge[0]]&1?R:O;if(ue.get(K))for(var gt=0;gt<ge.length;gt++){var Xt=ge[gt];if(Ue[Xt]&K){for(var Jt=rt,Kt=gt-1;Kt>=0;Kt--)if(!(Ue[ge[Kt]]&l)){Jt=Ue[ge[Kt]];break}Q(Xt,Jt&(s|le)?X:Jt)}}if(ue.get(L))for(var Zt=0;Zt<ge.length;Zt++){var xn=ge[Zt];if(Ue[xn]&L)for(var On=Zt-1;On>=-1;On--){var Wn=On===-1?rt:Ue[ge[On]];if(Wn&o){Wn===ne&&Q(xn,U);break}}}if(ue.get(ne))for(var fn=0;fn<ge.length;fn++){var or=ge[fn];Ue[or]&ne&&Q(or,R)}if(ue.get(V)||ue.get(W))for(var Kr=1;Kr<ge.length-1;Kr++){var ni=ge[Kr];if(Ue[ni]&(V|W)){for(var fr=0,kr=0,ln=Kr-1;ln>=0&&(fr=Ue[ge[ln]],!!(fr&l));ln--);for(var ss=Kr+1;ss<ge.length&&(kr=Ue[ge[ss]],!!(kr&l));ss++);fr===kr&&(Ue[ni]===V?fr===L:fr&(L|U))&&Q(ni,fr)}}if(ue.get(L))for(var Dn=0;Dn<ge.length;Dn++){var ms=ge[Dn];if(Ue[ms]&L){for(var Ns=Dn-1;Ns>=0&&Ue[ge[Ns]]&(F|l);Ns--)Q(ge[Ns],L);for(Dn++;Dn<ge.length&&Ue[ge[Dn]]&(F|l|L);Dn++)Ue[ge[Dn]]!==L&&Q(ge[Dn],L)}}if(ue.get(F)||ue.get(V)||ue.get(W))for(var Di=0;Di<ge.length;Di++){var gs=ge[Di];if(Ue[gs]&(F|V|W)){Q(gs,X);for(var xr=Di-1;xr>=0&&Ue[ge[xr]]&l;xr--)Q(ge[xr],X);for(var hi=Di+1;hi<ge.length&&Ue[ge[hi]]&l;hi++)Q(ge[hi],X)}}if(ue.get(L))for(var Rs=0,Pi=rt;Rs<ge.length;Rs++){var qo=ge[Rs],ga=Ue[qo];ga&L?Pi===O&&Q(qo,O):ga&o&&(Pi=ga)}if(ue.get(a)){var Aa=R|L|U,Yl=Aa|O,_l=[];{for(var xa=[],ks=0;ks<ge.length;ks++)if(Ue[ge[ks]]&a){var Kl=oe[ge[ks]],Ya=void 0;if(N(Kl)!==null)if(xa.length<63)xa.push({char:Kl,seqIndex:ks});else break;else if((Ya=D(Kl))!==null)for(var Na=xa.length-1;Na>=0;Na--){var Ra=xa[Na].char;if(Ra===Ya||Ra===D(P(Kl))||N(P(Ra))===Kl){_l.push([xa[Na].seqIndex,ks]),xa.length=Na;break}}}_l.sort(function(qi,Bs){return qi[0]-Bs[0]})}for(var Ic=0;Ic<_l.length;Ic++){for(var Oc=_l[Ic],Zl=Oc[0],Xo=Oc[1],io=!1,Ro=0,Sl=Zl+1;Sl<Xo;Sl++){var xs=ge[Sl];if(Ue[xs]&Yl){io=!0;var Ka=Ue[xs]&Aa?R:O;if(Ka===vt){Ro=Ka;break}}}if(io&&!Ro){Ro=rt;for(var Za=Zl-1;Za>=0;Za--){var Lc=ge[Za];if(Ue[Lc]&Yl){var ri=Ue[Lc]&Aa?R:O;ri!==vt?Ro=ri:Ro=vt;break}}}if(Ro){if(Ue[ge[Zl]]=Ue[ge[Xo]]=Ro,Ro!==vt){for(var Hr=Zl+1;Hr<ge.length;Hr++)if(!(Ue[ge[Hr]]&l)){m(oe[ge[Hr]])&K&&(Ue[ge[Hr]]=Ro);break}}if(Ro!==vt){for(var Yo=Xo+1;Yo<ge.length;Yo++)if(!(Ue[ge[Yo]]&l)){m(oe[ge[Yo]])&K&&(Ue[ge[Yo]]=Ro);break}}}}for(var vr=0;vr<ge.length;vr++)if(Ue[ge[vr]]&a){for(var Si=vr,Ii=vr,qr=rt,ka=vr-1;ka>=0;ka--)if(Ue[ge[ka]]&l)Si=ka;else{qr=Ue[ge[ka]]&Aa?R:O;break}for(var wl=bt,Ql=vr+1;Ql<ge.length;Ql++)if(Ue[ge[Ql]]&(a|l))Ii=Ql;else{wl=Ue[ge[Ql]]&Aa?R:O;break}for(var go=Si;go<=Ii;go++)Ue[ge[go]]=qr===wl?qr:vt;vr=Ii}}}for(var gi=ve.start;gi<=ve.end;gi++){var _h=fe[gi],dd=Ue[gi];if(_h&1?dd&(O|L|U)&&fe[gi]++:dd&R?fe[gi]++:dd&(U|L)&&(fe[gi]+=2),dd&l&&(fe[gi]=gi===0?ve.level:fe[gi-1]),gi===ve.end||m(oe[gi])&($|Y))for(var fd=gi;fd>=0&&m(oe[fd])&c;fd--)fe[fd]=ve.level}}return{levels:fe,paragraphs:Ae};function rf(qi,Bs){for(var vs=qi;vs<oe.length;vs++){var Ml=Ue[vs];if(Ml&(R|ne))return 1;if(Ml&(Y|O)||Bs&&Ml===le)return 0;if(Ml&s){var xo=va(vs);vs=xo===-1?oe.length:xo}}return 0}function va(qi){for(var Bs=1,vs=qi+1;vs<oe.length;vs++){var Ml=Ue[vs];if(Ml&Y)break;if(Ml&le){if(--Bs===0)return vs}else Ml&s&&Bs++}return-1}}var pe="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",be;function xe(){if(!be){var oe=_(pe,!0),_e=oe.map,Fe=oe.reverseMap;Fe.forEach(function(Ue,Oe){_e.set(Oe,Ue)}),be=_e}}function Pe(oe){return xe(),be.get(oe)||null}function me(oe,_e,Fe,Ue){var Oe=oe.length;Fe=Math.max(0,Fe==null?0:+Fe),Ue=Math.min(Oe-1,Ue==null?Oe-1:+Ue);for(var ue=new Map,Q=Fe;Q<=Ue;Q++)if(_e[Q]&1){var fe=Pe(oe[Q]);fe!==null&&ue.set(Q,fe)}return ue}function ke(oe,_e,Fe,Ue){var Oe=oe.length;Fe=Math.max(0,Fe==null?0:+Fe),Ue=Math.min(Oe-1,Ue==null?Oe-1:+Ue);var ue=[];return _e.paragraphs.forEach(function(Q){var fe=Math.max(Fe,Q.start),Se=Math.min(Ue,Q.end);if(fe<Se){for(var Ae=_e.levels.slice(fe,Se+1),ve=Se;ve>=fe&&m(oe[ve])&c;ve--)Ae[ve]=Q.level;for(var qe=Q.level,Ee=1/0,Ce=0;Ce<Ae.length;Ce++){var Ye=Ae[Ce];Ye>qe&&(qe=Ye),Ye<Ee&&(Ee=Ye|1)}for(var Ze=qe;Ze>=Ee;Ze--)for(var it=0;it<Ae.length;it++)if(Ae[it]>=Ze){for(var ut=it;it+1<Ae.length&&Ae[it+1]>=Ze;)it++;it>ut&&ue.push([ut+fe,it+fe])}}}),ue}function we(oe,_e,Fe,Ue){var Oe=Te(oe,_e,Fe,Ue),ue=[].concat(oe);return Oe.forEach(function(Q,fe){ue[fe]=(_e.levels[Q]&1?Pe(oe[Q]):null)||oe[Q]}),ue.join("")}function Te(oe,_e,Fe,Ue){for(var Oe=ke(oe,_e,Fe,Ue),ue=[],Q=0;Q<oe.length;Q++)ue[Q]=Q;return Oe.forEach(function(fe){for(var Se=fe[0],Ae=fe[1],ve=ue.slice(Se,Ae+1),qe=ve.length;qe--;)ue[Ae-qe]=ve[qe]}),ue}return e.closingToOpeningBracket=D,e.getBidiCharType=m,e.getBidiCharTypeName=x,e.getCanonicalBracket=P,e.getEmbeddingLevels=re,e.getMirroredCharacter=Pe,e.getMirroredCharactersMap=me,e.getReorderSegments=ke,e.getReorderedIndices=Te,e.getReorderedString=we,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const iZ=/\bvoid\s+main\s*\(\s*\)\s*{/g;function pk(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Ar[i];return s?pk(s):r}return t.replace(e,n)}const Va=[];for(let t=0;t<256;t++)Va[t]=(t<16?"0":"")+t.toString(16);function gAe(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Va[t&255]+Va[t>>8&255]+Va[t>>16&255]+Va[t>>24&255]+"-"+Va[e&255]+Va[e>>8&255]+"-"+Va[e>>16&15|64]+Va[e>>24&255]+"-"+Va[n&63|128]+Va[n>>8&255]+"-"+Va[n>>16&255]+Va[n>>24&255]+Va[r&255]+Va[r>>8&255]+Va[r>>16&255]+Va[r>>24&255]).toUpperCase()}const Eg=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e<n;e++){let r=arguments[e];if(r)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},xAe=Date.now(),oF=new WeakMap,aF=new Map;let vAe=1e10;function mk(t,e){const n=SAe(e);let r=oF.get(t);if(r||oF.set(t,r=Object.create(null)),r[n])return new r[n];const i=`_onBeforeCompile${n}`,s=function(c,d){t.onBeforeCompile.call(this,c,d);const p=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let m=aF[p];if(!m){const x=yAe(this,c,e,n);m=aF[p]=x}c.vertexShader=m.vertexShader,c.fragmentShader=m.fragmentShader,Eg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-xAe}}),this[i]&&this[i](c)},o=function(){return a(e.chained?t:t.clone())},a=function(c){const d=Object.create(c,l);return Object.defineProperty(d,"baseMaterial",{value:t}),Object.defineProperty(d,"id",{value:vAe++}),d.uuid=gAe(),d.uniforms=Eg({},c.uniforms,e.uniforms),d.defines=Eg({},c.defines,e.defines),d.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",d.extensions=Eg({},c.extensions,e.extensions),d._listeners=void 0,d},l={constructor:{value:o},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:c=>{t.type=c}},isDerivedFrom:{writable:!0,configurable:!0,value:function(c){const d=this.baseMaterial;return c===d||d.isDerivedMaterial&&d.isDerivedFrom(c)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+n}},onBeforeCompile:{get(){return s},set(c){this[i]=c}},copy:{writable:!0,configurable:!0,value:function(c){return t.copy.call(this,c),!t.isShaderMaterial&&!t.isDerivedMaterial&&(Eg(this.extensions,c.extensions),Eg(this.defines,c.defines),Eg(this.uniforms,PS.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new t.constructor;return a(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=mk(t.isDerivedMaterial?t.getDepthMaterial():new zC({depthPacking:pY}),e),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms),c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;return c||(c=this._distanceMaterial=mk(t.isDerivedMaterial?t.getDistanceMaterial():new FC,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:d}=this;c&&c.dispose(),d&&d.dispose(),t.dispose.call(this)}}};return r[n]=o,new o}function yAe(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:d,fragmentMainOutro:p,fragmentColorTransform:m,customRewriter:x,timeUniform:b}=r;if(s=s||"",o=o||"",a=a||"",c=c||"",d=d||"",p=p||"",(l||x)&&(e=pk(e)),(m||x)&&(n=n.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
//!BEGIN_POST_CHUNK $1
$&
//!END_POST_CHUNK
`),n=pk(n)),x){let _=x({vertexShader:e,fragmentShader:n});e=_.vertexShader,n=_.fragmentShader}if(m){let _=[];n=n.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,S=>(_.push(S),"")),p=`${m}
${_.join(`
`)}
${p}`}if(b){const _=`
uniform float ${b};
`;s=_+s,c=_+c}return l&&(e=`vec3 troika_position_${i};
vec3 troika_normal_${i};
vec2 troika_uv_${i};
${e}
`,s=`${s}
void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
  ${l}
}
`,o=`
troika_position_${i} = vec3(position);
troika_normal_${i} = vec3(normal);
troika_uv_${i} = vec2(uv);
troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i});
${o}
`,e=e.replace(/\b(position|normal|uv)\b/g,(_,S,w,C)=>/\battribute\s+vec[23]\s+$/.test(C.substr(0,w))?S:`troika_${S}_${i}`),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=lF(e,i,s,o,a),n=lF(n,i,c,d,p),{vertexShader:e,fragmentShader:n}}function lF(t,e,n,r,i){return(r||i||n)&&(t=t.replace(iZ,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function bAe(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let _Ae=0;const cF=new Map;function SAe(t){const e=JSON.stringify(t,bAe);let n=cF.get(e);return n==null&&cF.set(e,n=++_Ae),n}/*!
Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
*/function wAe(){return typeof window>"u"&&(self.window=self),(function(t){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],d=0;d<l;d++){var p=s.readUint(o,a);a+=4,c.push(e._readFont(o,p))}return c}return[e._readFont(o,0)]},_readFont:function(i,s){var o=e._bin,a=s;o.readFixed(i,s),s+=4;var l=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],d={_data:i,_offset:a},p={},m=0;m<l;m++){var x=o.readASCII(i,s,4);s+=4,o.readUint(i,s),s+=4;var b=o.readUint(i,s);s+=4;var _=o.readUint(i,s);s+=4,p[x]={offset:b,length:_}}for(m=0;m<c.length;m++){var S=c[m];p[S]&&(d[S.trim()]=e[S.trim()].parse(i,p[S].offset,p[S].length,d))}return d},_tabOffset:function(i,s,o){for(var a=e._bin,l=a.readUshort(i,o+4),c=o+12,d=0;d<l;d++){var p=a.readASCII(i,c,4);c+=4,a.readUint(i,c),c+=4;var m=a.readUint(i,c);if(c+=4,a.readUint(i,c),c+=4,p==s)return m}return 0}};e._bin={readFixed:function(i,s){return(i[s]<<8|i[s+1])+(i[s+2]<<8|i[s+3])/65540},readF2dot14:function(i,s){return e._bin.readShort(i,s)/16384},readInt:function(i,s){return e._bin._view(i).getInt32(s)},readInt8:function(i,s){return e._bin._view(i).getInt8(s)},readShort:function(i,s){return e._bin._view(i).getInt16(s)},readUshort:function(i,s){return e._bin._view(i).getUint16(s)},readUshorts:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(e._bin.readUshort(i,s+2*l));return a},readUint:function(i,s){return e._bin._view(i).getUint32(s)},readUint64:function(i,s){return 4294967296*e._bin.readUint(i,s)+e._bin.readUint(i,s+4)},readASCII:function(i,s,o){for(var a="",l=0;l<o;l++)a+=String.fromCharCode(i[s+l]);return a},readUnicode:function(i,s,o){for(var a="",l=0;l<o;l++){var c=i[s++]<<8|i[s++];a+=String.fromCharCode(c)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,s,o){var a=e._bin._tdec;return a&&s==0&&o==i.length?a.decode(i):e._bin.readASCII(i,s,o)},readBytes:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(i[s+l]);return a},readASCIIArray:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(String.fromCharCode(i[s+l]));return a},_view:function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))}},e._lctf={},e._lctf.parse=function(i,s,o,a,l){var c=e._bin,d={},p=s;c.readFixed(i,s),s+=4;var m=c.readUshort(i,s);s+=2;var x=c.readUshort(i,s);s+=2;var b=c.readUshort(i,s);return s+=2,d.scriptList=e._lctf.readScriptList(i,p+m),d.featureList=e._lctf.readFeatureList(i,p+x),d.lookupList=e._lctf.readLookupList(i,p+b,l),d},e._lctf.readLookupList=function(i,s,o){var a=e._bin,l=s,c=[],d=a.readUshort(i,s);s+=2;for(var p=0;p<d;p++){var m=a.readUshort(i,s);s+=2;var x=e._lctf.readLookupTable(i,l+m,o);c.push(x)}return c},e._lctf.readLookupTable=function(i,s,o){var a=e._bin,l=s,c={tabs:[]};c.ltype=a.readUshort(i,s),s+=2,c.flag=a.readUshort(i,s),s+=2;var d=a.readUshort(i,s);s+=2;for(var p=c.ltype,m=0;m<d;m++){var x=a.readUshort(i,s);s+=2;var b=o(i,p,l+x,c);c.tabs.push(b)}return c},e._lctf.numOfOnes=function(i){for(var s=0,o=0;o<32;o++)(i>>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],l=o.readUshort(i,s);if(s+=2,l==1){var c=o.readUshort(i,s);s+=2;var d=o.readUshort(i,s);s+=2;for(var p=0;p<d;p++)a.push(c+p),a.push(c+p),a.push(o.readUshort(i,s)),s+=2}if(l==2){var m=o.readUshort(i,s);for(s+=2,p=0;p<m;p++)a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2}return a},e._lctf.getInterval=function(i,s){for(var o=0;o<i.length;o+=3){var a=i[o],l=i[o+1];if(i[o+2],a<=s&&s<=l)return o}return-1},e._lctf.readCoverage=function(i,s){var o=e._bin,a={};a.fmt=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.fmt==1&&(a.tab=o.readUshorts(i,s,l)),a.fmt==2&&(a.tab=o.readUshorts(i,s,3*l)),a},e._lctf.coverageIndex=function(i,s){var o=i.tab;if(i.fmt==1)return o.indexOf(s);if(i.fmt==2){var a=e._lctf.getInterval(o,s);if(a!=-1)return o[a+2]+(s-o[a])}return-1},e._lctf.readFeatureList=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var p=o.readASCII(i,s,4);s+=4;var m=o.readUshort(i,s);s+=2;var x=e._lctf.readFeatureTable(i,a+m);x.tag=p.trim(),l.push(x)}return l},e._lctf.readFeatureTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.featureParams=a+c);var d=o.readUshort(i,s);s+=2,l.tab=[];for(var p=0;p<d;p++)l.tab.push(o.readUshort(i,s+2*p));return l},e._lctf.readScriptList=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var p=o.readASCII(i,s,4);s+=4;var m=o.readUshort(i,s);s+=2,l[p.trim()]=e._lctf.readScriptTable(i,a+m)}return l},e._lctf.readScriptTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(i,a+c));var d=o.readUshort(i,s);s+=2;for(var p=0;p<d;p++){var m=o.readASCII(i,s,4);s+=4;var x=o.readUshort(i,s);s+=2,l[m.trim()]=e._lctf.readLangSysTable(i,a+x)}return l},e._lctf.readLangSysTable=function(i,s){var o=e._bin,a={};o.readUshort(i,s),s+=2,a.reqFeature=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.features=o.readUshorts(i,s,l),a},e.CFF={},e.CFF.parse=function(i,s,o){var a=e._bin;(i=new Uint8Array(i.buffer,s,o))[s=0],i[++s],i[++s],i[++s],s++;var l=[];s=e.CFF.readIndex(i,s,l);for(var c=[],d=0;d<l.length-1;d++)c.push(a.readASCII(i,s+l[d],l[d+1]-l[d]));s+=l[l.length-1];var p=[];s=e.CFF.readIndex(i,s,p);var m=[];for(d=0;d<p.length-1;d++)m.push(e.CFF.readDict(i,s+p[d],s+p[d+1]));s+=p[p.length-1];var x=m[0],b=[];s=e.CFF.readIndex(i,s,b);var _=[];for(d=0;d<b.length-1;d++)_.push(a.readASCII(i,s+b[d],b[d+1]-b[d]));if(s+=b[b.length-1],e.CFF.readSubrs(i,s,x),x.CharStrings){s=x.CharStrings,b=[],s=e.CFF.readIndex(i,s,b);var S=[];for(d=0;d<b.length-1;d++)S.push(a.readBytes(i,s+b[d],b[d+1]-b[d]));x.CharStrings=S}if(x.ROS){s=x.FDArray;var w=[];for(s=e.CFF.readIndex(i,s,w),x.FDArray=[],d=0;d<w.length-1;d++){var C=e.CFF.readDict(i,s+w[d],s+w[d+1]);e.CFF._readFDict(i,C,_),x.FDArray.push(C)}s+=w[w.length-1],s=x.FDSelect,x.FDSelect=[];var A=i[s];if(s++,A!=3)throw A;var N=a.readUshort(i,s);for(s+=2,d=0;d<N+1;d++)x.FDSelect.push(a.readUshort(i,s),i[s+2]),s+=3}return x.Encoding&&(x.Encoding=e.CFF.readEncoding(i,x.Encoding,x.CharStrings.length)),x.charset&&(x.charset=e.CFF.readCharset(i,x.charset,x.CharStrings.length)),e.CFF._readFDict(i,x,_),x},e.CFF._readFDict=function(i,s,o){var a;for(var l in s.Private&&(a=s.Private[1],s.Private=e.CFF.readDict(i,a,a+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(i,a+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=o[s[l]-426+35])},e.CFF.readSubrs=function(i,s,o){var a=e._bin,l=[];s=e.CFF.readIndex(i,s,l);var c,d=l.length;c=d<1240?107:d<33900?1131:32768,o.Bias=c,o.Subrs=[];for(var p=0;p<l.length-1;p++)o.Subrs.push(a.readBytes(i,s+l[p],l[p+1]-l[p]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(i,s){for(var o=0;o<i.charset.length;o++)if(i.charset[o]==s)return o;return-1},e.CFF.glyphBySE=function(i,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var d=0;d<c;d++)a.push(i[s+d]);return a},e.CFF.readCharset=function(i,s,o){var a=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var d=0;d<o;d++){var p=a.readUshort(i,s);s+=2,l.push(p)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<o;){p=a.readUshort(i,s),s+=2;var m=0;for(c==1?(m=i[s],s++):(m=a.readUshort(i,s),s+=2),d=0;d<=m;d++)l.push(p),p++}}return l},e.CFF.readIndex=function(i,s,o){var a=e._bin,l=a.readUshort(i,s)+1,c=i[s+=2];if(s++,c==1)for(var d=0;d<l;d++)o.push(i[s+d]);else if(c==2)for(d=0;d<l;d++)o.push(a.readUshort(i,s+2*d));else if(c==3)for(d=0;d<l;d++)o.push(16777215&a.readUint(i,s+3*d-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(i,s,o){var a=e._bin,l=i[s],c=i[s+1];i[s+2],i[s+3],i[s+4];var d=1,p=null,m=null;l<=20&&(p=l,d=1),l==12&&(p=100*l+c,d=2),21<=l&&l<=27&&(p=l,d=1),l==28&&(m=a.readShort(i,s+1),d=3),29<=l&&l<=31&&(p=l,d=1),32<=l&&l<=246&&(m=l-139,d=1),247<=l&&l<=250&&(m=256*(l-247)+c+108,d=2),251<=l&&l<=254&&(m=256*-(l-251)-c-108,d=2),l==255&&(m=a.readInt(i,s+1)/65535,d=5),o.val=m??"o"+p,o.size=d},e.CFF.readCharString=function(i,s,o){for(var a=s+o,l=e._bin,c=[];s<a;){var d=i[s],p=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;d<=20&&(x=d,m=1),d==12&&(x=100*d+p,m=2),d!=19&&d!=20||(x=d,m=2),21<=d&&d<=27&&(x=d,m=1),d==28&&(b=l.readShort(i,s+1),m=3),29<=d&&d<=31&&(x=d,m=1),32<=d&&d<=246&&(b=d-139,m=1),247<=d&&d<=250&&(b=256*(d-247)+p+108,m=2),251<=d&&d<=254&&(b=256*-(d-251)-p-108,m=2),d==255&&(b=l.readInt(i,s+1)/65535,m=5),c.push(b??"o"+x),s+=m}return c},e.CFF.readDict=function(i,s,o){for(var a=e._bin,l={},c=[];s<o;){var d=i[s],p=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;if(d==28&&(b=a.readShort(i,s+1),m=3),d==29&&(b=a.readInt(i,s+1),m=5),32<=d&&d<=246&&(b=d-139,m=1),247<=d&&d<=250&&(b=256*(d-247)+p+108,m=2),251<=d&&d<=254&&(b=256*-(d-251)-p-108,m=2),d==255)throw b=a.readInt(i,s+1)/65535,m=5,"unknown number";if(d==30){var _=[];for(m=1;;){var S=i[s+m];m++;var w=S>>4,C=15&S;if(w!=15&&_.push(w),C!=15&&_.push(C),C==15)break}for(var A="",N=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],D=0;D<_.length;D++)A+=N[_[D]];b=parseFloat(A)}d<=21&&(x=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][d],m=1,d==12&&(x=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][p],m=2)),x!=null?(l[x]=c.length==1?c[0]:c,c=[]):c.push(b),s+=m}return l},e.cmap={},e.cmap.parse=function(i,s,o){i=new Uint8Array(i.buffer,s,o),s=0;var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2;var d=[];l.tables=[];for(var p=0;p<c;p++){var m=a.readUshort(i,s);s+=2;var x=a.readUshort(i,s);s+=2;var b=a.readUint(i,s);s+=4;var _="p"+m+"e"+x,S=d.indexOf(b);if(S==-1){var w;S=l.tables.length,d.push(b);var C=a.readUshort(i,b);C==0?w=e.cmap.parse0(i,b):C==4?w=e.cmap.parse4(i,b):C==6?w=e.cmap.parse6(i,b):C==12?w=e.cmap.parse12(i,b):console.debug("unknown format: "+C,m,x,b),l.tables.push(w)}if(l[_]!=null)throw"multiple tables for one platform+encoding";l[_]=S}return l},e.cmap.parse0=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,a.map=[];for(var c=0;c<l-6;c++)a.map.push(i[s+c]);return a},e.cmap.parse4=function(i,s){var o=e._bin,a=s,l={};l.format=o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2;var d=o.readUshort(i,s);s+=2;var p=d/2;l.searchRange=o.readUshort(i,s),s+=2,l.entrySelector=o.readUshort(i,s),s+=2,l.rangeShift=o.readUshort(i,s),s+=2,l.endCount=o.readUshorts(i,s,p),s+=2*p,s+=2,l.startCount=o.readUshorts(i,s,p),s+=2*p,l.idDelta=[];for(var m=0;m<p;m++)l.idDelta.push(o.readShort(i,s)),s+=2;for(l.idRangeOffset=o.readUshorts(i,s,p),s+=2*p,l.glyphIdArray=[];s<a+c;)l.glyphIdArray.push(o.readUshort(i,s)),s+=2;return l},e.cmap.parse6=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,a.firstCode=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,a.glyphIdArray=[];for(var c=0;c<l;c++)a.glyphIdArray.push(o.readUshort(i,s)),s+=2;return a},e.cmap.parse12=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,s+=2,o.readUint(i,s),s+=4,o.readUint(i,s),s+=4;var l=o.readUint(i,s);s+=4,a.groups=[];for(var c=0;c<l;c++){var d=s+12*c,p=o.readUint(i,d+0),m=o.readUint(i,d+4),x=o.readUint(i,d+8);a.groups.push([p,m,x])}return a},e.glyf={},e.glyf.parse=function(i,s,o,a){for(var l=[],c=0;c<a.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(i,s){var o=e._bin,a=i._data,l=e._tabOffset(a,"glyf",i._offset)+i.loca[s];if(i.loca[s]==i.loca[s+1])return null;var c={};if(c.noc=o.readShort(a,l),l+=2,c.xMin=o.readShort(a,l),l+=2,c.yMin=o.readShort(a,l),l+=2,c.xMax=o.readShort(a,l),l+=2,c.yMax=o.readShort(a,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var d=0;d<c.noc;d++)c.endPts.push(o.readUshort(a,l)),l+=2;var p=o.readUshort(a,l);if(l+=2,a.length-l<p)return null;c.instructions=o.readBytes(a,l,p),l+=p;var m=c.endPts[c.noc-1]+1;for(c.flags=[],d=0;d<m;d++){var x=a[l];if(l++,c.flags.push(x),(8&x)!=0){var b=a[l];l++;for(var _=0;_<b;_++)c.flags.push(x),d++}}for(c.xs=[],d=0;d<m;d++){var S=(2&c.flags[d])!=0,w=(16&c.flags[d])!=0;S?(c.xs.push(w?a[l]:-a[l]),l++):w?c.xs.push(0):(c.xs.push(o.readShort(a,l)),l+=2)}for(c.ys=[],d=0;d<m;d++)S=(4&c.flags[d])!=0,w=(32&c.flags[d])!=0,S?(c.ys.push(w?a[l]:-a[l]),l++):w?c.ys.push(0):(c.ys.push(o.readShort(a,l)),l+=2);var C=0,A=0;for(d=0;d<m;d++)C+=c.xs[d],A+=c.ys[d],c.xs[d]=C,c.ys[d]=A}else{var N;c.parts=[];do{N=o.readUshort(a,l),l+=2;var D={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(D),D.glyphIndex=o.readUshort(a,l),l+=2,1&N){var P=o.readShort(a,l);l+=2;var O=o.readShort(a,l);l+=2}else P=o.readInt8(a,l),l++,O=o.readInt8(a,l),l++;2&N?(D.m.tx=P,D.m.ty=O):(D.p1=P,D.p2=O),8&N?(D.m.a=D.m.d=o.readF2dot14(a,l),l+=2):64&N?(D.m.a=o.readF2dot14(a,l),l+=2,D.m.d=o.readF2dot14(a,l),l+=2):128&N&&(D.m.a=o.readF2dot14(a,l),l+=2,D.m.b=o.readF2dot14(a,l),l+=2,D.m.c=o.readF2dot14(a,l),l+=2,D.m.d=o.readF2dot14(a,l),l+=2)}while(32&N);if(256&N){var R=o.readUshort(a,l);for(l+=2,c.instr=[],d=0;d<R;d++)c.instr.push(a[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(i,s,o,a){var l=s;s+=4;var c=e._bin.readUshort(i,s);return{glyphClassDef:c===0?null:e._lctf.readClassDef(i,l+c)}},e.GPOS={},e.GPOS.parse=function(i,s,o,a){return e._lctf.parse(i,s,o,a,e.GPOS.subt)},e.GPOS.subt=function(i,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(i,o),o+=2,s==1||s==2||s==3||s==7||s==8&&d.fmt<=2){var p=l.readUshort(i,o);o+=2,d.coverage=e._lctf.readCoverage(i,p+c)}if(s==1&&d.fmt==1){var m=l.readUshort(i,o);o+=2,m!=0&&(d.pos=e.GPOS.readValueRecord(i,o,m))}else if(s==2&&d.fmt>=1&&d.fmt<=2){m=l.readUshort(i,o),o+=2;var x=l.readUshort(i,o);o+=2;var b=e._lctf.numOfOnes(m),_=e._lctf.numOfOnes(x);if(d.fmt==1){d.pairsets=[];var S=l.readUshort(i,o);o+=2;for(var w=0;w<S;w++){var C=c+l.readUshort(i,o);o+=2;var A=l.readUshort(i,C);C+=2;for(var N=[],D=0;D<A;D++){var P=l.readUshort(i,C);C+=2,m!=0&&(U=e.GPOS.readValueRecord(i,C,m),C+=2*b),x!=0&&(W=e.GPOS.readValueRecord(i,C,x),C+=2*_),N.push({gid2:P,val1:U,val2:W})}d.pairsets.push(N)}}if(d.fmt==2){var O=l.readUshort(i,o);o+=2;var R=l.readUshort(i,o);o+=2;var L=l.readUshort(i,o);o+=2;var V=l.readUshort(i,o);for(o+=2,d.classDef1=e._lctf.readClassDef(i,c+O),d.classDef2=e._lctf.readClassDef(i,c+R),d.matrix=[],w=0;w<L;w++){var F=[];for(D=0;D<V;D++){var U=null,W=null;m!=0&&(U=e.GPOS.readValueRecord(i,o,m),o+=2*b),x!=0&&(W=e.GPOS.readValueRecord(i,o,x),o+=2*_),F.push({val1:U,val2:W})}d.matrix.push(F)}}}else if(s==4&&d.fmt==1)d.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),d.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),d.markClassCount=l.readUshort(i,o+4),d.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),d.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,d.markClassCount);else if(s==6&&d.fmt==1)d.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),d.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),d.markClassCount=l.readUshort(i,o+4),d.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),d.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,d.markClassCount);else{if(s==9&&d.fmt==1){var Y=l.readUshort(i,o);o+=2;var $=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=Y;else if(a.ltype!=Y)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,c+$)}console.debug("unsupported GPOS table LookupType",s,"format",d.fmt)}return d},e.GPOS.readValueRecord=function(i,s,o){var a=e._bin,l=[];return l.push(1&o?a.readShort(i,s):0),s+=1&o?2:0,l.push(2&o?a.readShort(i,s):0),s+=2&o?2:0,l.push(4&o?a.readShort(i,s):0),s+=4&o?2:0,l.push(8&o?a.readShort(i,s):0),s+=8&o?2:0,l},e.GPOS.readBaseArray=function(i,s,o){var a=e._bin,l=[],c=s,d=a.readUshort(i,s);s+=2;for(var p=0;p<d;p++){for(var m=[],x=0;x<o;x++)m.push(e.GPOS.readAnchorRecord(i,c+a.readUshort(i,s))),s+=2;l.push(m)}return l},e.GPOS.readMarkArray=function(i,s){var o=e._bin,a=[],l=s,c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var p=e.GPOS.readAnchorRecord(i,o.readUshort(i,s+2)+l);p.markClass=o.readUshort(i,s),a.push(p),s+=4}return a},e.GPOS.readAnchorRecord=function(i,s){var o=e._bin,a={};return a.fmt=o.readUshort(i,s),a.x=o.readShort(i,s+2),a.y=o.readShort(i,s+4),a},e.GSUB={},e.GSUB.parse=function(i,s,o,a){return e._lctf.parse(i,s,o,a,e.GSUB.subt)},e.GSUB.subt=function(i,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(i,o),o+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&d.fmt<=2||s==6&&d.fmt<=2){var p=l.readUshort(i,o);o+=2,d.coverage=e._lctf.readCoverage(i,c+p)}if(s==1&&d.fmt>=1&&d.fmt<=2){if(d.fmt==1)d.delta=l.readShort(i,o),o+=2;else if(d.fmt==2){var m=l.readUshort(i,o);o+=2,d.newg=l.readUshorts(i,o,m),o+=2*d.newg.length}}else if(s==2&&d.fmt==1){m=l.readUshort(i,o),o+=2,d.seqs=[];for(var x=0;x<m;x++){var b=l.readUshort(i,o)+c;o+=2;var _=l.readUshort(i,b);d.seqs.push(l.readUshorts(i,b+2,_))}}else if(s==4)for(d.vals=[],m=l.readUshort(i,o),o+=2,x=0;x<m;x++){var S=l.readUshort(i,o);o+=2,d.vals.push(e.GSUB.readLigatureSet(i,c+S))}else if(s==5&&d.fmt==2){if(d.fmt==2){var w=l.readUshort(i,o);o+=2,d.cDef=e._lctf.readClassDef(i,c+w),d.scset=[];var C=l.readUshort(i,o);for(o+=2,x=0;x<C;x++){var A=l.readUshort(i,o);o+=2,d.scset.push(A==0?null:e.GSUB.readSubClassSet(i,c+A))}}}else if(s==6&&d.fmt==3){if(d.fmt==3){for(x=0;x<3;x++){m=l.readUshort(i,o),o+=2;for(var N=[],D=0;D<m;D++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,o+2*D)));o+=2*m,x==0&&(d.backCvg=N),x==1&&(d.inptCvg=N),x==2&&(d.ahedCvg=N)}m=l.readUshort(i,o),o+=2,d.lookupRec=e.GSUB.readSubstLookupRecords(i,o,m)}}else{if(s==7&&d.fmt==1){var P=l.readUshort(i,o);o+=2;var O=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=P;else if(a.ltype!=P)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+O)}console.debug("unsupported GSUB table LookupType",s,"format",d.fmt)}return d},e.GSUB.readSubClassSet=function(i,s){var o=e._bin.readUshort,a=s,l=[],c=o(i,s);s+=2;for(var d=0;d<c;d++){var p=o(i,s);s+=2,l.push(e.GSUB.readSubClassRule(i,a+p))}return l},e.GSUB.readSubClassRule=function(i,s){var o=e._bin.readUshort,a={},l=o(i,s),c=o(i,s+=2);s+=2,a.input=[];for(var d=0;d<l-1;d++)a.input.push(o(i,s)),s+=2;return a.substLookupRecords=e.GSUB.readSubstLookupRecords(i,s,c),a},e.GSUB.readSubstLookupRecords=function(i,s,o){for(var a=e._bin.readUshort,l=[],c=0;c<o;c++)l.push(a(i,s),a(i,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var p=o.readUshort(i,s);s+=2,l.push(e.GSUB.readChainSubClassRule(i,a+p))}return l},e.GSUB.readChainSubClassRule=function(i,s){for(var o=e._bin,a={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var d=o.readUshort(i,s);s+=2,c==1&&d--,a[l[c]]=o.readUshorts(i,s,d),s+=2*a[l[c]].length}return d=o.readUshort(i,s),s+=2,a.subst=o.readUshorts(i,s,2*d),s+=2*a.subst.length,a},e.GSUB.readLigatureSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var p=o.readUshort(i,s);s+=2,l.push(e.GSUB.readLigature(i,a+p))}return l},e.GSUB.readLigature=function(i,s){var o=e._bin,a={chain:[]};a.nglyph=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2;for(var c=0;c<l-1;c++)a.chain.push(o.readUshort(i,s)),s+=2;return a},e.head={},e.head.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.fontRevision=a.readFixed(i,s),s+=4,a.readUint(i,s),s+=4,a.readUint(i,s),s+=4,l.flags=a.readUshort(i,s),s+=2,l.unitsPerEm=a.readUshort(i,s),s+=2,l.created=a.readUint64(i,s),s+=8,l.modified=a.readUint64(i,s),s+=8,l.xMin=a.readShort(i,s),s+=2,l.yMin=a.readShort(i,s),s+=2,l.xMax=a.readShort(i,s),s+=2,l.yMax=a.readShort(i,s),s+=2,l.macStyle=a.readUshort(i,s),s+=2,l.lowestRecPPEM=a.readUshort(i,s),s+=2,l.fontDirectionHint=a.readShort(i,s),s+=2,l.indexToLocFormat=a.readShort(i,s),s+=2,l.glyphDataFormat=a.readShort(i,s),s+=2,l},e.hhea={},e.hhea.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.ascender=a.readShort(i,s),s+=2,l.descender=a.readShort(i,s),s+=2,l.lineGap=a.readShort(i,s),s+=2,l.advanceWidthMax=a.readUshort(i,s),s+=2,l.minLeftSideBearing=a.readShort(i,s),s+=2,l.minRightSideBearing=a.readShort(i,s),s+=2,l.xMaxExtent=a.readShort(i,s),s+=2,l.caretSlopeRise=a.readShort(i,s),s+=2,l.caretSlopeRun=a.readShort(i,s),s+=2,l.caretOffset=a.readShort(i,s),s+=2,s+=8,l.metricDataFormat=a.readShort(i,s),s+=2,l.numberOfHMetrics=a.readUshort(i,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(i,s,o,a){for(var l=e._bin,c={aWidth:[],lsBearing:[]},d=0,p=0,m=0;m<a.maxp.numGlyphs;m++)m<a.hhea.numberOfHMetrics&&(d=l.readUshort(i,s),s+=2,p=l.readShort(i,s),s+=2),c.aWidth.push(d),c.lsBearing.push(p);return c},e.kern={},e.kern.parse=function(i,s,o,a){var l=e._bin,c=l.readUshort(i,s);if(s+=2,c==1)return e.kern.parseV1(i,s-2,o,a);var d=l.readUshort(i,s);s+=2;for(var p={glyph1:[],rval:[]},m=0;m<d;m++){s+=2,o=l.readUshort(i,s),s+=2;var x=l.readUshort(i,s);s+=2;var b=x>>>8;if((b&=15)!=0)throw"unknown kern table format: "+b;s=e.kern.readFormat0(i,s,p)}return p},e.kern.parseV1=function(i,s,o,a){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var d={glyph1:[],rval:[]},p=0;p<c;p++){l.readUint(i,s),s+=4;var m=l.readUshort(i,s);s+=2,l.readUshort(i,s),s+=2;var x=m>>>8;if((x&=15)!=0)throw"unknown kern table format: "+x;s=e.kern.readFormat0(i,s,d)}return d},e.kern.readFormat0=function(i,s,o){var a=e._bin,l=-1,c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var d=0;d<c;d++){var p=a.readUshort(i,s);s+=2;var m=a.readUshort(i,s);s+=2;var x=a.readShort(i,s);s+=2,p!=l&&(o.glyph1.push(p),o.rval.push({glyph2:[],vals:[]}));var b=o.rval[o.rval.length-1];b.glyph2.push(m),b.vals.push(x),l=p}return s},e.loca={},e.loca.parse=function(i,s,o,a){var l=e._bin,c=[],d=a.head.indexToLocFormat,p=a.maxp.numGlyphs+1;if(d==0)for(var m=0;m<p;m++)c.push(l.readUshort(i,s+(m<<1))<<1);if(d==1)for(m=0;m<p;m++)c.push(l.readUint(i,s+(m<<2)));return c},e.maxp={},e.maxp.parse=function(i,s,o){var a=e._bin,l={},c=a.readUint(i,s);return s+=4,l.numGlyphs=a.readUshort(i,s),s+=2,c==65536&&(l.maxPoints=a.readUshort(i,s),s+=2,l.maxContours=a.readUshort(i,s),s+=2,l.maxCompositePoints=a.readUshort(i,s),s+=2,l.maxCompositeContours=a.readUshort(i,s),s+=2,l.maxZones=a.readUshort(i,s),s+=2,l.maxTwilightPoints=a.readUshort(i,s),s+=2,l.maxStorage=a.readUshort(i,s),s+=2,l.maxFunctionDefs=a.readUshort(i,s),s+=2,l.maxInstructionDefs=a.readUshort(i,s),s+=2,l.maxStackElements=a.readUshort(i,s),s+=2,l.maxSizeOfInstructions=a.readUshort(i,s),s+=2,l.maxComponentElements=a.readUshort(i,s),s+=2,l.maxComponentDepth=a.readUshort(i,s),s+=2),l},e.name={},e.name.parse=function(i,s,o){var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2,a.readUshort(i,s);for(var d,p=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],m=s+=2,x=0;x<c;x++){var b=a.readUshort(i,s);s+=2;var _=a.readUshort(i,s);s+=2;var S=a.readUshort(i,s);s+=2;var w=a.readUshort(i,s);s+=2;var C=a.readUshort(i,s);s+=2;var A=a.readUshort(i,s);s+=2;var N,D=p[w],P=m+12*c+A;if(b==0)N=a.readUnicode(i,P,C/2);else if(b==3&&_==0)N=a.readUnicode(i,P,C/2);else if(_==0)N=a.readASCII(i,P,C);else if(_==1)N=a.readUnicode(i,P,C/2);else if(_==3)N=a.readUnicode(i,P,C/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=a.readASCII(i,P,C),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var O="p"+b+","+S.toString(16);l[O]==null&&(l[O]={}),l[O][D!==void 0?D:w]=N,l[O]._lang=S}for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==1033)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==0)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==3084)return l[R];for(var R in l)if(l[R].postScriptName!=null)return l[R];for(var R in l){d=R;break}return console.debug("returning name table with languageID "+l[d]._lang),l[d]},e["OS/2"]={},e["OS/2"].parse=function(i,s,o){var a=e._bin.readUshort(i,s);s+=2;var l={};if(a==0)e["OS/2"].version0(i,s,l);else if(a==1)e["OS/2"].version1(i,s,l);else if(a==2||a==3||a==4)e["OS/2"].version2(i,s,l);else{if(a!=5)throw"unknown OS/2 table version: "+a;e["OS/2"].version5(i,s,l)}return l},e["OS/2"].version0=function(i,s,o){var a=e._bin;return o.xAvgCharWidth=a.readShort(i,s),s+=2,o.usWeightClass=a.readUshort(i,s),s+=2,o.usWidthClass=a.readUshort(i,s),s+=2,o.fsType=a.readUshort(i,s),s+=2,o.ySubscriptXSize=a.readShort(i,s),s+=2,o.ySubscriptYSize=a.readShort(i,s),s+=2,o.ySubscriptXOffset=a.readShort(i,s),s+=2,o.ySubscriptYOffset=a.readShort(i,s),s+=2,o.ySuperscriptXSize=a.readShort(i,s),s+=2,o.ySuperscriptYSize=a.readShort(i,s),s+=2,o.ySuperscriptXOffset=a.readShort(i,s),s+=2,o.ySuperscriptYOffset=a.readShort(i,s),s+=2,o.yStrikeoutSize=a.readShort(i,s),s+=2,o.yStrikeoutPosition=a.readShort(i,s),s+=2,o.sFamilyClass=a.readShort(i,s),s+=2,o.panose=a.readBytes(i,s,10),s+=10,o.ulUnicodeRange1=a.readUint(i,s),s+=4,o.ulUnicodeRange2=a.readUint(i,s),s+=4,o.ulUnicodeRange3=a.readUint(i,s),s+=4,o.ulUnicodeRange4=a.readUint(i,s),s+=4,o.achVendID=[a.readInt8(i,s),a.readInt8(i,s+1),a.readInt8(i,s+2),a.readInt8(i,s+3)],s+=4,o.fsSelection=a.readUshort(i,s),s+=2,o.usFirstCharIndex=a.readUshort(i,s),s+=2,o.usLastCharIndex=a.readUshort(i,s),s+=2,o.sTypoAscender=a.readShort(i,s),s+=2,o.sTypoDescender=a.readShort(i,s),s+=2,o.sTypoLineGap=a.readShort(i,s),s+=2,o.usWinAscent=a.readUshort(i,s),s+=2,o.usWinDescent=a.readUshort(i,s),s+=2},e["OS/2"].version1=function(i,s,o){var a=e._bin;return s=e["OS/2"].version0(i,s,o),o.ulCodePageRange1=a.readUint(i,s),s+=4,o.ulCodePageRange2=a.readUint(i,s),s+=4},e["OS/2"].version2=function(i,s,o){var a=e._bin;return s=e["OS/2"].version1(i,s,o),o.sxHeight=a.readShort(i,s),s+=2,o.sCapHeight=a.readShort(i,s),s+=2,o.usDefault=a.readUshort(i,s),s+=2,o.usBreak=a.readUshort(i,s),s+=2,o.usMaxContext=a.readUshort(i,s),s+=2},e["OS/2"].version5=function(i,s,o){var a=e._bin;return s=e["OS/2"].version2(i,s,o),o.usLowerOpticalPointSize=a.readUshort(i,s),s+=2,o.usUpperOpticalPointSize=a.readUshort(i,s),s+=2},e.post={},e.post.parse=function(i,s,o){var a=e._bin,l={};return l.version=a.readFixed(i,s),s+=4,l.italicAngle=a.readFixed(i,s),s+=4,l.underlinePosition=a.readShort(i,s),s+=2,l.underlineThickness=a.readShort(i,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,s){var o=i.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var l=o.tables[a];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,d=0;d<l.endCount.length;d++)if(s<=l.endCount[d]){c=d;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(d=0;d<l.groups.length;d++){var p=l.groups[d];if(p[0]<=s&&s<=p[1])return p[2]+(s-p[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(i,s){var o={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[s]){var a=i.SVG.entries[s];return a==null?o:(typeof a=="string"&&(a=e.SVG.toPath(a),i.SVG.entries[s]=a),a)}if(i.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},c=i.CFF,d=i.CFF.Private;if(c.ROS){for(var p=0;c.FDSelect[p+2]<=s;)p+=2;d=c.FDArray[c.FDSelect[p+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,d,o)}else i.glyf&&e.U._drawGlyf(s,i,o);return o},e.U._drawGlyf=function(i,s,o){var a=s.glyf[i];a==null&&(a=s.glyf[i]=e.glyf._parseGlyf(s,i)),a!=null&&(a.noc>-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;o<i.noc;o++){for(var a=o==0?0:i.endPts[o-1]+1,l=i.endPts[o],c=a;c<=l;c++){var d=c==a?l:c-1,p=c==l?a:c+1,m=1&i.flags[c],x=1&i.flags[d],b=1&i.flags[p],_=i.xs[c],S=i.ys[c];if(c==a)if(m){if(!x){e.U.P.moveTo(s,_,S);continue}e.U.P.moveTo(s,i.xs[d],i.ys[d])}else x?e.U.P.moveTo(s,i.xs[d],i.ys[d]):e.U.P.moveTo(s,(i.xs[d]+_)/2,(i.ys[d]+S)/2);m?x&&e.U.P.lineTo(s,_,S):b?e.U.P.qcurveTo(s,_,S,i.xs[p],i.ys[p]):e.U.P.qcurveTo(s,_,S,(_+i.xs[p])/2,(S+i.ys[p])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(i,s,o){for(var a=0;a<i.parts.length;a++){var l={cmds:[],crds:[]},c=i.parts[a];e.U._drawGlyf(c.glyphIndex,s,l);for(var d=c.m,p=0;p<l.crds.length;p+=2){var m=l.crds[p],x=l.crds[p+1];o.crds.push(m*d.a+x*d.b+d.tx),o.crds.push(m*d.c+x*d.d+d.ty)}for(p=0;p<l.cmds.length;p++)o.cmds.push(l.cmds[p])}},e.U._getGlyphClass=function(i,s){var o=e._lctf.getInterval(s,i);return o==-1?0:s[o+2]},e.U._applySubs=function(i,s,o,a){for(var l=i.length-s-1,c=0;c<o.tabs.length;c++)if(o.tabs[c]!=null){var d,p=o.tabs[c];if(!p.coverage||(d=e._lctf.coverageIndex(p.coverage,i[s]))!=-1){if(o.ltype==1)i[s],p.fmt==1?i[s]=i[s]+p.delta:i[s]=p.newg[d];else if(o.ltype==4)for(var m=p.vals[d],x=0;x<m.length;x++){var b=m[x],_=b.chain.length;if(!(_>l)){for(var S=!0,w=0,C=0;C<_;C++){for(;i[s+w+(1+C)]==-1;)w++;b.chain[C]!=i[s+w+(1+C)]&&(S=!1)}if(S){for(i[s]=b.nglyph,C=0;C<_+w;C++)i[s+C+1]=-1;break}}}else if(o.ltype==5&&p.fmt==2)for(var A=e._lctf.getInterval(p.cDef,i[s]),N=p.cDef[A+2],D=p.scset[N],P=0;P<D.length;P++){var O=D[P],R=O.input;if(!(R.length>l)){for(S=!0,C=0;C<R.length;C++){var L=e._lctf.getInterval(p.cDef,i[s+1+C]);if(A==-1&&p.cDef[L+2]!=R[C]){S=!1;break}}if(S){var V=O.substLookupRecords;for(x=0;x<V.length;x+=2)V[x],V[x+1]}}}else if(o.ltype==6&&p.fmt==3){if(!e.U._glsCovered(i,p.backCvg,s-p.backCvg.length)||!e.U._glsCovered(i,p.inptCvg,s)||!e.U._glsCovered(i,p.ahedCvg,s+p.inptCvg.length))continue;var F=p.lookupRec;for(P=0;P<F.length;P+=2){A=F[P];var U=a[F[P+1]];e.U._applySubs(i,s+A,U,a)}}}}},e.U._glsCovered=function(i,s,o){for(var a=0;a<s.length;a++)if(e._lctf.coverageIndex(s[a],i[o+a])==-1)return!1;return!0},e.U.glyphsToPath=function(i,s,o){for(var a={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var d=s[c];if(d!=-1){for(var p=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,m=e.U.glyphToPath(i,d),x=0;x<m.crds.length;x+=2)a.crds.push(m.crds[x]+l),a.crds.push(m.crds[x+1]);for(o&&a.cmds.push(o),x=0;x<m.cmds.length;x++)a.cmds.push(m.cmds[x]);o&&a.cmds.push("X"),l+=i.hmtx.aWidth[d],c<s.length-1&&(l+=e.U.getPairAdjustment(i,d,p))}}return a},e.U.P={},e.U.P.moveTo=function(i,s,o){i.cmds.push("M"),i.crds.push(s,o)},e.U.P.lineTo=function(i,s,o){i.cmds.push("L"),i.crds.push(s,o)},e.U.P.curveTo=function(i,s,o,a,l,c,d){i.cmds.push("C"),i.crds.push(s,o,a,l,c,d)},e.U.P.qcurveTo=function(i,s,o,a,l){i.cmds.push("Q"),i.crds.push(s,o,a,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,s,o,a,l){for(var c=s.stack,d=s.nStems,p=s.haveWidth,m=s.width,x=s.open,b=0,_=s.x,S=s.y,w=0,C=0,A=0,N=0,D=0,P=0,O=0,R=0,L=0,V=0,F={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,F);var U=F.val;if(b+=F.size,U=="o1"||U=="o18")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,p=!0;else if(U=="o3"||U=="o23")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,p=!0;else if(U=="o4")c.length>1&&!p&&(m=c.shift()+a.nominalWidthX,p=!0),x&&e.U.P.closePath(l),S+=c.pop(),e.U.P.moveTo(l,_,S),x=!0;else if(U=="o5")for(;c.length>0;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);else if(U=="o6"||U=="o7")for(var W=c.length,Y=U=="o6",$=0;$<W;$++){var X=c.shift();Y?_+=X:S+=X,Y=!Y,e.U.P.lineTo(l,_,S)}else if(U=="o8"||U=="o24"){W=c.length;for(var Z=0;Z+6<=W;)w=_+c.shift(),C=S+c.shift(),A=w+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,w,C,A,N,_,S),Z+=6;U=="o24"&&(_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S))}else{if(U=="o11")break;if(U=="o1234"||U=="o1235"||U=="o1236"||U=="o1237")U=="o1234"&&(C=S,A=(w=_+c.shift())+c.shift(),V=N=C+c.shift(),P=N,R=S,_=(O=(D=(L=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,w,C,A,N,L,V),e.U.P.curveTo(l,D,P,O,R,_,S)),U=="o1235"&&(w=_+c.shift(),C=S+c.shift(),A=w+c.shift(),N=C+c.shift(),L=A+c.shift(),V=N+c.shift(),D=L+c.shift(),P=V+c.shift(),O=D+c.shift(),R=P+c.shift(),_=O+c.shift(),S=R+c.shift(),c.shift(),e.U.P.curveTo(l,w,C,A,N,L,V),e.U.P.curveTo(l,D,P,O,R,_,S)),U=="o1236"&&(w=_+c.shift(),C=S+c.shift(),A=w+c.shift(),V=N=C+c.shift(),P=N,O=(D=(L=A+c.shift())+c.shift())+c.shift(),R=P+c.shift(),_=O+c.shift(),e.U.P.curveTo(l,w,C,A,N,L,V),e.U.P.curveTo(l,D,P,O,R,_,S)),U=="o1237"&&(w=_+c.shift(),C=S+c.shift(),A=w+c.shift(),N=C+c.shift(),L=A+c.shift(),V=N+c.shift(),D=L+c.shift(),P=V+c.shift(),O=D+c.shift(),R=P+c.shift(),Math.abs(O-_)>Math.abs(R-S)?_=O+c.shift():S=R+c.shift(),e.U.P.curveTo(l,w,C,A,N,L,V),e.U.P.curveTo(l,D,P,O,R,_,S));else if(U=="o14"){if(c.length>0&&!p&&(m=c.shift()+o.nominalWidthX,p=!0),c.length==4){var K=c.shift(),ne=c.shift(),H=c.shift(),B=c.shift(),G=e.CFF.glyphBySE(o,H),j=e.CFF.glyphBySE(o,B);e.U._drawCFF(o.CharStrings[G],s,o,a,l),s.x=K,s.y=ne,e.U._drawCFF(o.CharStrings[j],s,o,a,l)}x&&(e.U.P.closePath(l),x=!1)}else if(U=="o19"||U=="o20")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,p=!0,b+=d+7>>3;else if(U=="o21")c.length>2&&!p&&(m=c.shift()+a.nominalWidthX,p=!0),S+=c.pop(),_+=c.pop(),x&&e.U.P.closePath(l),e.U.P.moveTo(l,_,S),x=!0;else if(U=="o22")c.length>1&&!p&&(m=c.shift()+a.nominalWidthX,p=!0),_+=c.pop(),x&&e.U.P.closePath(l),e.U.P.moveTo(l,_,S),x=!0;else if(U=="o25"){for(;c.length>6;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);w=_+c.shift(),C=S+c.shift(),A=w+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,w,C,A,N,_,S)}else if(U=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)w=_,C=S+c.shift(),_=A=w+c.shift(),S=(N=C+c.shift())+c.shift(),e.U.P.curveTo(l,w,C,A,N,_,S);else if(U=="o27")for(c.length%2&&(S+=c.shift());c.length>0;)C=S,A=(w=_+c.shift())+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N,e.U.P.curveTo(l,w,C,A,N,_,S);else if(U=="o10"||U=="o29"){var ie=U=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var ce=c.pop(),te=ie.Subrs[ce+ie.Bias];s.x=_,s.y=S,s.nStems=d,s.haveWidth=p,s.width=m,s.open=x,e.U._drawCFF(te,s,o,a,l),_=s.x,S=s.y,d=s.nStems,p=s.haveWidth,m=s.width,x=s.open}}else if(U=="o30"||U=="o31"){var se=c.length,le=(Z=0,U=="o31");for(Z+=se-(W=-3&se);Z<W;)le?(C=S,A=(w=_+c.shift())+c.shift(),S=(N=C+c.shift())+c.shift(),W-Z==5?(_=A+c.shift(),Z++):_=A,le=!1):(w=_,C=S+c.shift(),A=w+c.shift(),N=C+c.shift(),_=A+c.shift(),W-Z==5?(S=N+c.shift(),Z++):S=N,le=!0),e.U.P.curveTo(l,w,C,A,N,_,S),Z+=4}else{if((U+"").charAt(0)=="o")throw console.debug("Unknown operation: "+U,i),U;c.push(U)}}}s.x=_,s.y=S,s.nStems=d,s.haveWidth=p,s.width=m,s.open=x};var n=e,r={Typr:n};return t.Typr=n,t.default=r,Object.defineProperty(t,"__esModule",{value:!0}),t})({}).Typr}/*!
Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
(https://github.com/101arrowz/fflate) for use in Troika text rendering. 
Original licenses apply: 
- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
*/function MAe(){return(function(t){var e=Uint8Array,n=Uint16Array,r=Uint32Array,i=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(U,W){for(var Y=new n(31),$=0;$<31;++$)Y[$]=W+=1<<U[$-1];var X=new r(Y[30]);for($=1;$<30;++$)for(var Z=Y[$];Z<Y[$+1];++Z)X[Z]=Z-Y[$]<<5|$;return[Y,X]},l=a(i,2),c=l[0],d=l[1];c[28]=258,d[258]=28;for(var p=a(s,0)[0],m=new n(32768),x=0;x<32768;++x){var b=(43690&x)>>>1|(21845&x)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,m[x]=((65280&b)>>>8|(255&b)<<8)>>>1}var _=function(U,W,Y){for(var $=U.length,X=0,Z=new n(W);X<$;++X)++Z[U[X]-1];var K,ne=new n(W);for(X=0;X<W;++X)ne[X]=ne[X-1]+Z[X-1]<<1;{K=new n(1<<W);var H=15-W;for(X=0;X<$;++X)if(U[X])for(var B=X<<4|U[X],G=W-U[X],j=ne[U[X]-1]++<<G,ie=j|(1<<G)-1;j<=ie;++j)K[m[j]>>>H]=B}return K},S=new e(288);for(x=0;x<144;++x)S[x]=8;for(x=144;x<256;++x)S[x]=9;for(x=256;x<280;++x)S[x]=7;for(x=280;x<288;++x)S[x]=8;var w=new e(32);for(x=0;x<32;++x)w[x]=5;var C=_(S,9),A=_(w,5),N=function(U){for(var W=U[0],Y=1;Y<U.length;++Y)U[Y]>W&&(W=U[Y]);return W},D=function(U,W,Y){var $=W/8|0;return(U[$]|U[$+1]<<8)>>(7&W)&Y},P=function(U,W){var Y=W/8|0;return(U[Y]|U[Y+1]<<8|U[Y+2]<<16)>>(7&W)},O=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],R=function(U,W,Y){var $=new Error(W||O[U]);if($.code=U,Error.captureStackTrace&&Error.captureStackTrace($,R),!Y)throw $;return $},L=function(U,W,Y){var $=U.length;if(!$||Y&&!Y.l&&$<5)return W||new e(0);var X=!W||Y,Z=!Y||Y.i;Y||(Y={}),W||(W=new e(3*$));var K,ne=function(ut){var De=W.length;if(ut>De){var Ve=new e(Math.max(2*De,ut));Ve.set(W),W=Ve}},H=Y.f||0,B=Y.p||0,G=Y.b||0,j=Y.l,ie=Y.d,ce=Y.m,te=Y.n,se=8*$;do{if(!j){Y.f=H=D(U,B,1);var le=D(U,B+1,3);if(B+=3,!le){var re=U[(Fe=((K=B)/8|0)+(7&K&&1)+4)-4]|U[Fe-3]<<8,pe=Fe+re;if(pe>$){Z&&R(0);break}X&&ne(G+re),W.set(U.subarray(Fe,pe),G),Y.b=G+=re,Y.p=B=8*pe;continue}if(le==1)j=C,ie=A,ce=9,te=5;else if(le==2){var be=D(U,B,31)+257,xe=D(U,B+10,15)+4,Pe=be+D(U,B+5,31)+1;B+=14;for(var me=new e(Pe),ke=new e(19),we=0;we<xe;++we)ke[o[we]]=D(U,B+3*we,7);B+=3*xe;var Te=N(ke),oe=(1<<Te)-1,_e=_(ke,Te);for(we=0;we<Pe;){var Fe,Ue=_e[D(U,B,oe)];if(B+=15&Ue,(Fe=Ue>>>4)<16)me[we++]=Fe;else{var Oe=0,ue=0;for(Fe==16?(ue=3+D(U,B,3),B+=2,Oe=me[we-1]):Fe==17?(ue=3+D(U,B,7),B+=3):Fe==18&&(ue=11+D(U,B,127),B+=7);ue--;)me[we++]=Oe}}var Q=me.subarray(0,be),fe=me.subarray(be);ce=N(Q),te=N(fe),j=_(Q,ce),ie=_(fe,te)}else R(1);if(B>se){Z&&R(0);break}}X&&ne(G+131072);for(var Se=(1<<ce)-1,Ae=(1<<te)-1,ve=B;;ve=B){var qe=(Oe=j[P(U,B)&Se])>>>4;if((B+=15&Oe)>se){Z&&R(0);break}if(Oe||R(2),qe<256)W[G++]=qe;else{if(qe==256){ve=B,j=null;break}var Ee=qe-254;if(qe>264){var Ce=i[we=qe-257];Ee=D(U,B,(1<<Ce)-1)+c[we],B+=Ce}var Ye=ie[P(U,B)&Ae],Ze=Ye>>>4;if(Ye||R(3),B+=15&Ye,fe=p[Ze],Ze>3&&(Ce=s[Ze],fe+=P(U,B)&(1<<Ce)-1,B+=Ce),B>se){Z&&R(0);break}X&&ne(G+131072);for(var it=G+Ee;G<it;G+=4)W[G]=W[G-fe],W[G+1]=W[G+1-fe],W[G+2]=W[G+2-fe],W[G+3]=W[G+3-fe];G=it}}Y.l=j,Y.p=ve,Y.b=G,j&&(H=1,Y.m=ce,Y.d=ie,Y.n=te)}while(!H);return G==W.length?W:(function(ut,De,Ve){(Ve==null||Ve>ut.length)&&(Ve=ut.length);var lt=new(ut instanceof n?n:ut instanceof r?r:e)(Ve-De);return lt.set(ut.subarray(De,Ve)),lt})(W,0,G)},V=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(V,{stream:!0})}catch{}return t.convert_streams=function(U){var W=new DataView(U),Y=0;function $(){var be=W.getUint16(Y);return Y+=2,be}function X(){var be=W.getUint32(Y);return Y+=4,be}function Z(be){re.setUint16(pe,be),pe+=2}function K(be){re.setUint32(pe,be),pe+=4}for(var ne={signature:X(),flavor:X(),length:X(),numTables:$(),reserved:$(),totalSfntSize:X(),majorVersion:$(),minorVersion:$(),metaOffset:X(),metaLength:X(),metaOrigLength:X(),privOffset:X(),privLength:X()},H=0;Math.pow(2,H)<=ne.numTables;)H++;H--;for(var B=16*Math.pow(2,H),G=16*ne.numTables-B,j=12,ie=[],ce=0;ce<ne.numTables;ce++)ie.push({tag:X(),offset:X(),compLength:X(),origLength:X(),origChecksum:X()}),j+=16;var te,se=new Uint8Array(12+16*ie.length+ie.reduce((function(be,xe){return be+xe.origLength+4}),0)),le=se.buffer,re=new DataView(le),pe=0;return K(ne.flavor),Z(ne.numTables),Z(B),Z(H),Z(G),ie.forEach((function(be){K(be.tag),K(be.origChecksum),K(j),K(be.origLength),be.outOffset=j,(j+=be.origLength)%4!=0&&(j+=4-j%4)})),ie.forEach((function(be){var xe,Pe=U.slice(be.offset,be.offset+be.compLength);if(be.compLength!=be.origLength){var me=new Uint8Array(be.origLength);xe=new Uint8Array(Pe,2),L(xe,me)}else me=new Uint8Array(Pe);se.set(me,be.outOffset);var ke=0;(j=be.outOffset+be.origLength)%4!=0&&(ke=4-j%4),se.set(new Uint8Array(ke).buffer,be.outOffset+be.origLength),te=j+ke})),le.slice(0,te)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function TAe(t,e){const n={M:2,L:2,Q:4,C:6,Z:0},r={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=1,s=2,o=4,a=8,l=16,c=32;let d;function p(O){if(!d){const R={R:s,L:i,D:o,C:l,U:c,T:a};d=new Map;for(let L in r){let V=0;r[L].split(",").forEach(F=>{let[U,W]=F.split("+");U=parseInt(U,36),W=W?parseInt(W,36):0,d.set(V+=U,R[L]);for(let Y=W;Y--;)d.set(++V,R[L])})}}return d.get(O)||c}const m=1,x=2,b=3,_=4,S=[null,"isol","init","fina","medi"];function w(O){const R=new Uint8Array(O.length);let L=c,V=m,F=-1;for(let U=0;U<O.length;U++){const W=O.codePointAt(U);let Y=p(W)|0,$=m;Y&a||(L&(i|o|l)?Y&(s|o|l)?($=b,(V===m||V===b)&&R[F]++):Y&(i|c)&&(V===x||V===_)&&R[F]--:L&(s|c)&&(V===x||V===_)&&R[F]--,V=R[U]=$,L=Y,F=U,W>65535&&U++)}return R}function C(O,R){const L=[];for(let F=0;F<R.length;F++){const U=R.codePointAt(F);U>65535&&F++,L.push(t.U.codeToGlyph(O,U))}const V=O.GSUB;if(V){const{lookupList:F,featureList:U}=V;let W;const Y=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,$=[];U.forEach(X=>{if(Y.test(X.tag))for(let Z=0;Z<X.tab.length;Z++){if($[X.tab[Z]])continue;$[X.tab[Z]]=!0;const K=F[X.tab[Z]],ne=/^(isol|init|fina|medi)$/.test(X.tag);ne&&!W&&(W=w(R));for(let H=0;H<L.length;H++)(!W||!ne||S[W[H]]===X.tag)&&t.U._applySubs(L,H,K,F)}})}return L}function A(O,R){const L=new Int16Array(R.length*3);let V=0;for(;V<R.length;V++){const Y=R[V];if(Y===-1)continue;L[V*3+2]=O.hmtx.aWidth[Y];const $=O.GPOS;if($){const X=$.lookupList;for(let Z=0;Z<X.length;Z++){const K=X[Z];for(let ne=0;ne<K.tabs.length;ne++){const H=K.tabs[ne];if(K.ltype===1){if(t._lctf.coverageIndex(H.coverage,Y)!==-1&&H.pos){W(H.pos,V);break}}else if(K.ltype===2){let B=null,G=F();if(G!==-1){const j=t._lctf.coverageIndex(H.coverage,R[G]);if(j!==-1){if(H.fmt===1){const ie=H.pairsets[j];for(let ce=0;ce<ie.length;ce++)ie[ce].gid2===Y&&(B=ie[ce])}else if(H.fmt===2){const ie=t.U._getGlyphClass(R[G],H.classDef1),ce=t.U._getGlyphClass(Y,H.classDef2);B=H.matrix[ie][ce]}if(B){B.val1&&W(B.val1,G),B.val2&&W(B.val2,V);break}}}}else if(K.ltype===4){const B=t._lctf.coverageIndex(H.markCoverage,Y);if(B!==-1){const G=F(U),j=G===-1?-1:t._lctf.coverageIndex(H.baseCoverage,R[G]);if(j!==-1){const ie=H.markArray[B],ce=H.baseArray[j][ie.markClass];L[V*3]=ce.x-ie.x+L[G*3]-L[G*3+2],L[V*3+1]=ce.y-ie.y+L[G*3+1];break}}}else if(K.ltype===6){const B=t._lctf.coverageIndex(H.mark1Coverage,Y);if(B!==-1){const G=F();if(G!==-1){const j=R[G];if(N(O,j)===3){const ie=t._lctf.coverageIndex(H.mark2Coverage,j);if(ie!==-1){const ce=H.mark1Array[B],te=H.mark2Array[ie][ce.markClass];L[V*3]=te.x-ce.x+L[G*3]-L[G*3+2],L[V*3+1]=te.y-ce.y+L[G*3+1];break}}}}}}}}else if(O.kern&&!O.cff){const X=F();if(X!==-1){const Z=O.kern.glyph1.indexOf(R[X]);if(Z!==-1){const K=O.kern.rval[Z].glyph2.indexOf(Y);K!==-1&&(L[X*3+2]+=O.kern.rval[Z].vals[K])}}}}return L;function F(Y){for(let $=V-1;$>=0;$--)if(R[$]!==-1&&(!Y||Y(R[$])))return $;return-1}function U(Y){return N(O,Y)===1}function W(Y,$){for(let X=0;X<3;X++)L[$*3+X]+=Y[X]||0}}function N(O,R){const L=O.GDEF&&O.GDEF.glyphClassDef;return L?t.U._getGlyphClass(R,L):0}function D(...O){for(let R=0;R<O.length;R++)if(typeof O[R]=="number")return O[R]}function P(O){const R=Object.create(null),L=O["OS/2"],V=O.hhea,F=O.head.unitsPerEm,U=D(L&&L.sTypoAscender,V&&V.ascender,F),W={unitsPerEm:F,ascender:U,descender:D(L&&L.sTypoDescender,V&&V.descender,0),capHeight:D(L&&L.sCapHeight,U),xHeight:D(L&&L.sxHeight,U),lineGap:D(L&&L.sTypoLineGap,V&&V.lineGap),supportsCodePoint(Y){return t.U.codeToGlyph(O,Y)>0},forEachGlyph(Y,$,X,Z){let K=0;const ne=1/W.unitsPerEm*$,H=C(O,Y);let B=0;const G=A(O,H);return H.forEach((j,ie)=>{if(j!==-1){let ce=R[j];if(!ce){const{cmds:te,crds:se}=t.U.glyphToPath(O,j);let le="",re=0;for(let me=0,ke=te.length;me<ke;me++){const we=n[te[me]];le+=te[me];for(let Te=1;Te<=we;Te++)le+=(Te>1?",":"")+se[re++]}let pe,be,xe,Pe;if(se.length){pe=be=1/0,xe=Pe=-1/0;for(let me=0,ke=se.length;me<ke;me+=2){let we=se[me],Te=se[me+1];we<pe&&(pe=we),Te<be&&(be=Te),we>xe&&(xe=we),Te>Pe&&(Pe=Te)}}else pe=xe=be=Pe=0;ce=R[j]={index:j,advanceWidth:O.hmtx.aWidth[j],xMin:pe,yMin:be,xMax:xe,yMax:Pe,path:le}}Z.call(null,ce,K+G[ie*3]*ne,G[ie*3+1]*ne,B),K+=G[ie*3+2]*ne,X&&(K+=X*$)}B+=Y.codePointAt(B)>65535?2:1}),K}};return W}return function(R){const L=new Uint8Array(R,0,4),V=t._bin.readASCII(L,0,4);if(V==="wOFF")R=e(R);else if(V==="wOF2")throw new Error("woff2 fonts not supported");return P(t.parse(R)[0])}}const CAe=Hy({name:"Typr Font Parser",dependencies:[wAe,MAe,TAe],init(t,e,n){const r=t(),i=e();return n(r,i)}});/*!
Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
for use in Troika text rendering. 
Original MIT license applies
*/function EAe(){return(function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(A){var N=A>>5;this.buckets.set(N,(this.buckets.get(N)||0)|1<<(31&A))},e.prototype.has=function(A){var N=this.buckets.get(A>>5);return N!==void 0&&(N&1<<(31&A))!=0},e.prototype.serialize=function(){var A=[];return this.buckets.forEach((function(N,D){A.push((+D).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(D){var P=D.split(":");N.buckets.set(parseInt(P[0],36),parseInt(P[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(P){return P&i})(A).toString(16),D=(function(P){return(P&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+D+".json"}function o(A,N){var D=A&r,P=N.codePointAt(D/6|0);return((P=(P||48)-48)&1<<D%6)!=0}function a(A,N){var D;(D=A,D.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(P){return P.split("-").map((function(O){return parseInt(O.trim(),16)}))}))).forEach((function(P){var O=P[0],R=P[1];R===void 0&&(R=O),N(O,R)}))}function l(A,N){a(A,(function(D,P){for(var O=D;O<=P;O++)N(O)}))}var c={},d={},p=new WeakMap,m="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function x(A){var N=p.get(A);return N||(N=new e,l(A.ranges,(function(D){return N.add(D)})),p.set(A,N)),N}var b,_=new Map;function S(A,N,D){return A[N]?N:A[D]?D:(function(P){for(var O in P)return O})(A)}function w(A,N){var D=N;if(!A.includes(D)){D=1/0;for(var P=0;P<A.length;P++)Math.abs(A[P]-N)<Math.abs(D-N)&&(D=A[P])}return D}function C(A){return b||(b=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(N){b.add(N)}))),b.has(A)}return t.CodePointSet=e,t.clearCache=function(){c={},d={}},t.getFontsForString=function(A,N){N===void 0&&(N={});var D,P=N.lang;P===void 0&&(P=new RegExp("\\p{Script=Hangul}","u").test(D=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(D)?"ja":"en");var O=N.category;O===void 0&&(O="sans-serif");var R=N.style;R===void 0&&(R="normal");var L=N.weight;L===void 0&&(L=400);var V=(N.dataUrl||m).replace(/\/$/g,""),F=new Map,U=new Uint8Array(A.length),W={},Y={},$=new Array(A.length),X=new Map,Z=!1;function K(B){var G=_.get(B);return G||(G=fetch(V+"/"+B).then((function(j){if(!j.ok)throw new Error(j.statusText);return j.json().then((function(ie){if(!Array.isArray(ie)||ie[0]!==1)throw new Error("Incorrect schema version; need 1, got "+ie[0]);return ie[1]}))})).catch((function(j){if(V!==m)return Z||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+V+'", trying default CDN. '+j.message),Z=!0),V=m,_.delete(B),K(B);throw j})),_.set(B,G)),G}for(var ne=function(B){var G=A.codePointAt(B),j=s(G);$[B]=j,c[j]||X.has(j)||X.set(j,K(j).then((function(ie){c[j]=ie}))),G>65535&&(B++,H=B)},H=0;H<A.length;H++)ne(H);return Promise.all(X.values()).then((function(){X.clear();for(var B=function(j){var ie=A.codePointAt(j),ce=null,te=c[$[j]],se=void 0;for(var le in te){var re=Y[le];if(re===void 0&&(re=Y[le]=new RegExp(le).test(P||"en")),re){for(var pe in se=le,te[le])if(o(ie,te[le][pe])){ce=pe;break}break}}if(!ce){e:for(var be in te)if(be!==se){for(var xe in te[be])if(o(ie,te[be][xe])){ce=xe;break e}}}ce||(console.debug("No font coverage for U+"+ie.toString(16)),ce="latin"),$[j]=ce,d[ce]||X.has(ce)||X.set(ce,K("font-meta/"+ce+".json").then((function(Pe){d[ce]=Pe}))),ie>65535&&(j++,G=j)},G=0;G<A.length;G++)B(G);return Promise.all(X.values())})).then((function(){for(var B,G=null,j=0;j<A.length;j++){var ie=A.codePointAt(j);if(G&&(C(ie)||x(G).has(ie)))U[j]=U[j-1];else{G=d[$[j]];var ce=W[G.id];if(!ce){var te=G.typeforms,se=S(te,O,"sans-serif"),le=S(te[se],R,"normal"),re=w((B=te[se])===null||B===void 0?void 0:B[le],L);ce=W[G.id]=V+"/font-files/"+G.id+"/"+se+"."+le+"."+re+".woff"}var pe=F.get(ce);pe==null&&(pe=F.size,F.set(ce,pe)),U[j]=pe}ie>65535&&(j++,U[j]=U[j-1])}return{fontUrls:Array.from(F.keys()),chars:U}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function AAe(t,e){const n=Object.create(null),r=Object.create(null);function i(o,a){const l=c=>{console.error(`Failure loading font ${o}`,c)};try{const c=new XMLHttpRequest;c.open("get",o,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const d=t(c.response);d.src=o,a(d)}catch(d){l(d)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(o,a){let l=n[o];l?a(l):r[o]?r[o].push(a):(r[o]=[a],i(o,c=>{c.src=o,n[o]=c,r[o].forEach(d=>d(c)),delete r[o]}))}return function(o,a,{lang:l,fonts:c=[],style:d="normal",weight:p="normal",unicodeFontsURL:m}={}){const x=new Uint8Array(o.length),b=[];o.length||C();const _=new Map,S=[];if(d!=="italic"&&(d="normal"),typeof p!="number"&&(p=p==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(N=>!N.lang||N.lang.test(l)).reverse(),c.length){let O=0;(function R(L=0){for(let V=L,F=o.length;V<F;V++){const U=o.codePointAt(V);if(O===1&&b[x[V-1]].supportsCodePoint(U)||V>0&&/\s/.test(o[V]))x[V]=x[V-1],O===2&&(S[S.length-1][1]=V);else for(let W=x[V],Y=c.length;W<=Y;W++)if(W===Y){const $=O===2?S[S.length-1]:S[S.length]=[V,V];$[1]=V,O=2}else{x[V]=W;const{src:$,unicodeRange:X}=c[W];if(!X||A(U,X)){const Z=n[$];if(!Z){s($,()=>{R(V)});return}if(Z.supportsCodePoint(U)){let K=_.get(Z);typeof K!="number"&&(K=b.length,b.push(Z),_.set(Z,K)),x[V]=K,O=1;break}}}U>65535&&V+1<F&&(x[V+1]=x[V],V++,O===2&&(S[S.length-1][1]=V))}w()})()}else S.push([0,o.length-1]),w();function w(){if(S.length){const N=S.map(D=>o.substring(D[0],D[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:d,weight:p,dataUrl:m}).then(({fontUrls:D,chars:P})=>{const O=b.length;let R=0;S.forEach(V=>{for(let F=0,U=V[1]-V[0];F<=U;F++)x[V[0]+F]=P[R++]+O;R++});let L=0;D.forEach((V,F)=>{s(V,U=>{b[F+O]=U,++L===D.length&&C()})})})}else C()}function C(){a({chars:x,fonts:b})}function A(N,D){for(let P=0;P<D.length;P++){const[O,R=O]=D[P];if(O<=N&&N<=R)return!0}return!1}}}const NAe=Hy({name:"FontResolver",dependencies:[AAe,CAe,EAe],init(t,e,n){return t(e,n())}});function RAe(t,e){const r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",s=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function o({text:b,lang:_,fonts:S,style:w,weight:C,preResolvedFonts:A,unicodeFontsURL:N},D){const P=({chars:O,fonts:R})=>{let L,V;const F=[];for(let U=0;U<O.length;U++)O[U]!==V?(V=O[U],F.push(L={start:U,end:U,fontObj:R[O[U]]})):L.end=U;D(F)};A?P(A):t(b,P,{lang:_,fonts:S,style:w,weight:C,unicodeFontsURL:N})}function a({text:b="",font:_,lang:S,sdfGlyphSize:w=64,fontSize:C=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:D=0,lineHeight:P="normal",maxWidth:O=1/0,direction:R,textAlign:L="left",textIndent:V=0,whiteSpace:F="normal",overflowWrap:U="normal",anchorX:W=0,anchorY:Y=0,metricsOnly:$=!1,unicodeFontsURL:X,preResolvedFonts:Z=null,includeCaretPositions:K=!1,chunkedBoundsSize:ne=8192,colorRanges:H=null},B){const G=p(),j={fontLoad:0,typesetting:0};b.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),b=b.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),C=+C,D=+D,O=+O,P=P||"normal",V=+V,o({text:b,lang:S,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:X,preResolvedFonts:Z},ie=>{j.fontLoad=p()-G;const ce=isFinite(O);let te=null,se=null,le=null,re=null,pe=null,be=null,xe=null,Pe=null,me=0,ke=0,we=F!=="nowrap";const Te=new Map,oe=p();let _e=V,Fe=0,Ue=new m;const Oe=[Ue];ie.forEach(Ae=>{const{fontObj:ve}=Ae,{ascender:qe,descender:Ee,unitsPerEm:Ce,lineGap:Ye,capHeight:Ze,xHeight:it}=ve;let ut=Te.get(ve);if(!ut){const Ne=C/Ce,$e=P==="normal"?(qe-Ee+Ye)*Ne:P*C,ft=($e-(qe-Ee)*Ne)/2,nt=Math.min($e,(qe-Ee)*Ne),We=(qe+Ee)/2*Ne+nt/2;ut={index:Te.size,src:ve.src,fontObj:ve,fontSizeMult:Ne,unitsPerEm:Ce,ascender:qe*Ne,descender:Ee*Ne,capHeight:Ze*Ne,xHeight:it*Ne,lineHeight:$e,baseline:-ft-qe*Ne,caretTop:We,caretBottom:We-nt},Te.set(ve,ut)}const{fontSizeMult:De}=ut,Ve=b.slice(Ae.start,Ae.end+1);let lt,Le;ve.forEachGlyph(Ve,C,D,(Ne,$e,ft,nt)=>{$e+=Fe,nt+=Ae.start,lt=$e,Le=Ne;const We=b.charAt(nt),Ke=Ne.advanceWidth*De,je=Ue.count;let et;if("isEmpty"in Ne||(Ne.isWhitespace=!!We&&new RegExp(i).test(We),Ne.canBreakAfter=!!We&&s.test(We),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||r.test(We)),!Ne.isWhitespace&&!Ne.isEmpty&&ke++,we&&ce&&!Ne.isWhitespace&&$e+Ke+_e>O&&je){if(Ue.glyphAt(je-1).glyphObj.canBreakAfter)et=new m,_e=-$e;else for(let Lt=je;Lt--;)if(Lt===0&&U==="break-word"){et=new m,_e=-$e;break}else if(Ue.glyphAt(Lt).glyphObj.canBreakAfter){et=Ue.splitAt(Lt+1);const wt=et.glyphAt(0).x;_e-=wt;for(let yt=et.count;yt--;)et.glyphAt(yt).x-=wt;break}et&&(Ue.isSoftWrapped=!0,Ue=et,Oe.push(Ue),me=O)}let pt=Ue.glyphAt(Ue.count);pt.glyphObj=Ne,pt.x=$e+_e,pt.y=ft,pt.width=Ke,pt.charIndex=nt,pt.fontData=ut,We===`
`&&(Ue=new m,Oe.push(Ue),_e=-($e+Ke+D*C)+V)}),Fe=lt+Le.advanceWidth*De+D*C});let ue=0;Oe.forEach(Ae=>{let ve=!0;for(let qe=Ae.count;qe--;){const Ee=Ae.glyphAt(qe);ve&&!Ee.glyphObj.isWhitespace&&(Ae.width=Ee.x+Ee.width,Ae.width>me&&(me=Ae.width),ve=!1);let{lineHeight:Ce,capHeight:Ye,xHeight:Ze,baseline:it}=Ee.fontData;Ce>Ae.lineHeight&&(Ae.lineHeight=Ce);const ut=it-Ae.baseline;ut<0&&(Ae.baseline+=ut,Ae.cap+=ut,Ae.ex+=ut),Ae.cap=Math.max(Ae.cap,Ae.baseline+Ye),Ae.ex=Math.max(Ae.ex,Ae.baseline+Ze)}Ae.baseline-=ue,Ae.cap-=ue,Ae.ex-=ue,ue+=Ae.lineHeight});let Q=0,fe=0;if(W&&(typeof W=="number"?Q=-W:typeof W=="string"&&(Q=-me*(W==="left"?0:W==="center"?.5:W==="right"?1:c(W)))),Y&&(typeof Y=="number"?fe=-Y:typeof Y=="string"&&(fe=Y==="top"?0:Y==="top-baseline"?-Oe[0].baseline:Y==="top-cap"?-Oe[0].cap:Y==="top-ex"?-Oe[0].ex:Y==="middle"?ue/2:Y==="bottom"?ue:Y==="bottom-baseline"?-Oe[Oe.length-1].baseline:c(Y)*ue)),!$){const Ae=e.getEmbeddingLevels(b,R);te=new Uint16Array(ke),se=new Uint8Array(ke),le=new Float32Array(ke*2),re={},xe=[1/0,1/0,-1/0,-1/0],Pe=[],K&&(be=new Float32Array(b.length*4)),H&&(pe=new Uint8Array(ke*3));let ve=0,qe=-1,Ee=-1,Ce,Ye;if(Oe.forEach((Ze,it)=>{let{count:ut,width:De}=Ze;if(ut>0){let Ve=0;for(let nt=ut;nt--&&Ze.glyphAt(nt).glyphObj.isWhitespace;)Ve++;let lt=0,Le=0;if(L==="center")lt=(me-De)/2;else if(L==="right")lt=me-De;else if(L==="justify"&&Ze.isSoftWrapped){let nt=0;for(let We=ut-Ve;We--;)Ze.glyphAt(We).glyphObj.isWhitespace&&nt++;Le=(me-De)/nt}if(Le||lt){let nt=0;for(let We=0;We<ut;We++){let Ke=Ze.glyphAt(We);const je=Ke.glyphObj;Ke.x+=lt+nt,Le!==0&&je.isWhitespace&&We<ut-Ve&&(nt+=Le,Ke.width+=Le)}}const Ne=e.getReorderSegments(b,Ae,Ze.glyphAt(0).charIndex,Ze.glyphAt(Ze.count-1).charIndex);for(let nt=0;nt<Ne.length;nt++){const[We,Ke]=Ne[nt];let je=1/0,et=-1/0;for(let pt=0;pt<ut;pt++)if(Ze.glyphAt(pt).charIndex>=We){let Lt=pt,wt=pt;for(;wt<ut;wt++){let yt=Ze.glyphAt(wt);if(yt.charIndex>Ke)break;wt<ut-Ve&&(je=Math.min(je,yt.x),et=Math.max(et,yt.x+yt.width))}for(let yt=Lt;yt<wt;yt++){const Pt=Ze.glyphAt(yt);Pt.x=et-(Pt.x+Pt.width-je)}break}}let $e;const ft=nt=>$e=nt;for(let nt=0;nt<ut;nt++){const We=Ze.glyphAt(nt);$e=We.glyphObj;const Ke=$e.index,je=Ae.levels[We.charIndex]&1;if(je){const et=e.getMirroredCharacter(b[We.charIndex]);et&&We.fontData.fontObj.forEachGlyph(et,0,0,ft)}if(K){const{charIndex:et,fontData:pt}=We,Lt=We.x+Q,wt=We.x+We.width+Q;be[et*4]=je?wt:Lt,be[et*4+1]=je?Lt:wt,be[et*4+2]=Ze.baseline+pt.caretBottom+fe,be[et*4+3]=Ze.baseline+pt.caretTop+fe;const yt=et-qe;yt>1&&d(be,qe,yt),qe=et}if(H){const{charIndex:et}=We;for(;et>Ee;)Ee++,H.hasOwnProperty(Ee)&&(Ye=H[Ee])}if(!$e.isWhitespace&&!$e.isEmpty){const et=ve++,{fontSizeMult:pt,src:Lt,index:wt}=We.fontData,yt=re[Lt]||(re[Lt]={});yt[Ke]||(yt[Ke]={path:$e.path,pathBounds:[$e.xMin,$e.yMin,$e.xMax,$e.yMax]});const Pt=We.x+Q,zt=We.y+Ze.baseline+fe;le[et*2]=Pt,le[et*2+1]=zt;const Dt=Pt+$e.xMin*pt,Et=zt+$e.yMin*pt,Be=Pt+$e.xMax*pt,Qe=zt+$e.yMax*pt;Dt<xe[0]&&(xe[0]=Dt),Et<xe[1]&&(xe[1]=Et),Be>xe[2]&&(xe[2]=Be),Qe>xe[3]&&(xe[3]=Qe),et%ne===0&&(Ce={start:et,end:et,rect:[1/0,1/0,-1/0,-1/0]},Pe.push(Ce)),Ce.end++;const ht=Ce.rect;if(Dt<ht[0]&&(ht[0]=Dt),Et<ht[1]&&(ht[1]=Et),Be>ht[2]&&(ht[2]=Be),Qe>ht[3]&&(ht[3]=Qe),te[et]=Ke,se[et]=wt,H){const It=et*3;pe[It]=Ye>>16&255,pe[It+1]=Ye>>8&255,pe[It+2]=Ye&255}}}}}),be){const Ze=b.length-qe;Ze>1&&d(be,qe,Ze)}}const Se=[];Te.forEach(({index:Ae,src:ve,unitsPerEm:qe,ascender:Ee,descender:Ce,lineHeight:Ye,capHeight:Ze,xHeight:it})=>{Se[Ae]={src:ve,unitsPerEm:qe,ascender:Ee,descender:Ce,lineHeight:Ye,capHeight:Ze,xHeight:it}}),j.typesetting=p()-oe,B({glyphIds:te,glyphFontIndices:se,glyphPositions:le,glyphData:re,fontData:Se,caretPositions:be,glyphColors:pe,chunkedBounds:Pe,fontSize:C,topBaseline:fe+Oe[0].baseline,blockBounds:[Q,fe-ue,Q+me,fe],visibleBounds:xe,timings:j})})}function l(b,_){a({...b,metricsOnly:!0},S=>{const[w,C,A,N]=S.blockBounds;_({width:A-w,height:N-C})})}function c(b){let _=b.match(/^([\d.]+)%$/),S=_?parseFloat(_[1]):NaN;return isNaN(S)?0:S/100}function d(b,_,S){const w=b[_*4],C=b[_*4+1],A=b[_*4+2],N=b[_*4+3],D=(C-w)/S;for(let P=0;P<S;P++){const O=(_+P)*4;b[O]=w+D*P,b[O+1]=w+D*(P+1),b[O+2]=A,b[O+3]=N}}function p(){return(self.performance||Date).now()}function m(){this.data=[]}const x=["glyphObj","x","y","width","charIndex","fontData"];return m.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/x.length)},glyphAt(b){let _=m.flyweight;return _.data=this.data,_.index=b,_},splitAt(b){let _=new m;return _.data=this.data.splice(b*x.length),_}},m.flyweight=x.reduce((b,_,S,w)=>(Object.defineProperty(b,_,{get(){return this.data[this.index*x.length+S]},set(C){this.data[this.index*x.length+S]=C}}),b),{data:null,index:0}),{typeset:a,measure:l}}const rx=()=>(self.performance||Date).now(),qC=rZ();let uF;function kAe(t,e,n,r,i,s,o,a,l,c,d=!0){return d?PAe(t,e,n,r,i,s,o,a,l,c).then(null,p=>(uF||(console.warn("WebGL SDF generation failed, falling back to JS",p),uF=!0),fF(t,e,n,r,i,s,o,a,l,c))):fF(t,e,n,r,i,s,o,a,l,c)}const KM=[],DAe=5;let gk=0;function sZ(){const t=rx();for(;KM.length&&rx()-t<DAe;)KM.shift()();gk=KM.length?setTimeout(sZ,0):0}const PAe=(...t)=>new Promise((e,n)=>{KM.push(()=>{const r=rx();try{qC.webgl.generateIntoCanvas(...t),e({timing:rx()-r})}catch(i){n(i)}}),gk||(gk=setTimeout(sZ,0))}),IAe=4,OAe=2e3,dF={};let LAe=0;function fF(t,e,n,r,i,s,o,a,l,c){const d="TroikaTextSDFGenerator_JS_"+LAe++%IAe;let p=dF[d];return p||(p=dF[d]={workerModule:Hy({name:d,workerId:d,dependencies:[rZ,rx],init(m,x){const b=m().javascript.generate;return function(..._){const S=x();return{textureData:b(..._),timing:x()-S}}},getTransferables(m){return[m.textureData.buffer]}}),requests:0,idleTimer:null}),p.requests++,clearTimeout(p.idleTimer),p.workerModule(t,e,n,r,i,s).then(({textureData:m,timing:x})=>{const b=rx(),_=new Uint8Array(m.length*4);for(let S=0;S<m.length;S++)_[S*4+c]=m[S];return qC.webglUtils.renderImageData(o,_,a,l,t,e,1<<3-c),x+=rx()-b,--p.requests===0&&(p.idleTimer=setTimeout(()=>{hAe(d)},OAe)),{timing:x}})}function jAe(t){t._warm||(qC.webgl.isSupported(t),t._warm=!0)}const zAe=qC.webglUtils.resizeWebGLCanvasWithoutClearing,A_={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},FAe=new Sn;function s1(){return(self.performance||Date).now()}const hF=Object.create(null);function oZ(t,e){t=HAe({},t);const n=s1(),r=[];if(t.font&&r.push({label:"user",src:VAe(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||A_.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||A_.unicodeFontsURL,t.colorRanges!=null){let m={};for(let x in t.colorRanges)if(t.colorRanges.hasOwnProperty(x)){let b=t.colorRanges[x];typeof b!="number"&&(b=FAe.set(b).getHex()),m[x]=b}t.colorRanges=m}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=A_,{sdfGlyphSize:o}=t,a=i/o*4;let l=hF[o];if(!l){const m=document.createElement("canvas");m.width=i,m.height=o*256/a,l=hF[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:m,sdfTexture:new ro(m,void 0,void 0,void 0,rs,rs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,UAe(l)}const{sdfTexture:c,sdfCanvas:d}=l;cZ(t).then(m=>{const{glyphIds:x,glyphFontIndices:b,fontData:_,glyphPositions:S,fontSize:w,timings:C}=m,A=[],N=new Float32Array(x.length*4);let D=0,P=0;const O=s1(),R=_.map(W=>{let Y=l.glyphsByFont.get(W.src);return Y||l.glyphsByFont.set(W.src,Y=new Map),Y});x.forEach((W,Y)=>{const $=b[Y],{src:X,unitsPerEm:Z}=_[$];let K=R[$].get(W);if(!K){const{path:j,pathBounds:ie}=m.glyphData[X][W],ce=Math.max(ie[2]-ie[0],ie[3]-ie[1])/o*(A_.sdfMargin*o+.5),te=l.glyphCount++,se=[ie[0]-ce,ie[1]-ce,ie[2]+ce,ie[3]+ce];R[$].set(W,K={path:j,atlasIndex:te,sdfViewBox:se}),A.push(K)}const{sdfViewBox:ne}=K,H=S[P++],B=S[P++],G=w/Z;N[D++]=H+ne[0]*G,N[D++]=B+ne[1]*G,N[D++]=H+ne[2]*G,N[D++]=B+ne[3]*G,x[Y]=K.atlasIndex}),C.quads=(C.quads||0)+(s1()-O);const L=s1();C.sdf={};const V=d.height,F=Math.ceil(l.glyphCount/a),U=Math.pow(2,Math.ceil(Math.log2(F*o)));U>V&&(console.info(`Increasing SDF texture size ${V}->${U}`),zAe(d,i,U),c.dispose()),Promise.all(A.map(W=>aZ(W,l,t.gpuAccelerateSDF).then(({timing:Y})=>{C.sdf[W.atlasIndex]=Y}))).then(()=>{A.length&&!l.contextLost&&(lZ(l),c.needsUpdate=!0),C.sdfTotal=s1()-L,C.total=s1()-n,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:o,sdfExponent:s,glyphBounds:N,glyphAtlasIndices:x,glyphColors:m.glyphColors,caretPositions:m.caretPositions,chunkedBounds:m.chunkedBounds,ascender:m.ascender,descender:m.descender,lineHeight:m.lineHeight,capHeight:m.capHeight,xHeight:m.xHeight,topBaseline:m.topBaseline,blockBounds:m.blockBounds,visibleBounds:m.visibleBounds,timings:m.timings}))})}),Promise.resolve().then(()=>{l.contextLost||jAe(d)})}function aZ({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=A_,c=Math.max(n[2]-n[0],n[3]-n[1]),d=Math.floor(e/4),p=d%(a/r)*r,m=Math.floor(d/(a/r))*r,x=e%4;return kAe(r,r,t,n,c,l,i,p,m,x,o)}function UAe(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const r=[];t.glyphsByFont.forEach(i=>{i.forEach(s=>{r.push(aZ(s,t,!0))})}),Promise.all(r).then(()=>{lZ(t),t.sdfTexture.needsUpdate=!0})})}function BAe({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;oZ({font:t,sdfGlyphSize:n,text:i},r)}function HAe(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let NM;function VAe(t){return NM||(NM=typeof document>"u"?{}:document.createElement("a")),NM.href=t,NM.href}function lZ(t){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:r,height:i}=e,s=t.sdfCanvas.getContext("webgl");let o=n.image.data;(!o||o.length!==r*i*4)&&(o=new Uint8Array(r*i*4),n.image={width:r,height:i,data:o},n.flipY=!1,n.isDataTexture=!0),s.readPixels(0,0,r,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const GAe=Hy({name:"Typesetter",dependencies:[RAe,NAe,mAe],init(t,e,n){return t(e,n())}}),cZ=Hy({name:"Typesetter",dependencies:[GAe],init(t){return function(e){return new Promise(n=>{t.typeset(e,n)})}},getTransferables(t){const e=[];for(let n in t)t[n]&&t[n].buffer&&e.push(t[n].buffer);return e}});cZ.onMainThread;const pF={};function WAe(t){let e=pF[t];return e||(e=pF[t]=new Np(1,1,t,t).translate(.5,.5,0)),e}const $Ae="aTroikaGlyphBounds",mF="aTroikaGlyphIndex",qAe="aTroikaGlyphColor";class XAe extends HC{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Wo,this.boundingBox=new Eo}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=WAe(e);["position","normal","uv"].forEach(r=>{this.attributes[r]=n.attributes[r].clone()}),this.setIndex(n.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,n,r,i,s){this.updateAttributeData($Ae,e,4),this.updateAttributeData(mF,n,1),this.updateAttributeData(qAe,s,3),this._blockBounds=r,this._chunkedBounds=i,this.instanceCount=n.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:n,boundingBox:r}=this;if(n){const{PI:i,floor:s,min:o,max:a,sin:l,cos:c}=Math,d=i/2,p=i*2,m=Math.abs(n),x=e[0]/m,b=e[2]/m,_=s((x+d)/p)!==s((b+d)/p)?-m:o(l(x)*m,l(b)*m),S=s((x-d)/p)!==s((b-d)/p)?m:a(l(x)*m,l(b)*m),w=s((x+i)/p)!==s((b+i)/p)?m*2:a(m-c(x)*m,m-c(b)*m);r.min.set(_,e[1],n<0?-w:0),r.max.set(S,e[3],n<0?0:w)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let n=this.getAttribute(mF).count,r=this._chunkedBounds;if(r)for(let i=r.length;i--;){n=r[i].end;let s=r[i].rect;if(s[1]<e.w&&s[3]>e.y&&s[0]<e.z&&s[2]>e.x)break}this.instanceCount=n}updateAttributeData(e,n,r){const i=this.getAttribute(e);n?i&&i.array.length===n.length?(i.array.set(n),i.needsUpdate=!0):(this.setAttribute(e,new xx(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const YAe=`
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform vec4 uTroikaTotalBounds;
uniform vec4 uTroikaClipRect;
uniform mat3 uTroikaOrient;
uniform bool uTroikaUseGlyphColors;
uniform float uTroikaEdgeOffset;
uniform float uTroikaBlurRadius;
uniform vec2 uTroikaPositionOffset;
uniform float uTroikaCurveRadius;
attribute vec4 aTroikaGlyphBounds;
attribute float aTroikaGlyphIndex;
attribute vec3 aTroikaGlyphColor;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec3 vTroikaGlyphColor;
varying vec2 vTroikaGlyphDimensions;
`,KAe=`
vec4 bounds = aTroikaGlyphBounds;
bounds.xz += uTroikaPositionOffset.x;
bounds.yw -= uTroikaPositionOffset.y;

vec4 outlineBounds = vec4(
  bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
  bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
);
vec4 clippedBounds = vec4(
  clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
  clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
);

vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);

position.xy = mix(bounds.xy, bounds.zw, clippedXY);

uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);

float rad = uTroikaCurveRadius;
if (rad != 0.0) {
  float angle = position.x / rad;
  position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
  normal.xz = vec2(sin(angle), cos(angle));
}
  
position = uTroikaOrient * position;
normal = uTroikaOrient * normal;

vTroikaGlyphUV = clippedXY.xy;
vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);


float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
vec2 txStartUV = txUvPerSquare * vec2(
  mod(floor(aTroikaGlyphIndex / 4.0), txCols),
  floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
);
vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
`,ZAe=`
uniform sampler2D uTroikaSDFTexture;
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform float uTroikaSDFExponent;
uniform float uTroikaEdgeOffset;
uniform float uTroikaFillOpacity;
uniform float uTroikaBlurRadius;
uniform vec3 uTroikaStrokeColor;
uniform float uTroikaStrokeWidth;
uniform float uTroikaStrokeOpacity;
uniform bool uTroikaSDFDebug;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec2 vTroikaGlyphDimensions;

float troikaSdfValueToSignedDistance(float alpha) {
  // Inverse of exponential encoding in webgl-sdf-generator
  
  float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
  float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
  float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
  return signedDist;
}

float troikaGlyphUvToSdfValue(vec2 glyphUV) {
  vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
  vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
  float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
  return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
}

float troikaGlyphUvToDistance(vec2 uv) {
  return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
}

float troikaGetAADist() {
  
  #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
  return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
  #else
  return vTroikaGlyphDimensions.x / 64.0;
  #endif
}

float troikaGetFragDistValue() {
  vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
  float distance = troikaGlyphUvToDistance(clampedGlyphUV);
 
  // Extrapolate distance when outside bounds:
  distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : 
    length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);

  

  return distance;
}

float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
  #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
  float alpha = step(-distanceOffset, -distance);
  #else

  float alpha = smoothstep(
    distanceOffset + aaDist,
    distanceOffset - aaDist,
    distance
  );
  #endif

  return alpha;
}
`,QAe=`
float aaDist = troikaGetAADist();
float fragDistance = troikaGetFragDistValue();
float edgeAlpha = uTroikaSDFDebug ?
  troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
  troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));

#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
vec4 fillRGBA = gl_FragColor;
fillRGBA.a *= uTroikaFillOpacity;
vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
  -uTroikaStrokeWidth - aaDist,
  -uTroikaStrokeWidth + aaDist,
  fragDistance
));
gl_FragColor.a *= edgeAlpha;
#endif

if (edgeAlpha == 0.0) {
  discard;
}
`;function JAe(t){const e=mk(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Ht},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new fi(0,0,0,0)},uTroikaClipRect:{value:new fi(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Ht},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Sn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Sr},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:YAe,vertexTransform:KAe,fragmentDefs:ZAe,fragmentColorTransform:QAe,customRewriter({vertexShader:n,fragmentShader:r}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(r)&&(r=r.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(n)||(n=n.replace(iZ,`uniform vec3 diffuse;
$&
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
`))),{vertexShader:n,fragmentShader:r}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const $9=new Ap({color:16777215,side:Kc,transparent:!0}),gF=8421504,xF=new sr,RM=new He,tN=new He,g_=[],e6e=new He,nN="+x+y";function vF(t){return Array.isArray(t)?t[0]:t}let uZ=()=>{const t=new Fs(new Np(1,1),$9);return uZ=()=>t,t},dZ=()=>{const t=new Fs(new Np(1,1,32,1),$9);return dZ=()=>t,t};const t6e={type:"syncstart"},n6e={type:"synccomplete"},fZ=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],r6e=fZ.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let hZ=class extends Fs{constructor(){const e=new XAe;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=gF,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=nN,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(t6e),oZ({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(i=>i&&i())})),this.dispatchEvent(n6e),e&&e()})))}onBeforeRender(e,n,r,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return JAe(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=$9.clone());if((!e||!e.isDerivedFrom(n))&&(e=this._derivedMaterial=this.createDerivedMaterial(n),n.addEventListener("dispose",function r(){n.removeEventListener("dispose",r),e.dispose()})),this.hasOutline()){let r=e._outlineMtl;return r||(r=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),r.isTextOutlineMaterial=!0,r.depthWrite=!1,r.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),r.dispose()})),[r,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return vF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return vF(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const n=e.isTextOutlineMaterial,r=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:l}=i;r.uTroikaSDFTexture.value=a,r.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),r.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,r.uTroikaSDFExponent.value=i.sdfExponent,r.uTroikaTotalBounds.value.fromArray(l),r.uTroikaUseGlyphColors.value=!n&&!!i.glyphColors;let c=0,d=0,p=0,m,x,b,_=0,S=0;if(n){let{outlineWidth:C,outlineOffsetX:A,outlineOffsetY:N,outlineBlur:D,outlineOpacity:P}=this;c=this._parsePercent(C)||0,d=Math.max(0,this._parsePercent(D)||0),m=P,_=this._parsePercent(A)||0,S=this._parsePercent(N)||0}else p=Math.max(0,this._parsePercent(this.strokeWidth)||0),p&&(b=this.strokeColor,r.uTroikaStrokeColor.value.set(b??gF),x=this.strokeOpacity,x==null&&(x=1)),m=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(_,S),r.uTroikaBlurRadius.value=d,r.uTroikaStrokeWidth.value=p,r.uTroikaStrokeOpacity.value=x,r.uTroikaFillOpacity.value=m??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let w=this.clipRect;if(w&&Array.isArray(w)&&w.length===4)r.uTroikaClipRect.value.fromArray(w);else{const C=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-C,l[1]-C,l[2]+C,l[3]+C)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=n?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Sn;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||nN;if(o!==e._orientation){let a=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==nN&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,d,p,m]=l;RM.set(0,0,0)[d]=c==="-"?1:-1,tN.set(0,0,0)[m]=p==="-"?-1:1,xF.lookAt(e6e,RM.cross(tN),tN),a.setFromMatrix4(xF)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),r=n?parseFloat(n[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new Ht){n.copy(e);const r=this.curveRadius;return r&&(n.x=Math.atan2(e.x,Math.abs(r)-Math.abs(e.z))*Math.abs(r)),n}worldPositionToTextCoords(e,n=new Ht){return RM.copy(e),this.localPositionToTextCoords(this.worldToLocal(RM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?dZ():uZ(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let d=0;d<c.count;d++){let p=s[0]+c.getX(d)*(s[2]-s[0]);const m=s[1]+c.getY(d)*(s[3]-s[1]);let x=0;i&&(x=i-Math.cos(p/i)*i,p=Math.sin(p/i)*i),l.setXYZ(d,p,m,x)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,g_.length=0,o.raycast(e,g_);for(let d=0;d<g_.length;d++)g_[d].object=this,n.push(g_[d])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,r6e.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};fZ.forEach(t=>{const e="_private_"+t;Object.defineProperty(hZ.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Eo;new Sn;const mo=M.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:s,characters:o,onSync:a,...l},c)=>{const d=Mc(({invalidate:b})=>b),[p]=M.useState(()=>new hZ),[m,x]=M.useMemo(()=>{const b=[];let _="";return M.Children.forEach(s,S=>{typeof S=="string"||typeof S=="number"?_+=S:b.push(S)}),[b,_]},[s]);return FCe(()=>new Promise(b=>BAe({font:r,characters:o},b)),["troika-text",r,o]),M.useLayoutEffect(()=>void p.sync(()=>{d(),a&&a(p)})),M.useEffect(()=>()=>p.dispose(),[p]),M.createElement("primitive",fh({object:p,ref:c,font:r,text:x,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)}),um=M.forwardRef(({threshold:t=15,geometry:e,...n},r)=>{const i=M.useRef(null);M.useImperativeHandle(r,()=>i.current,[]);const s=M.useMemo(()=>[0,0,0,1,0,0],[]),o=M.useRef(null),a=M.useRef(null);return M.useLayoutEffect(()=>{const l=i.current.parent,c=e??(l==null?void 0:l.geometry);if(!c||o.current===c&&a.current===t)return;o.current=c,a.current=t;const p=new x9(c,t).attributes.position.array;i.current.geometry.setPositions(p),i.current.geometry.attributes.instanceStart.needsUpdate=!0,i.current.geometry.attributes.instanceEnd.needsUpdate=!0,i.current.computeLineDistances()}),M.createElement(lAe,fh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),i6e=M.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const p=Mc(P=>P.invalidate),m=Mc(P=>P.camera),x=Mc(P=>P.gl),b=Mc(P=>P.events),_=Mc(P=>P.setEvents),S=Mc(P=>P.set),w=Mc(P=>P.get),C=Mc(P=>P.performance),A=e||m,N=r||b.connected||x.domElement,D=M.useMemo(()=>new iAe(A),[A]);return WC(()=>{D.enabled&&D.update()},-1),M.useEffect(()=>(s&&D.connect(s===!0?N:s),D.connect(N),()=>void D.dispose()),[s,N,n,D,p]),M.useEffect(()=>{const P=L=>{p(),n&&C.regress(),o&&o(L)},O=L=>{a&&a(L)},R=L=>{l&&l(L)};return D.addEventListener("change",P),D.addEventListener("start",O),D.addEventListener("end",R),()=>{D.removeEventListener("start",O),D.removeEventListener("end",R),D.removeEventListener("change",P)}},[o,a,l,D,p,_]),M.useEffect(()=>{if(t){const P=w().controls;return S({controls:D}),()=>S({controls:P})}},[t,D]),M.createElement("primitive",fh({ref:d,object:D,enableDamping:i},c))}),Uf=1e-5;function s6e(t,e,n){const r=new Y0,i=n-Uf;return r.absarc(Uf,Uf,Uf,-Math.PI/2,-Math.PI,!0),r.absarc(Uf,e-i*2,Uf,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Uf,Math.PI/2,0,!0),r.absarc(t-i*2,Uf,Uf,0,-Math.PI/2,!0),r}const Zu=M.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:o=4,bevelSegments:a=4,creaseAngle:l=.4,children:c,...d},p){return M.createElement("mesh",fh({ref:p},d),M.createElement(o6e,{args:[e,n,r],radius:i,steps:s,smoothness:o,bevelSegments:a,creaseAngle:l}),c)}),o6e=M.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:o=4,bevelSegments:a=4,creaseAngle:l=.4,...c},d){const p=M.useMemo(()=>s6e(e,n,i),[e,n,i]),m=M.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:s,bevelSize:i-Uf,bevelThickness:i,curveSegments:o}),[r,i,o,a,s]),x=M.useRef(null);return M.useLayoutEffect(()=>{x.current&&(x.current.center(),KEe(x.current,l))},[p,m,l]),M.useImperativeHandle(d,()=>x.current),M.createElement("extrudeGeometry",fh({ref:x,args:[p,m]},c))});function vi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Nr(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=Number(t);return Number.isFinite(e)?e:null}return null}function wa(t){return typeof t=="string"?t:""}function rN(t){return!!t}function q9(t){if(typeof t!="string")return null;let e=t.trim();if(!e)return null;for(let n=0;n<2&&typeof e=="string";n+=1)try{e=JSON.parse(e)}catch{return null}return vi(e)}function pZ(t){if(!t)return null;const e=q9(t.setup);if(!e)return null;const n=wa(e.model),r=wa(e.schema_version),i=vi(e.cluster);if(!i)return null;const s=Array.isArray(i.nodes)?i.nodes:[],o=vi(e.trainer),a=vi(e.inference),l=new Map,c=Array.isArray(o==null?void 0:o.nodes)?o.nodes:[];for(const m of c){const x=vi(m);if(!x)continue;const b=Nr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const w=vi(S);if(!w)continue;const C=Nr(w.gpu_index);C!==null&&l.set(`${b}-${C}`,{role:"trainer",gpu_index:C,rank:Nr(w.rank)??void 0,dp_rank:Nr(w.dp_rank)??void 0,tp_rank:Nr(w.tp_rank)??void 0,pp_rank:Nr(w.pp_rank)??void 0})}}const d=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const m of d){const x=vi(m);if(!x)continue;const b=Nr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const w=vi(S);if(!w)continue;const C=Nr(w.gpu_index);C!==null&&l.set(`${b}-${C}`,{role:"inference",gpu_index:C,server_idx:Nr(w.server_idx)??void 0,tp_group_id:Nr(w.tp_group_id)??void 0,port:Nr(w.port)??void 0,url:wa(w.url)||void 0})}}const p=[];for(const m of s){const x=vi(m);if(!x)continue;const b=Nr(x.node_id)??0,_=vi(x.hardware),S=vi(_==null?void 0:_.cpu),w={model:wa(S==null?void 0:S.model),cores:Nr(S==null?void 0:S.cores)??0,logical_cores:Nr(S==null?void 0:S.logical_cores)??0,sockets:Nr(S==null?void 0:S.sockets)??1,architecture:wa(S==null?void 0:S.architecture),frequency_mhz:Nr(S==null?void 0:S.frequency_mhz)??0},C=vi(_==null?void 0:_.memory),A={total_gb:Nr(C==null?void 0:C.total_gb)??0},N=vi(_==null?void 0:_.gpu),P=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((W,Y)=>{const $=vi(W),X=Y,Z=`${b}-${X}`,K=l.get(Z)??{role:"unassigned",gpu_index:X};return{hardware:{name:wa($==null?void 0:$.name),memory_total_gb:Nr($==null?void 0:$.memory_total_gb)??0,pcie_gen:Nr($==null?void 0:$.pcie_gen)??0,pcie_width:Nr($==null?void 0:$.pcie_width)??0,serial:wa($==null?void 0:$.serial),uuid:wa($==null?void 0:$.uuid)},role:K,local_index:X}}),O=vi(N==null?void 0:N.interconnect),R=O?{nvlink:rN(O.nvlink),topology:wa(O.topology),links_per_gpu:Nr(O.links_per_gpu)??0,speed_gbps:Nr(O.speed_gbps)??0,connections:Nr(O.connections)??0}:null,L=vi(x.software),V=vi(L==null?void 0:L.os),F=vi(L==null?void 0:L.container),U=vi(L==null?void 0:L.packages);p.push({node_id:b,hostname:wa(x.hostname),ip:wa(x.ip),is_driver:rN(x.is_driver),cpu:w,memory:A,gpus:P,interconnect:R,os:wa(V==null?void 0:V.platform),container:F?{runtime:wa(F.runtime),is_container:rN(F.is_container)}:null,software:{cuda:wa(U==null?void 0:U.cuda),pytorch:wa(U==null?void 0:U.pytorch),python:wa(U==null?void 0:U.python)}})}return{model:n,schema_version:r,nodes:p,total_gpus:Nr(i.total_gpus)??0,trainer_total_gpus:Nr(o==null?void 0:o.total_gpus)??0,inference_total_gpus:Nr(a==null?void 0:a.total_gpus)??0,trainer_config:o?{data_parallel_size:Nr(o.data_parallel_size)??0,megatron_tensor_parallel_size:Nr(o.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Nr(o.megatron_pipeline_parallel_size)??0,backend:wa(o.backend),world_size:Nr(o.world_size)??0}:null,inference_config:a?{num_servers:Nr(a.num_servers)??0,tensor_parallel_size:Nr(a.tensor_parallel_size)??0,placement_strategy:wa(a.placement_strategy)}:null}}const a6e={trainer:"#2563eb",inference:"#dc2626",unassigned:"#111111",nvlink:"#c7d5f0",nvlinkDot:"#f0f0f0",platform:"#ffffff",platformBorder:"#111111",gpuBody:"#ffffff",gpuBodyHover:"#ffffff",moduleBody:"#ffffff",moduleBodyHover:"#ffffff",chip:"#ffffff",chipBorder:"#ededed",textBlack:"#000000",textDark:"#000000",textMuted:"#000000",textLight:"#000000",background:"#ffffff",gridColor:"#ffffff"},l6e={trainer:"#3b82f6",inference:"#ef4444",unassigned:"#d4d4d4",nvlink:"#3b5998",nvlinkDot:"#4a4a4a",platform:"#1e1e1e",platformBorder:"#555555",gpuBody:"#2a2a2a",gpuBodyHover:"#333333",moduleBody:"#2a2a2a",moduleBodyHover:"#333333",chip:"#2a2a2a",chipBorder:"#444444",textBlack:"#e5e5e5",textDark:"#e5e5e5",textMuted:"#a3a3a3",textLight:"#d4d4d4",background:"#141414",gridColor:"#141414"};function mu(){return Jn(No)?l6e:a6e}function c6e(t){const e=t.replace(/-\d+GB$/i,"").replace(/-/g," "),n=e.split(/\s+/);if(n.length<=1)return{brand:"",model:e};const r=n[0],i=n.slice(1).join(" ");return{brand:r,model:i}}function u6e({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:o}){const a=mu(),l=e.role.role==="trainer"?a.trainer:e.role.role==="inference"?a.inference:a.unassigned,c=e.role.role==="trainer"?"Trainer":e.role.role==="inference"?"Inference":"",{brand:d,model:p}=c6e(e.hardware.name),m=.095;return f.jsxs("group",{position:t,children:[f.jsxs(Zu,{args:[.95,.18,.6],radius:0,smoothness:4,onPointerOver:x=>{x.stopPropagation(),r()},onPointerOut:i,onClick:x=>{x.stopPropagation(),s()},children:[f.jsx("meshBasicMaterial",{color:o?a.gpuBodyHover:a.gpuBody}),f.jsx(um,{color:a.platformBorder,threshold:1,scale:1.002})]}),e.role.role!=="unassigned"&&f.jsxs(f.Fragment,{children:[f.jsxs("mesh",{position:[-.34,m-.003,-.2],rotation:[-Math.PI/2,0,0],children:[f.jsx("planeGeometry",{args:[.055,.055]}),f.jsx("meshStandardMaterial",{color:l,side:Kc})]}),f.jsx(mo,{position:[-.285,m,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:a.textBlack,anchorX:"left",anchorY:"middle",children:c})]}),f.jsx(mo,{position:[0,m,-.04],rotation:[-Math.PI/2,0,0],fontSize:.055,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:d}),f.jsx(mo,{position:[0,m,.07],rotation:[-Math.PI/2,0,0],fontSize:.07,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:p}),f.jsx(mo,{position:[.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"right",anchorY:"middle",children:`GPU ${e.local_index}`}),e.role.rank!==void 0&&f.jsx(mo,{position:[-.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"left",anchorY:"middle",children:`Rank ${e.role.rank}`}),e.role.server_idx!==void 0&&f.jsx(mo,{position:[-.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"left",anchorY:"middle",children:`Server ${e.role.server_idx}`}),o&&f.jsx(V9,{position:[0,.35,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:f.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.hardware.name}),f.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"VRAM"}),f.jsxs("span",{className:"font-mono",children:[e.hardware.memory_total_gb," GB"]})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"PCIe"}),f.jsxs("span",{className:"font-mono",children:["Gen",e.hardware.pcie_gen," x",e.hardware.pcie_width]})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Role"}),f.jsxs("span",{className:"font-semibold",style:{color:l},children:[e.role.role.charAt(0).toUpperCase()+e.role.role.slice(1),e.role.rank!==void 0&&` (rank ${e.role.rank})`,e.role.server_idx!==void 0&&` (server ${e.role.server_idx})`]})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Node"}),f.jsxs("span",{className:"font-mono",children:["#",n]})]})]})]})})]})}function d6e({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){const s=mu(),o=.063;return f.jsxs("group",{position:t,children:[f.jsxs(Zu,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,children:[f.jsx("meshBasicMaterial",{color:n?s.moduleBodyHover:s.moduleBody}),f.jsx(um,{color:s.platformBorder,threshold:1,scale:1.002})]}),f.jsx(mo,{position:[0,o,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:s.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),f.jsx(mo,{position:[0,o,.05],rotation:[-Math.PI/2,0,0],fontSize:.055,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${e}GB`})]})}function f6e(t){return t.replace(/\b(AMD|Intel|ARM)\b/gi,"").replace(/\d+-Core Processor/gi,"").replace(/\bProcessor\b/gi,"").replace(/\(R\)|\(TM\)/gi,"").replace(/\s+/g," ").trim()||t}function h6e({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=mu(),a=f6e(e.model);return f.jsxs("group",{position:t,children:[f.jsxs(Zu,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[f.jsx("meshBasicMaterial",{color:n?o.gpuBodyHover:o.chip}),f.jsx(um,{color:o.platformBorder,threshold:1,scale:1.002})]}),f.jsxs("mesh",{position:[0,.041,0],children:[f.jsx("boxGeometry",{args:[.45,.005,.45]}),f.jsx("meshBasicMaterial",{color:o.platform}),f.jsx(um,{color:o.platformBorder,threshold:1,scale:1.002})]}),f.jsx(mo,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:o.textBlack,anchorX:"center",anchorY:"middle",children:a}),f.jsx(mo,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),f.jsx(mo,{position:[0,.05,.1],rotation:[-Math.PI/2,0,0],fontSize:.028,color:o.textBlack,anchorX:"center",anchorY:"middle",children:`${e.cores}C / ${e.logical_cores}T`}),n&&f.jsx(V9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:f.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.model}),f.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Cores"}),f.jsx("span",{className:"font-mono",children:e.cores})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Threads"}),f.jsx("span",{className:"font-mono",children:e.logical_cores})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Sockets"}),f.jsx("span",{className:"font-mono",children:e.sockets})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Frequency"}),f.jsxs("span",{className:"font-mono",children:[(e.frequency_mhz/1e3).toFixed(2)," GHz"]})]}),f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Arch"}),f.jsx("span",{className:"font-mono",children:e.architecture})]})]})]})})]})}function p6e({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=mu(),a=.063;return f.jsxs("group",{position:t,children:[f.jsxs(Zu,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[f.jsx("meshBasicMaterial",{color:n?o.moduleBodyHover:o.moduleBody}),f.jsx(um,{color:o.platformBorder,threshold:1,scale:1.002})]}),f.jsx(mo,{position:[0,a,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),f.jsx(mo,{position:[0,a,.05],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${Math.round(e.total_gb)}GB`}),n&&f.jsx(V9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:f.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[140px]",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:"System Memory"}),f.jsx("div",{className:"text-[10px] text-foreground space-y-0.5",children:f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:"Total"}),f.jsxs("span",{className:"font-mono",children:[e.total_gb.toFixed(0)," GB"]})]})})]})})]})}function m6e({vramPositions:t,vramDepth:e,interconnect:n}){const r=mu();if(!(n!=null&&n.nvlink)||t.length<2)return null;const i=[...t].sort((m,x)=>m[0]-x[0]),s=i[0][0],o=i[i.length-1][0],a=(s+o)/2,l=o-s,d=t[0][2]-e/2-.18,p=.065;return f.jsxs("group",{children:[f.jsx(Zu,{args:[l,.02,.035],radius:.002,smoothness:4,position:[a,p,d],children:f.jsx("meshBasicMaterial",{color:r.nvlink})}),t.map((m,x)=>{const b=m[2]-e/2,_=Math.abs(b-d),S=(b+d)/2;return f.jsx("group",{children:f.jsx(Zu,{args:[.02,.02,_],radius:.001,smoothness:2,position:[m[0],p,S],children:f.jsx("meshBasicMaterial",{color:r.nvlink})})},x)}),f.jsx(mo,{position:[a,.035,d-.15],rotation:[-Math.PI/2,0,0],fontSize:.06,color:r.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`NVLink · ${n.links_per_gpu} links/GPU · ${n.speed_gbps} Gbps`})]})}function g6e({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=mu(),o=t.gpus.length,a=1.15,l=o*a,c=Math.max(l+1.8,3.5),d=3.2,p=.6,m=.35,x=.6,b=.06,_=-.15,S=_-p/2-b-m/2,w=_+p/2+.08,C=w+.4+x/2,A=t.gpus.map((D,P)=>[P*a-(l-a)/2,.14,_]),N=t.gpus.map((D,P)=>[P*a-(l-a)/2,.11,S]);return f.jsxs("group",{position:e,children:[f.jsxs(Zu,{args:[c,.06,d],radius:0,smoothness:4,children:[f.jsx("meshBasicMaterial",{color:s.platform}),f.jsx(um,{color:s.platformBorder,threshold:1,scale:1.002})]}),f.jsxs(mo,{position:[0,.04,-d/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.09,color:s.textBlack,anchorX:"center",anchorY:"middle",children:[`Node ${t.node_id}`,t.is_driver?" (Driver)":""]}),f.jsx(mo,{position:[0,.04,-d/2+.3],rotation:[-Math.PI/2,0,0],fontSize:.05,color:s.textBlack,anchorX:"center",anchorY:"middle",children:`${t.hostname} · ${t.ip}`}),t.gpus.map((D,P)=>{const O=A[P],R=[e[0]+O[0],e[1]+O[1],e[2]+O[2]];return f.jsxs("group",{children:[f.jsx(u6e,{position:O,gpu:D,nodeId:t.node_id,isHovered:n===`gpu-${t.node_id}-${D.local_index}`,onHover:()=>r(`gpu-${t.node_id}-${D.local_index}`),onUnhover:()=>r(null),onClick:()=>i({type:"gpu",nodeId:t.node_id,gpuIndex:D.local_index,data:D,worldPosition:R})}),f.jsx(d6e,{position:N[P],memoryGb:D.hardware.memory_total_gb,isHovered:n===`vram-${t.node_id}-${D.local_index}`,onHover:()=>r(`vram-${t.node_id}-${D.local_index}`),onUnhover:()=>r(null)})]},P)}),f.jsx(m6e,{vramPositions:N,vramDepth:m,interconnect:t.interconnect}),(()=>{const D=[0,.09,C],P=[.75,.11,C],O=[e[0]+D[0],e[1]+D[1],e[2]+D[2]],R=[e[0]+P[0],e[1]+P[1],e[2]+P[2]];return f.jsxs(f.Fragment,{children:[f.jsx(h6e,{position:D,cpu:t.cpu,isHovered:n===`cpu-${t.node_id}`,onHover:()=>r(`cpu-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"cpu",nodeId:t.node_id,data:t.cpu,worldPosition:O})}),f.jsx(p6e,{position:P,memory:t.memory,isHovered:n===`mem-${t.node_id}`,onHover:()=>r(`mem-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"ram",nodeId:t.node_id,data:t.memory,worldPosition:R})})]})})(),(()=>{var Z,K;const D=((Z=t.gpus[0])==null?void 0:Z.hardware.pcie_gen)??0,P=((K=t.gpus[0])==null?void 0:K.hardware.pcie_width)??0;if(D===0||o<1)return null;const O=[...A].sort((ne,H)=>ne[0]-H[0]),R=O[0][0],L=O[O.length-1][0],V=(R+L)/2,F=L-R,U=.065,W=w,Y=C-x/2,$=Math.abs(Y-W),X=(W+Y)/2;return f.jsxs("group",{children:[f.jsx(Zu,{args:[F,.02,.035],radius:.002,smoothness:4,position:[V,U,w],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})}),A.map((ne,H)=>{const B=_+p/2,G=Math.abs(w-B),j=(B+w)/2;return f.jsx("group",{children:f.jsx(Zu,{args:[.02,.02,G],radius:.001,smoothness:2,position:[ne[0],U,j],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})})},H)}),f.jsx(Zu,{args:[.02,.02,$],radius:.001,smoothness:2,position:[0,U,X],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})}),f.jsx(mo,{position:[.15,.035,X],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:$-.1,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${D} x${P}`})]})})(),(()=>{const D=[];return t.software.cuda&&D.push(`CUDA ${t.software.cuda}`),t.software.pytorch&&D.push(`PyTorch ${t.software.pytorch}`),t.software.python&&D.push(`Python ${t.software.python}`),D.length===0?null:f.jsx(mo,{position:[0,.035,d/2-.1],rotation:[-Math.PI/2,0,0],fontSize:.03,color:s.textBlack,anchorX:"center",anchorY:"middle",children:D.join(" · ")})})()]})}function mZ(){const t=mu();return f.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.05,0],children:[f.jsx("planeGeometry",{args:[50,50]}),f.jsx("meshBasicMaterial",{color:t.background})]})}function x6e({node:t,position:e,onClick:n}){const r=mu(),[i,s]=M.useState(!1),o=M.useRef(null);M.useEffect(()=>()=>{document.body.style.cursor="auto"},[]);const a=t.gpus.filter(_=>_.role.role==="trainer").length,l=t.gpus.filter(_=>_.role.role==="inference").length,c=t.gpus.length,d=(()=>{const _=[`${c} GPUs`],S=[];return a>0&&S.push(`${a}T`),l>0&&S.push(`${l}I`),S.length>0&&_.push(S.join(" ")),_.join(" · ")})(),p=2.5,m=1.5,x=.5,b=x/2+.005;return WC(()=>{if(!o.current)return;const _=i?e[1]+.06:e[1];o.current.position.y+=(_-o.current.position.y)*.15}),f.jsxs("group",{ref:o,position:e,children:[f.jsxs(Zu,{args:[p,x,m],radius:0,smoothness:4,onPointerOver:_=>{_.stopPropagation(),s(!0),document.body.style.cursor="pointer"},onPointerOut:()=>{s(!1),document.body.style.cursor="auto"},onClick:_=>{_.stopPropagation(),document.body.style.cursor="auto",n()},children:[f.jsx("meshBasicMaterial",{color:r.platform}),f.jsx(um,{color:i?r.trainer:r.platformBorder,threshold:1,scale:1.002})]}),t.gpus.map((_,S)=>{const N=-(c*.18+(c-1)*.06)/2+.18/2+S*(.18+.06),D=_.role.role==="trainer"?r.trainer:_.role.role==="inference"?r.inference:r.unassigned;return f.jsxs("mesh",{position:[N,x/2+.025,-.15],children:[f.jsx("boxGeometry",{args:[.18,.04,.22]}),f.jsx("meshBasicMaterial",{color:D})]},S)}),f.jsxs(mo,{position:[-p/2+.15,b,-m/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.12,color:r.textBlack,anchorX:"left",anchorY:"middle",fontWeight:700,children:[`Node ${t.node_id}`,t.is_driver?"  DRIVER":""]}),f.jsx(mo,{position:[-p/2+.15,b,-m/2+.35],rotation:[-Math.PI/2,0,0],fontSize:.07,color:r.textBlack,anchorX:"left",anchorY:"middle",children:t.hostname}),f.jsx(mo,{position:[-p/2+.15,b,.25],rotation:[-Math.PI/2,0,0],fontSize:.08,color:r.textBlack,anchorX:"left",anchorY:"middle",children:d}),f.jsx(mo,{position:[-p/2+.15,b,.45],rotation:[-Math.PI/2,0,0],fontSize:.06,color:r.textBlack,anchorX:"left",anchorY:"middle",children:`${t.cpu.cores}C CPU · ${Math.round(t.memory.total_gb)}GB RAM`})]})}function v6e({topology:t,onSelectNode:e}){const n=mu(),r=n.background==="#ffffff"?"#ffffff":"#888888",i=n.background==="#ffffff"?"#ffffff":"#333333",s=2.5,o=1.5,a=M.useMemo(()=>{const c=[],d=Math.ceil(Math.sqrt(t.nodes.length)),p=3.2,m=2.2;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/d),S=b%d,C=-(Math.min(d,t.nodes.length-_*d)-1)*p/2;c.push([S*p+C,.3,_*m])}),c},[t.nodes]),l=M.useMemo(()=>{if(a.length===0)return{w:4,d:3,cx:0,cz:0};let c=1/0,d=-1/0,p=1/0,m=-1/0;for(const[b,,_]of a)c=Math.min(c,b-s/2),d=Math.max(d,b+s/2),p=Math.min(p,_-o/2),m=Math.max(m,_+o/2);const x=.6;return{w:d-c+x*2,d:m-p+x*2,cx:(c+d)/2,cz:(p+m)/2}},[a]);return f.jsxs(f.Fragment,{children:[f.jsx("color",{attach:"background",args:[n.background]}),f.jsx("ambientLight",{intensity:.7}),f.jsx("directionalLight",{position:[8,12,5],intensity:.8}),f.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),f.jsx("hemisphereLight",{color:r,groundColor:i,intensity:.5}),f.jsx(mZ,{}),f.jsx("gridHelper",{args:[50,50,n.gridColor,n.gridColor],position:[0,-.04,0]}),f.jsxs(Zu,{args:[l.w,.06,l.d],radius:0,smoothness:4,position:[l.cx,0,l.cz],children:[f.jsx("meshBasicMaterial",{color:n.platform}),f.jsx(um,{color:n.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((c,d)=>f.jsx(x6e,{node:c,position:a[d],onClick:()=>e(c.node_id)},c.node_id))]})}function y6e({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=Mc(),i=Mc(m=>m.controls),s=M.useRef(new He(...e)),o=M.useRef(new He(...n)),a=M.useRef(!1),l=M.useRef(null),c=M.useRef(e.join(",")),d=e.join(",");M.useEffect(()=>{c.current=d,!t&&i&&(r.position.set(...e),i.target.set(...n),i.update(),a.current=!1)},[d]);const p=t?t.position.join(","):null;return M.useEffect(()=>{if(l.current=p,t){const[m,x,b]=t.position;s.current.set(m+.8,x+1.2,b+1.4),o.current.set(m,x,b),a.current=!0}else a.current=!1},[p]),WC(()=>{if(!i||!a.current)return;const m=.06;r.position.lerp(s.current,m);const x=i;x.target.lerp(o.current,m),i.update();const b=r.position.distanceTo(s.current),_=x.target.distanceTo(o.current);b<.01&&_<.01&&(r.position.copy(s.current),x.target.copy(o.current),i.update(),a.current=!1)}),null}function Qi({label:t,value:e,mono:n=!0}){return f.jsxs("div",{className:"flex justify-between gap-4",children:[f.jsx("span",{children:t}),f.jsx("span",{className:n?"font-mono":"",children:e})]})}function b6e({topology:t,focusedItem:e,onClose:n}){const r=mu();return f.jsx("div",{className:"absolute top-4 right-4 w-72 max-h-[calc(100%-2rem)] overflow-auto",children:e?f.jsxs("div",{className:"bg-background border border-foreground rounded-none p-4",children:[e.type==="gpu"&&(()=>{const i=e.data,s=i.role.role==="trainer"?r.trainer:i.role.role==="inference"?r.inference:r.unassigned;return f.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"GPU Details"}),f.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.hardware.name}),f.jsx(Qi,{label:"Node / Index",value:`#${e.nodeId} / GPU ${i.local_index}`}),f.jsx(Qi,{label:"Role",value:f.jsx("span",{className:"font-semibold",style:{color:s},children:i.role.role.charAt(0).toUpperCase()+i.role.role.slice(1)}),mono:!1}),i.role.rank!==void 0&&f.jsx(Qi,{label:"Rank",value:i.role.rank}),i.role.dp_rank!==void 0&&f.jsx(Qi,{label:"DP / TP / PP",value:`${i.role.dp_rank} / ${i.role.tp_rank} / ${i.role.pp_rank}`}),i.role.server_idx!==void 0&&f.jsx(Qi,{label:"Server",value:i.role.server_idx}),i.role.url&&f.jsx(Qi,{label:"URL",value:f.jsx("span",{className:"text-[9px]",children:i.role.url})}),f.jsx("div",{className:"border-t border-foreground mt-1.5 pt-1.5"}),f.jsx(Qi,{label:"VRAM",value:`${i.hardware.memory_total_gb} GB`}),f.jsx(Qi,{label:"PCIe",value:`Gen${i.hardware.pcie_gen} x${i.hardware.pcie_width}`}),f.jsx(Qi,{label:"Serial",value:f.jsx("span",{className:"text-[9px]",children:i.hardware.serial})}),f.jsx(Qi,{label:"UUID",value:f.jsx("span",{className:"text-[9px] break-all",children:i.hardware.uuid})})]})})(),e.type==="cpu"&&(()=>{const i=e.data;return f.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"CPU Details"}),f.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.model}),f.jsx(Qi,{label:"Node",value:`#${e.nodeId}`}),f.jsx(Qi,{label:"Architecture",value:i.architecture}),f.jsx(Qi,{label:"Cores",value:i.cores}),f.jsx(Qi,{label:"Logical Cores",value:i.logical_cores}),f.jsx(Qi,{label:"Sockets",value:i.sockets}),f.jsx(Qi,{label:"Frequency",value:`${(i.frequency_mhz/1e3).toFixed(2)} GHz`})]})})(),e.type==="ram"&&(()=>{const i=e.data;return f.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"System Memory"}),f.jsx(Qi,{label:"Node",value:`#${e.nodeId}`}),f.jsx(Qi,{label:"Total",value:`${i.total_gb.toFixed(0)} GB`})]})})(),f.jsx("button",{onClick:n,className:"mt-4 w-full py-1.5 text-xs font-medium text-foreground border border-foreground rounded-none hover:bg-foreground hover:text-background transition-colors",children:"Close"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"bg-background border border-foreground rounded-none p-4 mb-3",children:[f.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"Cluster Overview"}),f.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[f.jsx(Qi,{label:"Model",value:f.jsx("span",{className:"text-foreground",children:t.model||"—"}),mono:!1}),f.jsx(Qi,{label:"Nodes",value:t.nodes.length}),f.jsx(Qi,{label:"Total GPUs",value:t.total_gpus}),t.trainer_config&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-foreground mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:r.trainer},children:"Trainer"}),f.jsx(Qi,{label:"GPUs",value:t.trainer_total_gpus}),f.jsx(Qi,{label:"Backend",value:t.trainer_config.backend}),f.jsx(Qi,{label:"DP × TP × PP",value:`${t.trainer_config.data_parallel_size} × ${t.trainer_config.megatron_tensor_parallel_size} × ${t.trainer_config.megatron_pipeline_parallel_size}`})]}),t.inference_config&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-foreground mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:r.inference},children:"Inference"}),f.jsx(Qi,{label:"GPUs",value:t.inference_total_gpus}),f.jsx(Qi,{label:"Servers",value:t.inference_config.num_servers}),f.jsx(Qi,{label:"TP Size",value:t.inference_config.tensor_parallel_size}),f.jsx(Qi,{label:"Placement",value:t.inference_config.placement_strategy})]})]})]}),f.jsxs("div",{className:"bg-background border border-foreground rounded-none p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-foreground mb-1.5",children:"Legend"}),f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[f.jsx("div",{className:"w-3 h-2",style:{background:r.trainer}}),"Trainer GPU"]}),f.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[f.jsx("div",{className:"w-3 h-2",style:{background:r.inference}}),"Inference GPU"]}),f.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[f.jsx("div",{className:"w-3 h-2",style:{background:r.unassigned}}),"Unassigned GPU"]}),f.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[f.jsx("div",{className:"w-3 h-1",style:{background:r.nvlink}}),"NVLink"]})]})]})]})})}function _6e({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=mu(),o=s.background==="#ffffff"?"#ffffff":"#888888",a=s.background==="#ffffff"?"#ffffff":"#333333",l=M.useMemo(()=>{const c=[],d=Math.ceil(Math.sqrt(t.nodes.length)),p=6.5,m=3.5;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/d),S=b%d,C=-(Math.min(d,t.nodes.length-_*d)-1)*p/2;c.push([S*p+C,0,_*m])}),c},[t.nodes]);return f.jsxs(f.Fragment,{children:[f.jsx("color",{attach:"background",args:[s.background]}),f.jsx("ambientLight",{intensity:.7}),f.jsx("directionalLight",{position:[8,12,5],intensity:.8}),f.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),f.jsx("hemisphereLight",{color:o,groundColor:a,intensity:.5}),f.jsx(mZ,{}),f.jsx("gridHelper",{args:[50,50,s.gridColor,s.gridColor],position:[0,-.04,0]}),t.nodes.map((c,d)=>f.jsx(g6e,{node:c,position:l[d],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},c.node_id))]})}function S6e(){const t=mu(),{gl:e}=Mc();return M.useEffect(()=>{e.setClearColor(t.background)},[e,t.background]),null}function gZ({topology:t}){const e=mu(),[n,r]=M.useState(null),[i,s]=M.useState(null),[o,a]=M.useState(null),l=t.nodes.length>1,c=l&&o===null,d=M.useMemo(()=>{if(!l||o===null)return t;const C=t.nodes.find(A=>A.node_id===o);return C?{...t,nodes:[C]}:t},[t,o,l]),p=M.useMemo(()=>{const C=c?t:d,A=C.nodes.length,N=Math.max(...C.nodes.map(P=>P.gpus.length),1);if(c){const P=Math.max(4,A*1.5);return[P*.6,P*.9,P*.6]}const D=Math.max(3.5,A*1.8,N*.8);return[D*.8,D*.7,D*.8]},[t,d,c]),m=M.useMemo(()=>[0,0,0],[]),x=M.useCallback(C=>{s(C),C&&r(null)},[]),b=M.useCallback(()=>{s(null)},[]),_=M.useCallback(()=>{a(null),s(null),r(null)},[]),S=M.useCallback(C=>{a(C),s(null),r(null)},[]),w=i!==null;return f.jsxs("div",{className:"relative w-full h-full bg-background",children:[f.jsxs(UEe,{camera:{position:p,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:C})=>{C.setClearColor(e.background),C.toneMapping=ou},children:[c?f.jsx(v6e,{topology:t,onSelectNode:S}):f.jsx(_6e,{topology:d,hoveredItem:n,setHoveredItem:r,setSelectedItem:x,focusedItem:i}),f.jsx(y6e,{focusTarget:!c&&i?{position:i.worldPosition}:null,overviewPosition:p,overviewLookAt:m}),f.jsx(i6e,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{i&&b()}}),f.jsx(S6e,{})]}),l&&o!==null&&f.jsx("button",{onClick:_,className:"absolute top-4 left-4 px-3 py-1.5 text-xs font-medium text-foreground bg-background border border-foreground rounded-none hover:bg-foreground hover:text-background transition-colors select-none",children:"← Back to cluster"}),f.jsx(b6e,{topology:c?t:d,focusedItem:i,onClose:b}),f.jsx("div",{className:"absolute bottom-4 left-4 text-[10px] text-foreground/60 select-none",children:c?"Click a node to inspect · Drag to orbit · Scroll to zoom":w?"Move to dismiss · Click Close to return":"Drag to orbit · Scroll to zoom · Right-click to pan · Click an object to focus"})]})}function xZ(t){if(t&&typeof t=="object"&&"value"in t)return xZ(t.value);if(Array.isArray(t)){const e=t.map(n=>typeof n=="string"?n.trim():n).map(n=>Number(n)).filter(n=>Number.isFinite(n));return Array.from(new Set(e))}if(typeof t=="number"&&Number.isFinite(t))return[t];if(typeof t=="string"){const n=(t.match(/-?\d+/g)??[]).map(r=>Number(r)).filter(r=>Number.isFinite(r));return Array.from(new Set(n))}return[]}const w6e=[1,5,10,30,60,120,300],iN=rh,yF=rh,M6e=["torch_allocated_gb"],T6e="__timeline_noop_metric__";function XC(t){return q9(t==null?void 0:t.setup)}function C6e(t){const e=XC(t),n={},r=vi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Nr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Nr(d.rank);p!==null&&(n[p]={node_id:a,local_rank:Nr(d.local_rank)})}}return n}function E6e(t){const e=XC(t),n=vi(e==null?void 0:e.inference);return Nr(n==null?void 0:n.num_servers)??void 0}function A6e(t){const e=XC(t),n={},r=vi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Nr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Nr(d.server_idx);p!==null&&(p in n||(n[p]=a))}}return n}function bF(t){const e=XC(t),n=vi(e==null?void 0:e.cluster),r=Array.isArray(n==null?void 0:n.nodes)?n.nodes:[];return r.length>0?r.length:void 0}function N6e(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function R6e({value:t,onChange:e}){const[n,r]=M.useState(!1),[i,s]=M.useState(""),o=M.useRef(null),a=c=>{c&&(s(iN(t)),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=N6e(i);c!==null&&(e(c),r(!1))};return f.jsxs(AT,{open:n,onOpenChange:a,children:[f.jsx(NT,{asChild:!0,children:f.jsxs("button",{className:"inline-flex items-center gap-1 rounded-lg border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors select-none whitespace-nowrap",children:[iN(t),f.jsx(Ir,{className:"size-3 text-muted-foreground"})]})}),f.jsxs(RT,{align:"start",className:"w-40 p-1.5 gap-1",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("input",{ref:o,type:"text",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()},className:"h-7 w-full rounded-md border border-input bg-transparent px-2 text-xs outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[2px]",placeholder:"e.g. 30s, 2m, 1h"}),f.jsx("button",{onClick:l,className:"shrink-0 h-7 px-2 rounded-md text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:"Go"})]}),f.jsx("div",{className:"flex flex-col",children:w6e.map(c=>f.jsx("button",{onClick:()=>{e(c),r(!1)},className:`text-left rounded-md px-2 py-1 text-xs transition-colors ${c===t?"bg-accent text-accent-foreground font-medium":"hover:bg-accent hover:text-accent-foreground"}`,children:iN(c)},c))})]})]})}function k6e(){var $,X,Z,K,ne;const t=Jn(xl),[e,n]=dn($le),[r,i]=dn(qle),s=!0,{data:o,isFetching:a,isPlaceholderData:l,error:c}=Wue(t||"",e,r,!!t),{data:d}=cd(t||"",!!t,s),p=M.useMemo(()=>{var B;const H=(B=d==null?void 0:d.config)==null?void 0:B.trainer_devices;return xZ(H)},[($=d==null?void 0:d.config)==null?void 0:$.trainer_devices]),m=(o==null?void 0:o.interval_start)??null,x=(o==null?void 0:o.interval_end)??null,b=a&&(l||!o),[_,S]=M.useState(()=>[...M6e]),w=M.useMemo(()=>{const H=Array.from(new Set(_.filter(B=>typeof B=="string"&&B.trim().length>0))).sort((B,G)=>B.localeCompare(G));return H.length>0?H:[T6e]},[_]),C=M.useMemo(()=>C6e(d==null?void 0:d.summary),[d==null?void 0:d.summary]),A=M.useMemo(()=>{const H={},B=(o==null?void 0:o.trainer_events)??[];for(const G of B){const j=G.rank;if(!Number.isFinite(j))continue;const ie=H[j]??{node_id:null,local_rank:null},ce=ie.node_id!==null?ie.node_id:typeof G.node_id=="number"&&Number.isFinite(G.node_id)?G.node_id:null,te=ie.local_rank!==null?ie.local_rank:typeof G.local_rank=="number"&&Number.isFinite(G.local_rank)?G.local_rank:null;H[j]={node_id:ce,local_rank:te}}return H},[o==null?void 0:o.trainer_events]),N=M.useMemo(()=>{const H={};return new Set([...Object.keys(C).map(Number),...Object.keys(A).map(Number)]).forEach(G=>{const j=C[G],ie=A[G];H[G]={node_id:(j==null?void 0:j.node_id)??(ie==null?void 0:ie.node_id)??null,local_rank:(j==null?void 0:j.local_rank)??(ie==null?void 0:ie.local_rank)??null}}),H},[C,A]),D=M.useMemo(()=>A6e(d==null?void 0:d.summary),[d==null?void 0:d.summary]),P=M.useMemo(()=>{const H={},B=(o==null?void 0:o.inference_events)??[];for(const G of B){const j=G.server;Number.isFinite(j)&&H[j]===void 0&&typeof G.node_id=="number"&&Number.isFinite(G.node_id)&&(H[j]=G.node_id)}return H},[o==null?void 0:o.inference_events]),O=M.useMemo(()=>{const H={};return new Set([...Object.keys(D).map(Number),...Object.keys(P).map(Number)]).forEach(G=>{H[G]=D[G]??P[G]??null}),H},[D,P]),R=M.useMemo(()=>{const H=((o==null?void 0:o.trainer_events)??[]).map(G=>G.rank).filter(G=>Number.isFinite(G)),B=Object.keys(N).map(Number);return Array.from(new Set([...H,...B])).sort((G,j)=>G-j)},[o==null?void 0:o.trainer_events,N]),L=M.useMemo(()=>R.map(H=>{var B,G;return{rank:H,node_id:((B=N[H])==null?void 0:B.node_id)??null,local_rank:((G=N[H])==null?void 0:G.local_rank)??null}}),[R,N]),V=M.useMemo(()=>{const H=[];let B=!1;return R.forEach(G=>{var ie;const j=(ie=N[G])==null?void 0:ie.local_rank;j!=null&&(H[G]=j,B=!0)}),B?H:p},[N,R,p]),F=Xue(t||"",w,L,m,x,!!t&&m!==null&&x!==null&&L.length>0),U=M.useMemo(()=>{const H={};return L.forEach((B,G)=>{var ie;const j=(ie=F[G])==null?void 0:ie.data;H[B.rank]=(j==null?void 0:j.metrics)??[]}),H},[L,F]),W=M.useMemo(()=>{const H=[];F.forEach(j=>{const ie=j.data;ie!=null&&ie.available_metrics&&ie.available_metrics.forEach(ce=>{typeof ce=="string"&&H.push(ce)})});const B=Array.from(new Set(H));if(B.length>0)return B;const G=new Set;return F.forEach(j=>{var ce;const ie=j.data;(ce=ie==null?void 0:ie.metrics)==null||ce.forEach(te=>{typeof te.metric_name=="string"&&G.add(te.metric_name)})}),Array.from(G).sort((j,ie)=>j.localeCompare(ie))},[F]),Y=F.some(H=>H.isFetching);return t?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center gap-2 h-7",children:[f.jsx(q8,{currentPage:e,totalPages:(o==null?void 0:o.total_pages)??1,onPageChange:n}),f.jsx(R6e,{value:r,onChange:H=>{const B=Math.floor(e*r/H);i(H),n(B)}}),m!==null&&x!==null&&(o==null?void 0:o.global_min_time)!=null&&f.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[yF(m-o.global_min_time)," – ",yF(x-o.global_min_time)]})]})})}),f.jsx("div",{className:"flex-1 overflow-auto p-6",children:f.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),f.jsx(v_e,{orchestratorData:o==null?void 0:o.orchestrator_events,trainerData:o==null?void 0:o.trainer_events,inferenceData:o==null?void 0:o.inference_events,isLoading:b,intervalStart:(o==null?void 0:o.interval_start)??0,intervalEnd:(o==null?void 0:o.interval_end)??r,trainerGpuMetricsByRank:U,trainerGpuMetricsIsLoading:Y,trainerAvailableGpuMetrics:W,selectedTrainerGpuMetrics:_,onSelectedTrainerGpuMetricsChange:S,trainerSystemGpuIndices:V,trainerRankInfoByRank:N,totalSetupNodes:bF(d==null?void 0:d.summary),inferenceServerNodeMap:O,numInferenceServers:E6e(d==null?void 0:d.summary)??((X=d==null?void 0:d.config)==null?void 0:X.num_inference_servers),maxConcurrentPrompts:(Z=d==null?void 0:d.config)==null?void 0:Z.max_concurrent_prompts,groupSize:(K=d==null?void 0:d.config)==null?void 0:K.group_size,freeLaneAfterGeneration:(ne=d==null?void 0:d.config)==null?void 0:ne.free_lane_after_generation})]})}),f.jsx(D6e,{runPath:t,trainerEvents:o==null?void 0:o.trainer_events,totalSetupNodes:bF(d==null?void 0:d.summary)})]}):f.jsx(bm,{description:"Select a run from the sidebar to view the timeline."})}function D6e({runPath:t,trainerEvents:e,totalSetupNodes:n}){const r=Jn(No),[i,s]=dn(DG),[o,a]=dn(kG),[l,c]=M.useState("inference"),[d,p]=M.useState(i),[m,x]=M.useState(o);i!==d&&(p(i),i&&c("inference")),o!==m&&(x(o),o&&c("trainer"));const{data:b}=$ue(t??"",(i==null?void 0:i.groupId)??null,!!i&&!!t),_=M.useMemo(()=>{if(!i||!(b!=null&&b.events))return null;const ce={};for(const te of b.events)te.sample_id!==void 0&&(ce[te.sample_id]||(ce[te.sample_id]=[]),ce[te.sample_id].push(te));return ce},[i,b]),S=M.useMemo(()=>{if(!b)return null;const ce=b.environment_response_times??[],te=b.compute_reward_times??[],se={};for(const re of ce)se[re.sample_idx]||(se[re.sample_idx]=[]),se[re.sample_idx].push({turn_order:re.turn_order,time:re.time});for(const re of Object.values(se))re.sort((pe,be)=>pe.turn_order-be.turn_order);const le={};for(const re of te)le[re.sample_idx]=re.time;return{envBySample:se,rewardBySample:le}},[b]),w=M.useMemo(()=>{if(!_)return null;let ce=1/0,te=-1/0;for(const[se,le]of Object.entries(_)){for(const re of le){ce=Math.min(ce,re.start_time),te=Math.max(te,re.end_time);let pe=re.end_time;re.environment_response_time&&re.environment_response_time>0&&(pe+=re.environment_response_time),re.compute_reward_time&&re.compute_reward_time>0&&(pe+=re.compute_reward_time),te=Math.max(te,pe)}if(S){const re=Number(se),pe=[...le].sort((me,ke)=>me.start_time-ke.start_time),be=S.envBySample[re]??[];let xe=-1/0;for(let me=0;me<pe.length;me++)xe=pe[me].end_time,me<be.length&&be[me].time>0&&(xe+=be[me].time);const Pe=S.rewardBySample[re]??0;Pe>0&&(xe+=Pe),te=Math.max(te,xe)}}return ce===1/0?null:{start:ce,end:te,duration:te-ce}},[_,S]),{data:C}=que(t??"",(o==null?void 0:o.eventType)??null,(o==null?void 0:o.rank)??null,(o==null?void 0:o.step)??null,!!t&&!!o),A=M.useMemo(()=>C!=null&&C.events&&C.events.length>0?C.events:e??[],[C,e]),N=M.useMemo(()=>{if(A.length===0)return{};const ce={};for(const te of A)ce[te.rank]||(ce[te.rank]=[]),ce[te.rank].push(te);return ce},[A]),D=M.useMemo(()=>o?(N[o.rank]||[]).find(te=>te.event_type===o.eventType&&te.step===o.step&&te.rank===o.rank&&!te.event_type.includes("/"))??null:null,[o,N]),P=M.useMemo(()=>o?(N[o.rank]||[]).filter(te=>te.event_type.startsWith(o.eventType+"/")&&te.step===o.step):[],[o,N]),O=Jn(_T),R=Jn(RG),L=M.useMemo(()=>!i||!_?[]:Object.keys(_).map(Number).map(ce=>({group_id:i.groupId,sample_idx:ce})),[i,_]),{data:V}=k7(t??"",L,!!t&&L.length>0&&O),F=!O||L.length===0||!!V,U=M.useMemo(()=>!O||!(V!=null&&V.statuses)?!1:V.statuses.some(ce=>ce.kind==="rollouts_discarded"),[O,V]),W=M.useMemo(()=>_?Object.values(_).some(ce=>ce.some(te=>te.is_canceled)):!1,[_]),{data:Y}=GG(t??"",(i==null?void 0:i.groupId)??null,(i==null?void 0:i.sampleId)??null,!!t&&!!i,i==null?void 0:i.isEval),$=M.useMemo(()=>!Y||Y.kind!=="rollouts_discarded"?null:Y.discard_reason,[Y]),X=M.useMemo(()=>{if(!Y||Y.kind===null)return null;const ce=Y.samples_data;if(!ce||ce.length===0)return null;const te=ce.map(se=>se.reward).filter(se=>se!==null);return te.length===0?null:te.every(se=>se===0)?"all_zero":te.every(se=>se>0)?"all_positive":null},[Y]),Z=ce=>{switch(ce){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ce.split("_").map(te=>te.charAt(0).toUpperCase()+te.slice(1)).join(" ")}},K=!!i,ne=!!o&&P.length>0&&!!D,H=l==="inference"&&!K&&ne?"trainer":l==="trainer"&&!ne&&K?"inference":l;if(!K&&!ne)return null;const B=()=>{H==="inference"?(s(null),ne&&c("trainer")):(a(null),K&&c("inference"))},G=D?VG(D.event_type,D.step,D.microbatch,D.minibatch):null,j=D?E2(D.event_type):void 0,ie=K&&ne;return f.jsxs("footer",{className:"border-t bg-background shrink-0 h-[28vh] flex flex-col",children:[f.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0",children:[ie&&f.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5 gap-0.5",children:[f.jsx("button",{onClick:()=>c("inference"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${H==="inference"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Inference"}),f.jsx("button",{onClick:()=>c("trainer"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${H==="trainer"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),H==="inference"&&i&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:W?r?T2:"#adadad":U?r?"#9ca3af":"#6b7280":i.isEval?"#047857":"#075985"}}),f.jsxs("span",{className:"text-xs font-medium",children:["Sample ",i.sampleId]})]}),f.jsx("span",{className:"text-muted-foreground",children:"/"}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("div",{className:`w-2.5 h-2.5 rounded-sm${F?"":" animate-pulse bg-muted"}`,style:F?{backgroundColor:W?r?T2:E7:U?r?M2:w2:i.isEval?"#10b981":"#0369a1"}:void 0}),f.jsxs("span",{className:"text-xs font-medium",children:["Group ",i.groupId]})]}),W&&f.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border",children:"Canceled due to async policy"}),$&&f.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-red-100 text-red-700 border border-red-200",children:Z($)}),$==="zero_advantage"&&X==="all_zero"&&f.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 border border-amber-200",children:"All Rewards = 0"}),$==="zero_advantage"&&X==="all_positive"&&f.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-emerald-100 text-emerald-700 border border-emerald-200",children:"All Rewards > 0"})]}),H==="trainer"&&G&&D&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:j}}),f.jsxs("span",{className:"text-xs font-medium",children:[G.primary," Breakdown"]}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["GPU ",D.rank]}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",D.step,")"]})]}),f.jsx("button",{onClick:B,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:f.jsx(fu,{className:"w-4 h-4"})})]}),f.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[H==="inference"&&i&&_&&w&&f.jsx(L_e,{eventsBySampleId:_,selectedSampleId:i.sampleId,timeBounds:w,groupId:i.groupId,runPath:t??"",envResponseTimesBySample:S==null?void 0:S.envBySample,computeRewardTimeBySample:R?S==null?void 0:S.rewardBySample:void 0,onSampleClick:ce=>{s({sampleId:ce,groupId:i.groupId,isEval:i.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:i.isEval}),H==="trainer"&&D&&P.length>0&&f.jsx($_e,{parentEvent:D,childEvents:P})]})]})}function X9(t,e){const n=typeof IntersectionObserver>"u",[r,i]=M.useState(n),[s,o]=M.useState(n),a=M.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return M.useEffect(()=>{const p=t.current;if(!p||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(([x])=>{const b=x.isIntersecting;i(b),b?(a.current&&(clearTimeout(a.current),a.current=null),o(!0)):(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o(!1),a.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return m.observe(p),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,d]),r||s}const kM={rewards:{label:"Reward",metrics:[{prefix:"reward_sum",label:"Reward"},{prefix:"reward_gini_mean",label:"Reward Sparsity (Gini)",simple:!0}]},advantage:{label:"Advantage",metrics:[{prefix:"advantage",label:"Advantage"}],showZeroLine:!0},tokens:{label:"Rollouts",metrics:[{prefix:"length_prompt",label:"Tokens Prompt"},{prefix:"length_completion",label:"Tokens Completion"},{prefix:"length_sum",label:"Tokens Total"}],unit:"tokens"},rollouts_general:{label:"Rollouts",metrics:[{prefix:"stop_reason_length_pct",label:"% Stop Reason = Length",simple:!0,group:"General"},{prefix:"group_length_gini_mean",label:"Group Completion Length Gini",simple:!0,group:"General"},{prefix:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",simple:!0,group:"General"}]}},P6e={discarded_stats:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_count",label:"Discarded Count",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_pct",label:"Zero Advantage %",simple:!0,group:"General"},{prefix:"discarded_max_async_pct",label:"Max Async %",simple:!0,group:"General"},{prefix:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",simple:!0,group:"General"},{prefix:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",simple:!0,group:"General"},{prefix:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward",simple:!0,group:"General"},{prefix:"canceled_count",label:"Canceled Count",simple:!0,group:"Canceled"}]},discarded_tokens:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_length_prompt",label:"Discarded Tokens Prompt"},{prefix:"discarded_length_completion",label:"Discarded Tokens Completion"},{prefix:"discarded_length_sum",label:"Discarded Tokens Total"}],unit:"tokens"}},I6e={timeline_trainer_full_step:{label:"Timeline Trainer",metrics:[{prefix:"timing_step_total",label:"Time per Step",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_step_active",label:"Time per Step Active",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_microbatch_count",label:"Microbatches per Step",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_forward_total",label:"Timing Forward",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_backward_total",label:"Timing Backward",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_loss_computation_total",label:"Timing Loss Computation",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_compute_kl_total",label:"Timing Compute KL",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_compute_entropy_total",label:"Timing Compute Entropy",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_data_to_device_total",label:"Timing Data to Device",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_prepare_tensors_total",label:"Timing Prepare Tensors",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_waiting_for_data",label:"Timing Waiting for Data",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)",simple:!0,group:"Full Step (Total Time)"}]},timeline_trainer_microbatch:{label:"Timeline Trainer",metrics:[{prefix:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors",simple:!0,group:"Microbatch (Mean Time)"}]},timeline_inference:{label:"Timeline Inference",metrics:[{prefix:"timing_save_batch_total",label:"Batch Completion (Save Batch)",simple:!0,group:"Batch & Averages"},{prefix:"timing_avg_inference_time",label:"Avg Generation Time",simple:!0,group:"Batch & Averages"},{prefix:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",simple:!0,group:"Batch & Averages"},{prefix:"timing_generation_normal_pct",label:"Generation Normal",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_discarded_pct",label:"Generation Discarded",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_canceled_pct",label:"Generation Canceled",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_all_pct",label:"Generation All",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_normal_pct",label:"Compute Reward Normal",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_discarded_pct",label:"Compute Reward Discarded",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_canceled_pct",label:"Compute Reward Canceled",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_all_pct",label:"Compute Reward All",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_idle_pct",label:"Idle Time",simple:!0,group:"Time Breakdown (% of Step Time)"}]}},xk=["mean","std","min","max"],p1="histogram",m1="distribution_over_time";function _F(t){return t==="reward_sum"?"reward_sum":t==="advantage"?"advantage":t==="length_prompt"?"length_prompt":t==="length_completion"?"length_completion":t==="length_sum"?"length_sum":(t.startsWith("reward_"),t)}function E0(t,e,n){for(const r of n.metrics){const i="simple"in r&&r.simple,s="group"in r?r.group:void 0,o="showZeroLine"in n?n.showZeroLine:!1,a="unit"in n?n.unit:void 0;if(i){t.push({category:e,categoryLabel:n.label,group:s,metricKey:r.prefix,label:r.label,prefix:r.prefix,suffix:"",showZeroLine:o,unit:a});continue}for(const d of xk){const p=`${r.prefix}_${d}`,m=d.charAt(0).toUpperCase()+d.slice(1);t.push({category:e,categoryLabel:n.label,group:s,metricKey:p,label:`${r.label} - ${m}`,prefix:r.prefix,suffix:d,showZeroLine:o,unit:a})}const l=`${r.prefix}_${p1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:p1,showZeroLine:o,unit:a,isHistogram:!0,histogramMetricType:_F(r.prefix)});const c=`${r.prefix}_${m1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:m1,showZeroLine:o,unit:a,isDistributionOverTime:!0,histogramMetricType:_F(r.prefix)})}}function O6e(t,e={},n=[]){const r=[];for(const[i,s]of Object.entries(e))for(const[o,a]of Object.entries(s)){const l=o?`custom_${i}_${o}`:`custom_${i}`;E0(r,l,{label:l1(i),metrics:a.map(c=>({prefix:c,label:l1(c),simple:!0,group:o?l1(o):void 0}))})}E0(r,"rewards",kM.rewards),t.length>0&&E0(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:l1(i)},{prefix:`reward_${i}_gini_mean`,label:`${l1(i)} Sparsity (Gini)`,simple:!0}])}),E0(r,"advantage",kM.advantage),r.push(...L6e(n)),E0(r,"tokens",kM.tokens),E0(r,"rollouts_general",kM.rollouts_general);for(const[i,s]of Object.entries(P6e))E0(r,i,s);for(const[i,s]of Object.entries(I6e))E0(r,i,s);for(const i of[{key:"inference_calls",label:"Inference Calls",inferenceMetricType:"inference_calls"},{key:"requests_done",label:"Requests Done",inferenceMetricType:"requests_done"},{key:"rollouts_group_done",label:"Rollouts Group Done",inferenceMetricType:"rollouts_group_done"},{key:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",inferenceMetricType:"rollouts_group_done_kept"},{key:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",inferenceMetricType:"rollouts_group_done_discarded"},{key:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",inferenceMetricType:"rollouts_group_done_canceled"}])r.push({category:"inference_performance",categoryLabel:"Inference Performance",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferencePerformance:!0,inferenceMetricType:i.inferenceMetricType});return r}function L6e(t){const e=[];for(const n of t){const r=n.eval_name,i=`eval/${r}/`;for(const s of n.available_rollout_metric_names){const o=l1(s),a=`${r} / ${o}`,l=`${i}reward_${s}`,c="evals";for(const d of xk){const p=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${d}`,label:`${r} ${o} - ${p}`,prefix:l,suffix:d,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${p1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:p1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${m1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:m1,isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}for(const s of["length_completion","length_prompt","length_sum"]){const o=s==="length_completion"?"Tokens Completion":s==="length_prompt"?"Tokens Prompt":"Tokens Total",a=`${r} / ${o}`,l=`${i}${s}`,c="evals";for(const d of xk){const p=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${d}`,label:`${r} ${o} - ${p}`,prefix:l,suffix:d,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${p1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:p1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${m1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:m1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function l1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function j6e(t){const e={};for(const n of t)e[n.category]||(e[n.category]={label:n.categoryLabel,metrics:[]}),e[n.category].metrics.push(n);return e}function z6e(t){const e=new Map;for(const n of t)if(!e.has(n.prefix))if(n.suffix){const r=n.label.lastIndexOf(" - ");e.set(n.prefix,r>0?n.label.substring(0,r):n.label)}else e.set(n.prefix,n.label);return t.map(n=>({section:n.categoryLabel,group:n.group||(n.suffix?(()=>{const r=e.get(n.prefix);return r&&r!==n.categoryLabel?r:void 0})():void 0),metricKey:n.metricKey,label:n.label,plotType:n.isInferencePerformance?"inference_performance":n.isHistogram?"histogram":n.isDistributionOverTime?"distribution_over_time":n.isEvalMetric?"eval_metric":"step_metric",evalName:n.evalName,histogramMetricType:n.histogramMetricType,inferenceMetricType:n.inferenceMetricType,simple:!n.suffix}))}function Y9({openAtom:t=_7}={}){const[e,n]=dn(t);return!Jn(xl)||e?null:f.jsx(Mn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function K9({currentStep:t,maxSelectableStep:e,openAtom:n=_7,selectedMetricsAtom:r=ece,selectedStepAtom:i=bT,includeDiscardedDefaults:s=!1,evalConfig:o}){var pe,be;const[a,l]=dn(n),[c,d]=dn(r),[p,m]=M.useState(!1),x=p&&(o==null?void 0:o.selectedSampleIdx)!=null,[b,_]=M.useState(!1),[S,w]=M.useState(10),[C,A]=M.useState("10"),N=Jn(xl),D=Jn(yT),P=Jn(ST),O=!0,R=!!o,{data:L}=ym(),{data:V}=cd(N||"",!!N,O),F=M.useMemo(()=>(V==null?void 0:V.available_rollout_metric_names)??[],[V==null?void 0:V.available_rollout_metric_names]),U=M.useMemo(()=>{var xe;return((xe=V==null?void 0:V.step_metrics_info)==null?void 0:xe.custom_metric_sections)??{}},[(pe=V==null?void 0:V.step_metrics_info)==null?void 0:pe.custom_metric_sections]),W=M.useMemo(()=>{var xe;return((xe=V==null?void 0:V.eval_info)==null?void 0:xe.evals)??[]},[(be=V==null?void 0:V.eval_info)==null?void 0:be.evals]),Y=M.useRef(!1);M.useEffect(()=>{if(R||Y.current)return;if(c.length>0){Y.current=!0;return}if(!V)return;Y.current=!0;const xe=["reward_sum_mean","reward_sum_distribution_over_time","advantage_distribution_over_time","length_completion_mean","length_completion_std","length_completion_min","length_completion_max","length_completion_distribution_over_time",...F.flatMap(Pe=>[`reward_${Pe}_mean`,`reward_${Pe}_distribution_over_time`]),...s?["discarded_count","discarded_zero_advantage_pct","discarded_max_async_pct","discarded_zero_advantage_all_zero_pct","discarded_zero_advantage_all_positive_pct"]:[]];d(xe)},[V,F,R]);const $=M.useRef(new Set);M.useEffect(()=>{if(R||F.length===0)return;const xe=[];for(const Pe of F){if(!$.current.has(Pe)){const me=`reward_${Pe}_mean`,ke=`reward_${Pe}_distribution_over_time`;c.includes(me)||xe.push(me),c.includes(ke)||xe.push(ke)}$.current.add(Pe)}xe.length>0&&d(Pe=>[...Pe,...xe])},[F,R]);const X=M.useRef("");M.useEffect(()=>{if(!R||!o)return;const xe=`${o.prefix}|${o.rewardNames.join(",")}`;if(xe===X.current)return;X.current=xe;const Pe=o.prefix,me=[`${Pe}length_completion_mean`,`${Pe}length_completion_std`,`${Pe}length_completion_min`,`${Pe}length_completion_max`,`${Pe}length_completion_distribution_over_time`,...o.rewardNames.flatMap(ke=>[`${Pe}reward_${ke}_mean`,`${Pe}reward_${ke}_distribution_over_time`])];d(me)},[o,R,d]);const Z=M.useMemo(()=>{const xe=(L==null?void 0:L.runs)||[],Pe=new Set(D);return N&&Pe.add(N),xe.filter(me=>Pe.has(me.run_id)).map(me=>({runPath:me.run_id,runName:me.name,color:me.color,isSelected:me.run_id===N}))},[N,D,L==null?void 0:L.runs]),K=M.useMemo(()=>O6e(F,U,W),[F,U,W]),ne=M.useMemo(()=>j6e(K),[K]),H=M.useMemo(()=>{const xe=new Set(K.map(Pe=>Pe.metricKey));return c.map((Pe,me)=>({metricKey:Pe,originalIndex:me})).filter(({metricKey:Pe})=>xe.has(Pe))},[c,K]),B=M.useMemo(()=>H.map(xe=>xe.metricKey),[H]),G=M.useMemo(()=>z6e(K),[K]),j=M.useMemo(()=>B.map(xe=>{const Pe=K.find(me=>me.metricKey===xe);return{id:xe,metricKey:xe,label:(Pe==null?void 0:Pe.label)||xe,plotType:Pe!=null&&Pe.isInferencePerformance?"inference_performance":Pe!=null&&Pe.isHistogram?"histogram":Pe!=null&&Pe.isDistributionOverTime?"distribution_over_time":Pe!=null&&Pe.isEvalMetric?"eval_metric":"step_metric"}}),[B,K]),ie=xe=>{xe&&d(Pe=>[...Pe,xe])},ce=xe=>{d(Pe=>Pe.filter((me,ke)=>ke!==xe))},te=xe=>K.find(Pe=>Pe.metricKey===xe),[se,le]=M.useState(null),re=M.useCallback(xe=>{if(!xe||!a){le(null);return}const Pe=xe.querySelector('[data-slot="scroll-area-viewport"]');Pe&&le(Pe)},[a]);return!N||!a?null:f.jsxs("div",{className:"w-[320px] border-l border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[f.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between shrink-0",children:[f.jsx("h2",{className:"font-semibold text-sm",children:R?"Eval Metrics":"Training Metrics"}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:f.jsx(gue,{className:"h-4 w-4"})})]}),f.jsx("div",{className:"px-4 py-2 border-b border-border shrink-0",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(iy,{catalog:G,onSelect:xe=>ie(xe.metricKey),existingPlots:j,allowDuplicates:!0,children:f.jsxs("button",{type:"button",className:Rt("flex flex-1 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors select-none min-h-[28px]","border-input bg-transparent hover:bg-accent/50",B.length>0?"text-foreground":"text-muted-foreground"),children:[f.jsx("span",{className:"font-medium",children:"Charts"}),B.length>0&&f.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:B.length}),f.jsx(Ir,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),f.jsx(mS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:C,onValueChange:A,onValueCommit:xe=>{const Pe=parseInt(xe,10);!isNaN(Pe)&&Pe>=2&&Pe<=100?(w(Pe),A(Pe.toString())):A(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),f.jsx(Ex,{ref:re,className:"flex-1 min-h-0",children:f.jsxs("div",{className:"p-4 space-y-4",children:[R&&f.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[f.jsx(Mn,{variant:p?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!1),children:"All"}),f.jsx(Mn,{variant:p?"default":"outline",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!0),disabled:(o==null?void 0:o.selectedSampleIdx)==null,children:"Selected"})]}),B.length===0?f.jsx("div",{className:"h-32 flex items-center justify-center text-muted-foreground text-sm text-center px-4",children:"Click on a metric above to add charts"}):Object.entries(ne).map(([xe,{label:Pe,metrics:me}])=>{const ke=new Set(me.map(Te=>Te.metricKey)),we=H.filter(({metricKey:Te})=>ke.has(Te));return we.length===0?null:f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:Pe}),f.jsx("div",{className:"space-y-4",children:we.map(({metricKey:Te,originalIndex:oe})=>{const _e=te(Te);if(x&&(_e!=null&&_e.isHistogram||_e!=null&&_e.isDistributionOverTime||_e!=null&&_e.suffix&&_e.suffix!=="mean"&&_e.suffix!==""))return null;const Fe=R&&x?`/s/${o.selectedSampleIdx}/`:"/",Oe=R&&Te.startsWith("eval/")?Te.replace(/^(eval\/[^/]+)\//,`$1${Fe}`):Te,ue=(_e==null?void 0:_e.histogramMetricType)||"",Q=R&&ue.startsWith("eval/")?ue.replace(/^(eval\/[^/]+)\//,`$1${Fe}`):ue,fe=x&&(_e==null?void 0:_e.suffix)==="mean"?(_e.label||Te).replace(/ - Mean$/,""):(_e==null?void 0:_e.label)||Te,Se=`${Te}-${oe}`;return _e!=null&&_e.isInferencePerformance&&_e.inferenceMetricType?f.jsx(C$,{runPath:N,shouldPoll:O,scrollRoot:se,inferenceMetricType:_e.inferenceMetricType,label:fe,onRemove:()=>ce(oe)},Se):_e!=null&&_e.isHistogram?f.jsx(H6e,{runPath:N,step:t,metricType:Q,label:fe,showZeroLine:_e==null?void 0:_e.showZeroLine,unit:_e==null?void 0:_e.unit,isTokenMetric:(_e==null?void 0:_e.category)==="tokens",onRemove:()=>ce(oe),scrollRoot:se},Se):_e!=null&&_e.isDistributionOverTime?f.jsx(G6e,{runPath:N,metricType:Q,label:fe,showZeroLine:_e==null?void 0:_e.showZeroLine,unit:_e==null?void 0:_e.unit,isTokenMetric:(_e==null?void 0:_e.category)==="tokens",currentStep:t,shouldPoll:O,onRemove:()=>ce(oe),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:se},Se):f.jsx(U6e,{runs:Z,shouldPoll:O,metricKey:Oe,label:fe,showZeroLine:_e==null?void 0:_e.showZeroLine,unit:_e==null?void 0:_e.unit,isTokenMetric:(_e==null?void 0:_e.category)==="tokens",showEma:b,emaSpan:S,currentStep:t,onRemove:()=>ce(oe),hoveredRunId:P,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:se,filterKey:Se},Se)})})]},xe)})]})})]})}function F6e(t){const e=t.match(/^eval\/([^/]+)\/s\/(\d+)\/(.+)$/);if(e)return{isEval:!0,evalName:e[1],rawMetricName:e[3],sampleIdx:parseInt(e[2],10)};const n=t.match(/^eval\/([^/]+)\/(.+)$/);return n?{isEval:!0,evalName:n[1],rawMetricName:n[2]}:{isEval:!1,evalName:"",rawMetricName:t}}function zf(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:o,sampleIdx:a}=F6e(e),l=$G(t,e,n&&!i,r),c=Jue(t,s,o,n&&i,r,a);return i?c:l}function U6e({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:o,showEma:a=!1,emaSpan:l=10,currentStep:c,onRemove:d,hoveredRunId:p=null,selectedStepAtom:m=bT,maxSelectableStep:x,scrollRoot:b=null,filterKey:_}){var Ee,Ce,Ye,Ze,it,ut,De,Ve,lt,Le;const S=$d(m),w=Jn(No),C=M.useRef(null),A=M.useRef(null),N=M.useRef(null),D=M.useRef(null),P=M.useRef(null),O=_??n,[R,L]=dn(b7),V=n8.has(n),F=R[O],U=(F==null?void 0:F.ignoreOutliers)??!1,W=(F==null?void 0:F.ignoreFirstStep)??V,Y=(F==null?void 0:F.minY)??null,$=(F==null?void 0:F.maxY)??null,X=M.useCallback(Ne=>{L($e=>{const ft={ignoreOutliers:!1,ignoreFirstStep:V,minY:null,maxY:null,tagFilters:{}},nt=$e[O]??ft,We=Ne(nt);if(We.ignoreOutliers===ft.ignoreOutliers&&We.ignoreFirstStep===ft.ignoreFirstStep&&We.minY===ft.minY&&We.maxY===ft.maxY&&Object.keys(We.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call($e,O))return $e;const je={...$e};return delete je[O],je}return{...$e,[O]:We}})},[O,L,V]),Z=M.useCallback(Ne=>X($e=>({...$e,ignoreOutliers:Ne})),[X]),K=M.useCallback(Ne=>X($e=>({...$e,ignoreFirstStep:Ne})),[X]),ne=M.useCallback(Ne=>X($e=>({...$e,minY:Ne})),[X]),H=M.useCallback(Ne=>X($e=>({...$e,maxY:Ne})),[X]),B=X9(C,{root:b,threshold:0}),G=zf(((Ee=t[0])==null?void 0:Ee.runPath)||"",n,B&&!!t[0],e),j=zf(((Ce=t[1])==null?void 0:Ce.runPath)||"",n,B&&!!t[1],e),ie=zf(((Ye=t[2])==null?void 0:Ye.runPath)||"",n,B&&!!t[2],e),ce=zf(((Ze=t[3])==null?void 0:Ze.runPath)||"",n,B&&!!t[3],e),te=zf(((it=t[4])==null?void 0:it.runPath)||"",n,B&&!!t[4],e),se=zf(((ut=t[5])==null?void 0:ut.runPath)||"",n,B&&!!t[5],e),le=zf(((De=t[6])==null?void 0:De.runPath)||"",n,B&&!!t[6],e),re=zf(((Ve=t[7])==null?void 0:Ve.runPath)||"",n,B&&!!t[7],e),pe=zf(((lt=t[8])==null?void 0:lt.runPath)||"",n,B&&!!t[8],e),be=zf(((Le=t[9])==null?void 0:Le.runPath)||"",n,B&&!!t[9],e),xe=M.useMemo(()=>{const Ne=t.filter(ft=>!ft.isSelected),$e=t.filter(ft=>ft.isSelected);return[...Ne,...$e]},[t]),Pe=M.useMemo(()=>xe.slice(0,10),[xe]),me=M.useMemo(()=>{const Ne=new Map;return Pe.forEach(($e,ft)=>{Ne.set($e.runPath,ft)}),Ne},[Pe]),{uplotData:ke,seriesConfig:we,isFetching:Te,isRefetching:oe,isPlaceholderData:_e,hasData:Fe,minStep:Ue,maxStep:Oe}=M.useMemo(()=>{const Ne=[G,j,ie,ce,te,se,le,re,pe,be],$e=new Map;t.forEach((yt,Pt)=>{Pt<10&&$e.set(yt.runPath,Ne[Pt])});const ft=new Set,nt=new Map;let We=!1,Ke=!1,je=!1;if(xe.forEach((yt,Pt)=>{var Be;if(Pt>=10)return;const zt=$e.get(yt.runPath);if(!zt)return;zt.isFetching&&(We=!0),zt.isRefetching&&(Ke=!0),zt.isPlaceholderData&&(je=!0);const Dt=((Be=zt.data)==null?void 0:Be.metrics)||[],Et=new Map;Dt.forEach(Qe=>{ft.add(Qe.step),Et.set(Qe.step,Qe.value)}),nt.set(Pt,Et)}),ft.size===0)return{uplotData:null,seriesConfig:[],isFetching:We,isRefetching:Ke,isPlaceholderData:je,hasData:!1,minStep:0,maxStep:0};const et=Array.from(ft).sort((yt,Pt)=>yt-Pt),pt=new Float64Array(et),Lt=[{label:"Step"}],wt=[pt];return xe.forEach((yt,Pt)=>{if(Pt>=10)return;const zt=nt.get(Pt)||new Map,Dt=et.map(ht=>zt.get(ht)??null),Et=p===yt.runPath,Be=p!==null;let Qe;Be&&!Et?Qe=.1:Qe=a?.3:1,wt.push(Dt),Lt.push({label:hx(yt),stroke:yt.color,width:1,alpha:Qe,spanGaps:!0,points:{show:!1}})}),a&&xe.forEach((yt,Pt)=>{if(Pt>=10)return;const zt=nt.get(Pt)||new Map,Dt=2/(l+1);let Et=null;const Be=[];et.forEach(Tt=>{const ct=zt.get(Tt);ct!==void 0?(Et===null?Et=ct:Et=Dt*ct+(1-Dt)*Et,Be.push(Et)):Be.push(null)});const Qe=p===yt.runPath,ht=p!==null;let It;ht&&!Qe?It=.1:It=1,wt.push(Be),Lt.push({label:`${hx(yt)} (EMA)`,stroke:yt.color,width:1.5,alpha:It,spanGaps:!0,points:{show:!1}})}),{uplotData:wt,seriesConfig:Lt,isFetching:We,isRefetching:Ke,isPlaceholderData:je,hasData:!0,minStep:et[0],maxStep:et[et.length-1]}},[t,xe,G,j,ie,ce,te,se,le,re,pe,be,a,l,p]),ue=n.split("_").pop()||"",Q=M.useCallback(Ne=>Ne==null?"N/A":o&&(ue==="min"||ue==="max")?Math.round(Ne).toLocaleString():td(Ne),[o,ue]),fe=M.useCallback(Ne=>Math.abs(Ne)>=1e3?`${parseFloat((Ne/1e3).toFixed(1))}k`:o?ue==="min"||ue==="max"?Math.round(Ne).toString():String(parseFloat(Ne.toFixed(1))):Number.isInteger(Ne)?Ne.toLocaleString():Math.abs(Ne)<.01&&Ne!==0?Ne.toExponential(1):String(parseFloat(Ne.toFixed(2))),[o,ue]),Se=M.useCallback(Ne=>Ne>=1e3?`${(Ne/1e3).toFixed(0)}k`:Ne.toString(),[]);M.useEffect(()=>{if(!A.current||!ke||!Fe)return;const Ne=A.current,$e=Ne.clientWidth,ft=160;let nt=null;if(U){const Tt=[];for(let ct=1;ct<ke.length;ct++){const Ut=ke[ct],Gt=W?1:0;for(let sn=Gt;sn<Ut.length;sn++){const nn=Ut[sn];nn!=null&&Tt.push(nn)}}nt=r8(Tt)}let We=1/0,Ke=-1/0;for(let Tt=1;Tt<ke.length;Tt++){const ct=ke[Tt],Ut=W?1:0;for(let Gt=Ut;Gt<ct.length;Gt++){const sn=ct[Gt];if(sn!=null){if(U&&nt&&(sn<nt.lower||sn>nt.upper))continue;sn<We&&(We=sn),sn>Ke&&(Ke=sn)}}}const je=Ke-We,et=Math.max(Math.abs(Ke),Math.abs(We)),pt=Math.max(et*.05,1e-10),Lt=Math.max(je*.1,pt);let wt,yt;i?(wt=Math.min(We-Lt,0),yt=Math.max(Ke+Lt,0)):(wt=We-Lt,yt=Ke+Lt),Y!==null&&(wt=Y),$!==null&&(yt=$);const Pt=w?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",zt=w?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Dt=(Tt,ct)=>{if(!ct||ct.length===0)return 36;const Ut=Math.max(...ct.map(Gt=>Gt.length));return Math.max(36,Ut*6+12)},Et=c!=null&&Number.isFinite(Ue)&&Number.isFinite(Oe)&&c>=Ue&&c<=Oe,Be={width:$e,height:ft,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[wt,yt]}},axes:[{stroke:zt,grid:{stroke:Pt,width:1},ticks:{stroke:Pt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Tt,ct)=>ct.map(Se)},{stroke:zt,grid:{stroke:Pt,width:1},ticks:{stroke:Pt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Dt,values:(Tt,ct)=>ct.map(fe)}],series:we,hooks:{draw:[Tt=>{if(Et&&c!=null){const ct=Tt.ctx,Ut=Tt.valToPos(c,"x",!0),Gt=Tt.valToPos(yt,"y",!0),sn=Tt.valToPos(wt,"y",!0);ct.save(),ct.strokeStyle=w?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",ct.lineWidth=2,ct.beginPath(),ct.moveTo(Ut,Gt),ct.lineTo(Ut,sn),ct.stroke(),ct.restore()}if(i&&wt<0&&yt>0){const ct=Tt.ctx,Ut=Tt.valToPos(0,"y",!0),Gt=Tt.valToPos(Tt.scales.x.min,"x",!0),sn=Tt.valToPos(Tt.scales.x.max,"x",!0);ct.save(),ct.strokeStyle=w?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",ct.lineWidth=1,ct.setLineDash([5,5]),ct.beginPath(),ct.moveTo(Gt,Ut),ct.lineTo(sn,Ut),ct.stroke(),ct.restore()}}],setCursor:[Tt=>{if(!D.current)return;const{left:ct,idx:Ut}=Tt.cursor;if(P.current=Ut??null,Ut==null||ct===void 0||ct<0){D.current.style.display="none";return}const Gt=ke[0][Ut];if(Gt===void 0){D.current.style.display="none";return}let sn=`<div class="font-medium mb-1">Step ${Number(Gt).toLocaleString()}</div>`;const nn=Pe.length;t.forEach(er=>{var gt,Xt;const ge=me.get(er.runPath);if(ge===void 0)return;const rt=ge+1,bt=(gt=ke[rt])==null?void 0:gt[Ut];let vt;if(a){const Jt=nn+ge+1;vt=(Xt=ke[Jt])==null?void 0:Xt[Ut]}bt!=null&&(sn+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${er.color}"></div>
                    <span>${i8(er)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${a?.7:1}">${Q(bt)}${s?` ${s}`:""}</span>
                    ${a&&vt!==void 0&&vt!==null?`<span class="text-muted-foreground">(EMA: ${Q(vt)})</span>`:""}
                  </div>
                </div>
              `)}),D.current.innerHTML=sn,D.current.style.display="block",D.current.style.left="0px",D.current.style.top="0px";const En=D.current.getBoundingClientRect(),Hn=A.current.getBoundingClientRect();let Nn=Hn.left+ct+15;Nn+En.width+20>window.innerWidth&&(Nn=Hn.left+ct-En.width-15+Tt.bbox.left),Nn=Math.max(4,Nn);let Br=Hn.top-En.height+20;Br<4&&(Br=Hn.bottom-20),D.current.style.left=`${Nn-En.left}px`,D.current.style.top=`${Br-En.top}px`}]}};N.current&&N.current.destroy();const Qe=new no(Be,ke,Ne);N.current=Qe;const ht=()=>{const Tt=P.current;if(Tt!=null){let ct=ke[0][Tt];ct!==void 0&&!isNaN(ct)&&(x!=null&&ct>x&&(ct=x),S(ct))}};Ne.addEventListener("click",ht);const It=new ResizeObserver(Tt=>{for(const ct of Tt){const{width:Ut}=ct.contentRect;Qe&&Ut>0&&Qe.setSize({width:Ut,height:ft})}});return It.observe(Ne),()=>{Ne.removeEventListener("click",ht),It.disconnect(),Qe.destroy(),N.current=null}},[ke,we,Fe,i,fe,Se,Q,xe,a,s,c,Ue,Oe,S,x,t,Pe,me,w,U,W,Y,$]);const Ae=M.useCallback(()=>{D.current&&(D.current.style.display="none")},[]),ve=Te&&(!oe||_e),qe=U||W||Y!==null||$!==null;return f.jsxs("div",{ref:C,className:Rt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",ve&&"opacity-50"),children:[f.jsxs("div",{className:"shrink-0 mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/card:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:U,onCheckedChange:Z,children:"Ignore Outliers"}),f.jsx(ti,{checked:W,onCheckedChange:K,children:"Ignore First Step"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:Y??"",onChange:Ne=>{const $e=Ne.target.value;ne($e===""?null:Number($e))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:$??"",onChange:Ne=>{const $e=Ne.target.value;H($e===""?null:Number($e))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]})]})]}),f.jsx("button",{onClick:d,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:f.jsx(fu,{className:"h-3.5 w-3.5"})})]})]}),qe&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[U&&f.jsx(Ul,{label:"Ignore Outliers",onRemove:()=>Z(!1)}),W&&f.jsx(Ul,{label:"Ignore First Step",onRemove:()=>K(!1)}),Y!==null&&f.jsx(Ul,{label:`Min Y: ${Y}`,onRemove:()=>ne(null)}),$!==null&&f.jsx(Ul,{label:`Max Y: ${$}`,onRemove:()=>H(null)})]})]}),Fe?f.jsxs("div",{className:"h-40 cursor-pointer relative bg-background rounded",ref:A,onMouseLeave:Ae,children:[f.jsx("div",{ref:D,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),oe&&!_e&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:Te?"Loading...":"No data"})]})}function B6e(t,e=20){if(t.length===0)return{binEdges:[],counts:[]};const n=Math.min(...t),r=Math.max(...t);if(n===r)return{binEdges:[n-.5,n+.5],counts:[t.length]};const i=(r-n)/e,s=[],o=new Array(e).fill(0);for(let a=0;a<=e;a++)s.push(n+a*i);for(const a of t){let l=Math.floor((a-n)/i);l>=e&&(l=e-1),o[l]++}return{binEdges:s,counts:o}}function H6e({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:o,scrollRoot:a=null}){const l=Jn(No),c=M.useRef(null),d=M.useRef(null),p=M.useRef(null),m=M.useRef(null),x=X9(c,{root:a,threshold:0}),{data:b,isFetching:_,isRefetching:S,isPlaceholderData:w}=tde(t,e??null,n,x&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:C,hasData:A}=M.useMemo(()=>{const O=(b==null?void 0:b.values)??[];if(O.length===0)return{histogramData:null,hasData:!1};const{binEdges:R,counts:L}=B6e(O,25),V=R.slice(0,-1).map((F,U)=>(F+R[U+1])/2);return{histogramData:{binEdges:R,binCenters:V,counts:L,totalCount:O.length,min:Math.min(...O),max:Math.max(...O),mean:O.reduce((F,U)=>F+U,0)/O.length},hasData:!0}},[b==null?void 0:b.values]),N=M.useCallback(O=>O==null?"N/A":s?Math.round(O).toLocaleString():td(O),[s]);M.useEffect(()=>{if(!d.current||!C||!A)return;const O=d.current,R=O.clientWidth,L=160,V=new Float64Array(C.binCenters),F=new Float64Array(C.counts),U=[V,F],Y=Math.max(...C.counts)*1.1,$=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",X=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Z="rgba(59, 130, 246, 0.7)",K=C.binEdges[1]-C.binEdges[0],H={width:R,height:L,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,Y]}},axes:[{stroke:X,grid:{stroke:$,width:1},ticks:{stroke:$,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(j,ie)=>ie.map(ce=>Math.abs(ce)>=1e3?`${parseFloat((ce/1e3).toFixed(1))}k`:Math.abs(ce)<.01&&ce!==0?ce.toExponential(1):String(parseFloat(ce.toFixed(2))))},{stroke:X,grid:{stroke:$,width:1},ticks:{stroke:$,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(j,ie)=>{if(!ie||ie.length===0)return 36;const ce=Math.max(...ie.map(te=>te.length));return Math.max(36,ce*6+12)},values:(j,ie)=>ie.map(ce=>ce>=1e3?`${(ce/1e3).toFixed(0)}k`:Math.round(ce).toString())}],series:[{label:"Value"},{label:"Count",stroke:Z,fill:Z,width:0,paths:(j,ie)=>{const ce=new Path2D,{data:te}=j,se=te[0],le=te[ie];for(let re=0;re<se.length;re++){const pe=se[re],be=le[re];if(be==null||be===0)continue;const xe=j.valToPos(pe-K/2,"x",!0),Pe=j.valToPos(pe+K/2,"x",!0),me=j.valToPos(0,"y",!0),ke=j.valToPos(be,"y",!0),we=Math.max(1,Pe-xe-1);ce.rect(xe+.5,ke,we,me-ke)}return{stroke:ce,fill:ce}}}],hooks:{draw:[j=>{if(i&&C.min<0&&C.max>0){const ie=j.ctx,ce=j.valToPos(0,"x",!0),te=j.valToPos(0,"y",!0),se=j.valToPos(Y,"y",!0);ie.save(),ie.strokeStyle=l?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",ie.lineWidth=1,ie.setLineDash([5,5]),ie.beginPath(),ie.moveTo(ce,te),ie.lineTo(ce,se),ie.stroke(),ie.restore()}}],setCursor:[j=>{if(!m.current)return;const{left:ie,idx:ce}=j.cursor;if(ce==null||ie===void 0||ie<0){m.current.style.display="none";return}const te=C.binCenters[ce],se=C.counts[ce],le=C.binEdges[ce],re=C.binEdges[ce+1];if(te===void 0||se===void 0){m.current.style.display="none";return}const pe=(se/C.totalCount*100).toFixed(1);m.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${N(le)} - ${N(re)}</div>
              <div class="text-muted-foreground">Count: ${se.toLocaleString()} (${pe}%)</div>
            `,m.current.style.display="block",m.current.style.left="0px",m.current.style.top="0px";const be=m.current.getBoundingClientRect(),xe=d.current.getBoundingClientRect();let Pe=xe.left+ie+15;Pe+be.width+20>window.innerWidth&&(Pe=xe.left+ie-be.width-15+j.bbox.left),Pe=Math.max(4,Pe);let me=xe.top-be.height+20;me<4&&(me=xe.bottom-20),m.current.style.left=`${Pe-be.left}px`,m.current.style.top=`${me-be.top}px`}]}};p.current&&p.current.destroy();const B=new no(H,U,O);p.current=B;const G=new ResizeObserver(j=>{for(const ie of j){const{width:ce}=ie.contentRect;B&&ce>0&&B.setSize({width:ce,height:L})}});return G.observe(O),()=>{G.disconnect(),B.destroy(),p.current=null}},[C,A,i,N,l]);const D=M.useCallback(()=>{m.current&&(m.current.style.display="none")},[]),P=_&&(!S||w);return f.jsxs("div",{ref:c,className:Rt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",P&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:f.jsx(fu,{className:"h-3.5 w-3.5"})})})]}),A?f.jsxs("div",{className:"h-40 relative bg-background rounded",ref:d,onMouseLeave:D,children:[f.jsx("div",{ref:m,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),S&&!w&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:_?"Loading...":e==null?"Select a step to view histogram":"No data"})]})}const G5=100;function V6e(t,e,n){const r=t.length;if(r<=G5)return{steps:t,counts:e};const i=Math.ceil(r/G5),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const p=new Array(a).fill(0);for(let m=l;m<c;m++){const x=e[m];for(let b=0;b<a;b++)p[b]+=x[b]||0}o.push(p)}return{steps:s,counts:o}}function G6e({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:o,onRemove:a,selectedStepAtom:l=bT,maxSelectableStep:c,scrollRoot:d=null}){const p=Jn(No),m=M.useRef(null),x=M.useRef(null),b=M.useRef(null),_=M.useRef(null),S=M.useRef(null),w=$d(l),C=X9(m,{root:d,threshold:0}),{data:A,isFetching:N,isRefetching:D,isPlaceholderData:P}=qG(t,e,C&&!!t&&!!e,o),O=A&&A.steps.length>0&&A.bin_edges.length>0,R=O&&A.steps.length>G5,L=M.useMemo(()=>!O||!A?null:R?V6e(A.steps,A.counts,A.bin_edges):{steps:A.steps,counts:A.counts},[O,A,R]),V=M.useCallback(Z=>Z==null?"N/A":i?Math.round(Z).toLocaleString():td(Z),[i]),F=M.useCallback(Z=>Math.abs(Z)>=1e3?`${parseFloat((Z/1e3).toFixed(1))}k`:i?Math.round(Z).toString():Number.isInteger(Z)?Z.toLocaleString():Math.abs(Z)<.01&&Z!==0?Z.toExponential(1):String(parseFloat(Z.toFixed(2))),[i]),U=M.useCallback(()=>{const Z={top:8,right:8,bottom:24,left:40};if(!b.current||!A)return Z;const K=b.current.getContext("2d");if(!K)return Z;const ne="10px system-ui, sans-serif",H=5;let B=0;K.save(),K.setTransform(1,0,0,1,0,0),K.font=ne;for(let G=0;G<H;G++){const j=(A.global_min??0)+G/(H-1)*((A.global_max??0)-(A.global_min??0)),ie=F(j);B=Math.max(B,K.measureText(ie).width)}return K.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(B)+12)}},[A,F]);M.useEffect(()=>{if(!x.current||!b.current||!O||!A||!L)return;const Z=x.current,K=b.current,ne=K.getContext("2d");if(!ne)return;const H=Z.clientWidth,B=160,G=p?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",j=p?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ie="10px system-ui, sans-serif",ce=window.devicePixelRatio||1;K.width=H*ce,K.height=B*ce,K.style.width=`${H}px`,K.style.height=`${B}px`,ne.scale(ce,ce),ne.font=ie,ne.clearRect(0,0,H,B);const te=U(),se=H-te.left-te.right,le=B-te.top-te.bottom,re=L.steps,pe=A.bin_edges,be=L.counts,xe=re.length,Pe=pe.length-1;if(xe===0||Pe===0)return;let me=0;for(const Oe of be)for(const ue of Oe)ue>me&&(me=ue);const ke=Math.min(5,xe),we=5,Te=se/Math.max(xe,1),oe=Oe=>te.left+(Oe+.5)*Te,_e=Oe=>{const ue=(A.global_max??1)-(A.global_min??0),Q=(Oe-(A.global_min??0))/(ue||1);return te.top+le-Q*le},Fe=Oe=>Oe===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Oe/me)*.75})`;ne.strokeStyle=j,ne.lineWidth=1;for(let Oe=0;Oe<ke;Oe++){const ue=Math.floor(Oe/Math.max(ke-1,1)*(xe-1)),Q=oe(ue);ne.beginPath(),ne.moveTo(Q,te.top),ne.lineTo(Q,B-te.bottom),ne.stroke()}for(let Oe=0;Oe<we;Oe++){const ue=(A.global_min??0)+Oe/(we-1)*((A.global_max??0)-(A.global_min??0)),Q=_e(ue);ne.beginPath(),ne.moveTo(te.left,Q),ne.lineTo(H-te.right,Q),ne.stroke()}const Ue=Te;for(let Oe=0;Oe<xe;Oe++){const ue=te.left+Oe*Te,Q=be[Oe];for(let fe=0;fe<Pe;fe++){const Se=Q[fe];if(Se===0)continue;const Ae=pe[fe+1],ve=pe[fe],qe=_e(Ae),Ee=_e(ve),Ce=Math.max(1,Ee-qe);ne.fillStyle=Fe(Se),ne.fillRect(ue,qe,Ue,Ce)}}if(r&&(A.global_min??0)<0&&(A.global_max??0)>0){const Oe=_e(0);ne.strokeStyle=p?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",ne.lineWidth=1,ne.setLineDash([5,5]),ne.beginPath(),ne.moveTo(te.left,Oe),ne.lineTo(H-te.right,Oe),ne.stroke(),ne.setLineDash([])}if(s!=null){let Oe=-1,ue=1/0;for(let Q=0;Q<re.length;Q++){const fe=Math.abs(re[Q]-s);fe<ue&&(ue=fe,Oe=Q)}if(Oe>=0){const Q=oe(Oe);ne.strokeStyle=p?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",ne.lineWidth=1,ne.beginPath(),ne.moveTo(Q,te.top),ne.lineTo(Q,B-te.bottom),ne.stroke()}}ne.strokeStyle=G,ne.lineWidth=1,ne.beginPath(),ne.moveTo(te.left,B-te.bottom),ne.lineTo(H-te.right,B-te.bottom),ne.stroke(),ne.beginPath(),ne.moveTo(te.left,te.top),ne.lineTo(te.left,B-te.bottom),ne.stroke(),ne.fillStyle=G,ne.font=ie,ne.textAlign="center";for(let Oe=0;Oe<ke;Oe++){const ue=Math.floor(Oe/Math.max(ke-1,1)*(xe-1)),Q=re[ue],fe=oe(ue),Se=Q>=1e3?`${(Q/1e3).toFixed(0)}k`:Q.toString();ne.fillText(Se,fe,B-6)}ne.textAlign="right",ne.textBaseline="middle";for(let Oe=0;Oe<we;Oe++){const ue=(A.global_min??0)+Oe/(we-1)*((A.global_max??0)-(A.global_min??0)),Q=_e(ue);ne.fillText(F(ue),te.left-4,Q)}},[A,L,O,r,s,F,U,p]),M.useEffect(()=>{if(!x.current)return;const Z=x.current,K=new ResizeObserver(()=>{if(b.current&&x.current){const ne=x.current.clientWidth;b.current.style.width=`${ne}px`}});return K.observe(Z),()=>{K.disconnect()}},[]);const W=M.useCallback(Z=>{if(!A||!L||!b.current||!x.current)return;const K=b.current.getBoundingClientRect(),ne=Z.clientX-K.left,H=x.current.clientWidth,B=U(),G=H-B.left-B.right;if(G<=0)return;const j=(ne-B.left)/G,ie=Math.round(j*(L.steps.length-1));if(ie>=0&&ie<L.steps.length){let ce=L.steps[ie];c!=null&&ce>c&&(ce=c),w(ce)}},[A,L,U,w,c]),Y=M.useCallback(Z=>{var Se;if(!A||!L||!_.current||!b.current||!x.current)return;const K=b.current.getBoundingClientRect(),ne=Z.clientX-K.left,H=Z.clientY-K.top,B=x.current.clientWidth,G=160,j=U(),ie=B-j.left-j.right,ce=G-j.top-j.bottom;if(ie<=0||ce<=0){S.current&&(S.current.style.display="none");return}if(ne<j.left||ne>B-j.right||H<j.top||H>G-j.bottom){_.current.style.display="none",S.current&&(S.current.style.display="none");return}const te=(ne-j.left)/ie,se=Math.min(L.steps.length-1,Math.max(0,Math.round(te*(L.steps.length-1)))),le=L.steps[se];if(S.current){const Ae=ie/Math.max(L.steps.length,1),ve=j.left+(se+.5)*Ae;S.current.style.display="block",S.current.style.left=`${ve}px`,S.current.style.top=`${j.top}px`,S.current.style.bottom=`${j.bottom}px`}const re=1-(H-j.top)/ce,pe=A.bin_edges.length-1,be=Math.min(pe-1,Math.max(0,Math.floor(re*pe))),xe=A.bin_edges[be],Pe=A.bin_edges[be+1],me=((Se=L.counts[se])==null?void 0:Se[be])??0,we=(L.counts[se]??[]).reduce((Ae,ve)=>Ae+ve,0),Te=we>0?(me/we*100).toFixed(1):"0.0",_e=R&&A.steps.length>G5?" (aggregated)":"";_.current.innerHTML=`
        <div class="font-medium mb-1">Step ${le.toLocaleString()}${_e}</div>
        <div class="text-muted-foreground">Range: ${V(xe)} to ${V(Pe)}</div>
        <div class="text-muted-foreground">Count: ${me.toLocaleString()} (${Te}%)</div>
      `,_.current.style.display="block",_.current.style.left="0px",_.current.style.top="0px";const Fe=_.current.getBoundingClientRect(),Ue=Z.clientX;let Oe=Ue;Oe+Fe.width+20>window.innerWidth&&(Oe=Ue-Fe.width);const ue=Math.max(4,window.innerWidth-Fe.width-4);Oe=Math.min(Math.max(4,Oe),ue);const Q=x.current.getBoundingClientRect();let fe=Q.top-Fe.height+20;fe<4&&(fe=Q.bottom-20),_.current.style.left=`${Oe-Fe.left}px`,_.current.style.top=`${fe-Fe.top}px`},[A,L,V,U,R]),$=M.useCallback(()=>{_.current&&(_.current.style.display="none"),S.current&&(S.current.style.display="none")},[]),X=N&&(!D||P);return f.jsxs("div",{ref:m,className:Rt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",X&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("button",{onClick:a,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:f.jsx(fu,{className:"h-3.5 w-3.5"})})})]}),O?f.jsxs("div",{className:"h-40 relative bg-background rounded",ref:x,children:[f.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:b,onClick:W,onMouseMove:Y,onMouseLeave:$}),f.jsx("div",{ref:S,className:"absolute z-[2] border-l border-dashed border-border pointer-events-none",style:{display:"none"}}),f.jsx("div",{ref:_,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),D&&!P&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:N?"Loading...":"No data"})]})}function FS(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function W6e(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function sN(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function SF(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Number(e);if(Number.isFinite(n))return n}return null}function oN(t,e,n=85){if(t===null||e===null||e<=0)return null;const r=Math.max(0,Math.min(e,t));return`hsl(0 0% ${n-r/e*(n-5)}%)`}function Z9({openAtom:t=S7}={}){const[e,n]=dn(t);return!Jn(xl)||e?null:f.jsx(Mn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const wF=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function Q9({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:o,currentStepIndex:a,totalSteps:l,onStepChange:c,hasSteps:d,stepValues:p,openAtom:m=S7,selectedGroupIdAtom:x=PG,selectedSampleIdxAtom:b=IG,viewModeAtom:_=LG,getGroupBadge:S,renderLeftControls:w,onGroupClick:C,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var Ve,lt,Le,Ne,$e,ft,nt,We,Ke;const[D,P]=dn(m),[O,R]=dn(x),[L,V]=dn(b),[F,U]=dn(_),[W,Y]=dn(nce),[$,X]=dn(rce),Z=Jn(xl),{data:K}=cd(Z||"",!!Z,!0),ne=(Ve=K==null?void 0:K.config)==null?void 0:Ve.max_tokens,H=M.useMemo(()=>SF(ne),[ne]),B=(lt=K==null?void 0:K.config)==null?void 0:lt.group_size,G=M.useMemo(()=>SF(B),[B]),j=M.useMemo(()=>{if(G==null||G<=1)return null;const je=Math.sqrt(G-1);return{min:-je,max:je}},[G]),ie=N??((Le=K==null?void 0:K.config)==null?void 0:Le.environments),ce=M.useMemo(()=>_w(ie),[ie]),te=M.useMemo(()=>{var Lt;const je=yp(ie),et=yp((Lt=K==null?void 0:K.summary)==null?void 0:Lt.env_details),pt=Sw(K==null?void 0:K.data_metric_ranges);return bp(bp(je,et),pt)},[ie,(Ne=K==null?void 0:K.summary)==null?void 0:Ne.env_details,K==null?void 0:K.data_metric_ranges]),se=M.useMemo(()=>{var et;const je=[ie,(et=K==null?void 0:K.summary)==null?void 0:et.env_details];for(const pt of je){const Lt=$8(pt);if(Lt.length!==0)return Lt.some(wt=>(wt==null?void 0:wt.is_multi_turn)===!0)}return!1},[ie,($e=K==null?void 0:K.summary)==null?void 0:$e.env_details]),[le,re]=M.useState(new Map),pe=M.useMemo(()=>{if(!r)return null;const je=new Map;for(const et of r){let pt=je.get(et.sample_idx);pt||(pt=new Map,je.set(et.sample_idx,pt)),pt.set(et.metric_name,{value:et.value,env:et.env})}return je},[r]);pe!==null&&pe!==le&&re(pe);const be=pe??le,[xe,Pe]=M.useState([]),me=M.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const je=new Set;for(const et of r)je.add(et.metric_name);return[...je].sort()},[i,r]);me!==null&&me!==xe&&Pe(me);const ke=me??xe,we=(je,et)=>{Y(pt=>et===!0?pt.includes(je)?pt:[...pt,je]:pt.filter(Lt=>Lt!==je))};M.useEffect(()=>{if(!ke.length&&!e)return;const je=new Set;A&&(je.add("reward"),je.add("advantage")),se?je.add("gen_length"):(je.add("gen_length_sum"),je.add("gen_length_avg"));const et=wF.filter(Lt=>!je.has(Lt)),pt=new Set([...et,...ke]);Y(Lt=>{let wt=Lt;!se&&!Lt.includes("gen_length")&&(Lt.includes("gen_length_avg")||Lt.includes("gen_length_sum"))?wt=[...wt.filter(Pt=>Pt!=="gen_length_avg"&&Pt!=="gen_length_sum"),"gen_length"]:se&&!Lt.includes("gen_length_avg")&&Lt.includes("gen_length")&&(wt=[...wt.filter(Pt=>Pt!=="gen_length"),"gen_length_avg"]);const yt=wt.filter(Pt=>pt.has(Pt));return yt.length===Lt.length&&yt.every((Pt,zt)=>Pt===Lt[zt])?Lt:yt})},[ke,e,Y,A,se]);const Te=M.useMemo(()=>{const je=new Set;A&&(je.add("reward"),je.add("advantage")),se?je.add("gen_length"):(je.add("gen_length_sum"),je.add("gen_length_avg"));const et=[],pt=new Set;for(const Lt of wF)je.has(Lt)||W.includes(Lt)&&!pt.has(Lt)&&(et.push(Lt),pt.add(Lt));for(const Lt of ke)W.includes(Lt)&&!pt.has(Lt)&&(et.push(Lt),pt.add(Lt));return et},[W,ke,A,se]),[oe,_e]=M.useState([]),Fe=M.useRef(0),Ue=M.useRef(null),Oe=M.useRef(o),ue=M.useRef(0);M.useEffect(()=>{var pt;const je=(pt=Ue.current)==null?void 0:pt.querySelector('[data-slot="scroll-area-viewport"]');if(!je)return;const et=()=>{ue.current=je.scrollTop};return je.addEventListener("scroll",et,{passive:!0}),()=>je.removeEventListener("scroll",et)},[D]),M.useEffect(()=>{var je;if(o!==Oe.current){Oe.current=o,Fe.current=0,ue.current=0;const et=(je=Ue.current)==null?void 0:je.querySelector('[data-slot="scroll-area-viewport"]');et&&(et.scrollTop=0)}},[o]);const Q=M.useMemo(()=>{if(!t)return new Map;const je=new Map;for(const et of t)je.set(et.group_id,et);return je},[t]),fe=M.useMemo(()=>{if(!n)return new Map;const je=new Map;for(const et of n)je.set(et.sample_idx,et);return je},[n]),Se=M.useMemo(()=>{if(!e)return null;const je=new Map,et=new Map;for(const yt of e){const Pt=je.get(yt.sample_idx)||[];Pt.push(yt),je.set(yt.sample_idx,Pt),et.set(yt.sample_idx,yt.group_id)}const pt=new Map;for(const[yt,Pt]of je){const zt=[...Pt].sort((nn,En)=>nn.turn_order-En.turn_order),Dt=et.get(yt)??-1,Et=Q.get(Dt)??null,Be=fe.get(yt),Qe=zt.find(nn=>nn.turn_type==="model"),ht=(Qe==null?void 0:Qe.content)??"";let It=null,Tt=null,ct=0,Ut=0;for(const nn of zt)nn.turn_type==="model"&&typeof nn.tokens=="number"&&(ct+=nn.tokens,Ut+=1);Ut>0&&(It=ct/Ut,Tt=ct);const Gt={sample_idx:yt,group_id:Dt,prompt:Et,responsePreview:ht,turnsCount:zt.length,turnsData:zt,reward:(Be==null?void 0:Be.reward)??null,advantage:(Be==null?void 0:Be.advantage)??null,assistantTokens:It,assistantTokensTotal:Tt},sn=pt.get(Dt)||[];sn.push(Gt),pt.set(Dt,sn)}const Lt=[];for(const[yt,Pt]of pt){const zt=Q.get(yt)??null;Pt.sort((Dt,Et)=>Dt.sample_idx-Et.sample_idx),Lt.push({group_id:yt,prompt:zt,samples:Pt,sampleCount:Pt.length})}return Lt.sort((yt,Pt)=>yt.group_id-Pt.group_id)},[e,Q,fe]);Se!==null&&Se!==oe&&_e(Se);const Ae=Se??oe;M.useLayoutEffect(()=>{var et;const je=(et=Ue.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');je&&ue.current>0&&je.scrollTop!==ue.current&&(je.scrollTop=ue.current)},[Ae]);const ve=M.useMemo(()=>O===null?null:Ae.find(je=>je.group_id===O)??null,[Ae,O]),qe=ve!==null,Ee=M.useMemo(()=>{let je=0;for(const et of Ae)for(const pt of et.samples)pt.assistantTokens!==null&&pt.assistantTokens>je&&(je=pt.assistantTokens);return je>0?je:null},[Ae]),Ce=H??Ee,Ye=M.useMemo(()=>{let je=0;for(const et of Ae)for(const pt of et.samples)pt.assistantTokensTotal!==null&&pt.assistantTokensTotal>je&&(je=pt.assistantTokensTotal);return je>0?je:null},[Ae]),Ze=H!=null?Math.max(H,Ye??0)||null:Ye;M.useEffect(()=>{!qe&&F==="samples"&&!s&&U("groups")},[qe,F,U,s]);const it=je=>{var pt;const et=(pt=Ue.current)==null?void 0:pt.querySelector('[data-slot="scroll-area-viewport"]');if(et&&(Fe.current=et.scrollTop),C){const Lt=Ae.find(wt=>wt.group_id===je);Lt&&C(je,Lt);return}R(je),U("samples")},ut=je=>{V(je)},De=je=>{var et;if(je==="samples"&&!qe){U("groups");return}if(je==="groups"||je==="samples"){if(F==="groups"&&je==="samples"){const pt=(et=Ue.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');pt&&(Fe.current=pt.scrollTop)}U(je)}};return M.useEffect(()=>{F==="groups"&&Fe.current>0&&requestAnimationFrame(()=>{var et;const je=(et=Ue.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');je&&(je.scrollTop=Fe.current,ue.current=Fe.current)})},[F]),M.useEffect(()=>{F!=="samples"||L===null||requestAnimationFrame(()=>{var pt;const je=(pt=Ue.current)==null?void 0:pt.querySelector('[data-slot="scroll-area-viewport"]');if(!je)return;const et=je.querySelector(`[data-sample-idx="${L}"]`);et&&(et.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{ue.current=je.scrollTop},350))})},[F,L]),!Z||!D?null:f.jsxs("div",{className:"w-[260px] border-r border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[f.jsxs("div",{className:"border-b border-sidebar-border shrink-0",children:[f.jsx("div",{className:"py-2.5 px-1 flex items-center justify-center h-12",children:d?f.jsx(q8,{currentPage:a,totalPages:l,onPageChange:c,pageValues:p}):f.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Loading...":"No steps available"})}),f.jsxs("div",{className:"py-1.5 px-3 flex items-center justify-between border-t border-sidebar-border",children:[w?w({viewMode:F,setViewMode:U,hasSelectedGroupInStep:qe,groups:Ae}):f.jsxs(em,{type:"single",variant:"outline",size:"sm",value:F,onValueChange:De,children:[f.jsx(Wa,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),f.jsx(Wa,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!qe,children:"Samples"})]}),f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:f.jsx(UG,{className:"h-4 w-4"})})}),f.jsxs(ua,{align:"end",className:"min-w-[180px]",children:[f.jsx(K1,{children:"Settings"}),f.jsx(aa,{}),f.jsx(ti,{checked:$,onCheckedChange:je=>X(je===!0),onSelect:je=>je.preventDefault(),children:"Show Tooltips"})]})]}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:f.jsx(JN,{className:"h-4 w-4"})})}),f.jsxs(ua,{align:"end",className:"min-w-[180px]",children:[f.jsx(K1,{children:"Display Metrics"}),f.jsx(aa,{}),se?f.jsxs(f.Fragment,{children:[f.jsx(ti,{checked:W.includes("gen_length_sum"),onCheckedChange:je=>we("gen_length_sum",je),onSelect:je=>je.preventDefault(),children:"Gen. Length Sum"}),f.jsx(ti,{checked:W.includes("gen_length_avg"),onCheckedChange:je=>we("gen_length_avg",je),onSelect:je=>je.preventDefault(),children:"Gen. Length Avg"})]}):f.jsx(ti,{checked:W.includes("gen_length"),onCheckedChange:je=>we("gen_length",je),onSelect:je=>je.preventDefault(),children:"Gen. Length"}),!A&&f.jsx(ti,{checked:W.includes("reward"),onCheckedChange:je=>we("reward",je),onSelect:je=>je.preventDefault(),children:"Reward"}),!A&&f.jsx(ti,{checked:W.includes("advantage"),onCheckedChange:je=>we("advantage",je),onSelect:je=>je.preventDefault(),children:"Advantage"}),ke.length>0&&f.jsx(aa,{}),ke.map(je=>f.jsx(ti,{checked:W.includes(je),onCheckedChange:et=>we(je,et),onSelect:et=>et.preventDefault(),children:vk(je)},je))]})]}),f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>P(!1),children:f.jsx(pue,{className:"h-4 w-4"})})]})]})]}),f.jsx(Ex,{ref:Ue,className:Rt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:Ae.length===0?f.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):F==="groups"||!ve?f.jsx("div",{className:"p-2 space-y-1",children:Ae.map(je=>f.jsx($6e,{group:je,onClick:()=>it(je.group_id),isSelected:O===je.group_id,tokenScaleMax:Ce,tokenScaleSumMax:Ze,envRewardRanges:ce,envMetricRanges:te,advantageRange:j,badge:S?S(je):null,displayMetrics:Te,metricsBySampleIdx:be,tooltipsEnabled:$},je.group_id))}):f.jsxs("div",{className:"flex flex-col min-h-0",children:[f.jsxs(wx,{delayDuration:300,open:$?void 0:!1,children:[f.jsx(Mx,{asChild:!0,children:f.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((ft=ve.prompt)==null?void 0:ft.system_prompt)&&f.jsxs("div",{className:"mb-2",children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),f.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere]",children:FS(ve.prompt.system_prompt,100)})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),f.jsx("p",{className:"text-xs text-foreground line-clamp-3 break-words overflow-hidden [overflow-wrap:anywhere]",children:FS((nt=ve.prompt)==null?void 0:nt.prompt,150)})]})]})}),f.jsxs(Tx,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 space-y-2 bg-popover text-popover-foreground border border-border shadow-md",children:[((We=ve.prompt)==null?void 0:We.system_prompt)&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ve.prompt.system_prompt})]}),((Ke=ve.prompt)==null?void 0:Ke.prompt)&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ve.prompt.prompt})]})]})]}),f.jsx("div",{className:"p-2 space-y-1",children:ve.samples.map(je=>f.jsx("div",{"data-sample-idx":je.sample_idx,children:f.jsx(K6e,{sample:je,isSelected:L===je.sample_idx,onClick:()=>ut(je.sample_idx),envRewardRanges:ce,envMetricRanges:te,advantageRange:j,displayMetrics:Te,metricsBySampleIdx:be,tokenScaleMax:Ce,tokenScaleSumMax:Ze,tooltipsEnabled:$})},je.sample_idx))})]})})]})}function $6e({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:o,advantageRange:a,badge:l,displayMetrics:c,metricsBySampleIdx:d,tooltipsEnabled:p}){var m,x,b,_;return f.jsxs(wx,{delayDuration:300,open:p?void 0:!1,children:[f.jsx(Mx,{asChild:!0,children:f.jsx("button",{onClick:e,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",n?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[((m=t.prompt)==null?void 0:m.system_prompt)&&f.jsx("p",{className:"text-xs text-muted-foreground mb-1 line-clamp-1 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:FS(t.prompt.system_prompt,50)}),f.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:FS((x=t.prompt)==null?void 0:x.prompt,80)}),l&&f.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l})]}),c.length>0&&f.jsx("div",{className:"flex items-start gap-1 shrink-0 pt-0",children:c.map(S=>f.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(w=>{const C=yk(w,S,d,r,i,s,a,o);return f.jsx("div",{title:C.label,className:Rt("h-1.5 w-1.5 rounded-none",C.color?"":"bg-muted"),style:C.color?{backgroundColor:C.color}:void 0},w.sample_idx)})},S))})]})})}),f.jsxs(Tx,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 space-y-2 bg-popover text-popover-foreground border border-border shadow-md",children:[((b=t.prompt)==null?void 0:b.system_prompt)&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.system_prompt})]}),((_=t.prompt)==null?void 0:_.prompt)&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.prompt})]})]})]})}function q6e(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function vk(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function vZ(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function X6e(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return vZ(t)}}function Y6e(t,e,n){var r;if(t){if(e){const i=(r=t.get(e))==null?void 0:r.get(n);if(i)return i}for(const i of t.values()){const s=i.get(n);if(s)return s}}}function yk(t,e,n,r,i,s,o,a,l){var c,d;switch(e){case"gen_length":return{value:t.assistantTokensTotal,color:oN(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length: ${t.assistantTokensTotal}`:"Gen. Length: n/a"};case"gen_length_sum":return{value:t.assistantTokensTotal,color:oN(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length Sum: ${t.assistantTokensTotal}`:"Gen. Length Sum: n/a"};case"gen_length_avg":return{value:t.assistantTokens!==null?Math.round(t.assistantTokens):null,color:oN(t.assistantTokens,r,l),label:t.assistantTokens!==null?`Gen. Length Avg: ${Math.round(t.assistantTokens)}`:"Gen. Length Avg: n/a"};case"reward":{const p=((c=t.prompt)==null?void 0:c.env)??null,m=p?s==null?void 0:s.get(p):void 0;return{value:t.reward,color:t.reward!==null?sN(t.reward,(m==null?void 0:m.min)??null,(m==null?void 0:m.max)??null)??W6e(t.reward):null,label:t.reward!==null?`Reward: ${t.reward.toFixed(2)}`:"Reward: n/a"}}case"advantage":return{value:t.advantage,color:t.advantage!==null?sN(t.advantage,(o==null?void 0:o.min)??null,(o==null?void 0:o.max)??null)??null:null,label:t.advantage!==null?`Advantage: ${t.advantage.toFixed(2)}`:"Advantage: n/a"};default:{const p=n.get(t.sample_idx),m=p==null?void 0:p.get(e);if(!m)return{value:null,color:null,label:`${vk(e)}: n/a`};const x=m.env??((d=t.prompt)==null?void 0:d.env)??null,b=Y6e(a,x,e),_=sN(m.value,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null,b==null?void 0:b.invert);return{value:m.value,color:_??null,label:`${vk(e)}: ${vZ(m.value)}`}}}}function K6e({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:o,metricsBySampleIdx:a,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:d}){return f.jsxs(wx,{delayDuration:300,open:d?void 0:!1,children:[f.jsx(Mx,{asChild:!0,children:f.jsx("button",{onClick:n,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",e?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:f.jsxs("div",{className:"flex items-stretch justify-between gap-2 min-w-0",children:[f.jsx("p",{className:"text-xs text-foreground break-words flex-1 min-w-0 overflow-hidden",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:o.length>0?Math.max(2,o.filter(p=>yk(t,p,a,l,c,r,s,i,70).value!==null).length):2,overflowWrap:"anywhere"},children:FS(t.responsePreview,300)||"No response"}),o.length>0&&f.jsx("div",{className:"flex items-start gap-1 shrink-0",children:f.jsx("div",{className:"flex flex-col items-center gap-0.5",children:o.map(p=>{const m=yk(t,p,a,l,c,r,s,i,70);return m.value===null?null:f.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:m.color?{color:m.color}:void 0,title:m.label,children:X6e(m.value,p)},p)})})})]})})}),f.jsx(Tx,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 bg-popover text-popover-foreground border border-border shadow-md",children:f.jsxs("div",{className:"space-y-3",children:[t.turnsData.map(p=>f.jsxs("div",{children:[f.jsxs("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5 flex items-center gap-2",children:[f.jsx("span",{children:q6e(p.turn_type)}),p.tokens!=null&&f.jsxs("span",{className:"font-normal normal-case",children:[p.tokens.toLocaleString()," tokens"]})]}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:p.content||"(empty)"})]},`${p.sample_idx}-${p.turn_order}`)),t.turnsData.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function Z6e(){var me,ke,we,Te,oe;const t=Jn(xl),[e]=kk(),[n,r]=dn(bT),[i,s]=dn(PG),[o,a]=dn(IG),l=Jn(OG),[c,d]=dn(S7),[,p]=dn(LG),m=Jn(_7),[x,b]=dn(wT),[_,S]=dn(MT),w=x.length+(_?1:0),C=_e=>{b(Fe=>Fe.includes(_e)?Fe.filter(Ue=>Ue!==_e):[...Fe,_e])},[A,N]=M.useState(0),[D,P]=M.useState(0),[O,R]=M.useState(!0),L=!0,V=M.useMemo(()=>{const _e=e.get("step");if(!_e)return null;const Fe=Number(_e);return Number.isFinite(Fe)?Fe:null},[e]),F=M.useMemo(()=>{const _e=e.get("sample");if(!_e)return null;const Fe=Number(_e);return Number.isFinite(Fe)?Fe:null},[e]),U=M.useMemo(()=>{const _e=e.get("group");if(!_e)return null;const Fe=Number(_e);return Number.isFinite(Fe)?Fe:null},[e]),W=M.useRef(null),Y=M.useRef({group:null,sample:null});M.useEffect(()=>{if(!t){W.current=null,Y.current={group:null,sample:null};return}if(V==null){W.current=null;return}V!==W.current&&(r(V),W.current=V)},[V,t,r]),M.useEffect(()=>{t&&(U==null||F==null||Y.current.group===U&&Y.current.sample===F||(s(U),a(F),d(!0),p("samples"),Y.current={group:U,sample:F}))},[U,F,t,s,a,d,p]);const{data:$,isLoading:X,error:Z}=Bue(t||"",n,!!t),{data:K}=cd(t||"",!!t,L),ne=M.useMemo(()=>{var _e;return _w((_e=K==null?void 0:K.config)==null?void 0:_e.environments)},[(me=K==null?void 0:K.config)==null?void 0:me.environments]),H=M.useMemo(()=>{var Oe,ue;const _e=yp((Oe=K==null?void 0:K.config)==null?void 0:Oe.environments),Fe=yp((ue=K==null?void 0:K.summary)==null?void 0:ue.env_details),Ue=Sw(K==null?void 0:K.data_metric_ranges);return bp(bp(_e,Fe),Ue)},[(ke=K==null?void 0:K.config)==null?void 0:ke.environments,(we=K==null?void 0:K.summary)==null?void 0:we.env_details,K==null?void 0:K.data_metric_ranges]),B=M.useMemo(()=>{var Oe;const _e=(Oe=K==null?void 0:K.config)==null?void 0:Oe.group_size,Fe=typeof _e=="object"&&_e!==null&&"value"in _e?Number(_e.value):Number(_e);if(!Fe||isNaN(Fe)||Fe<=1)return null;const Ue=Math.sqrt(Fe-1);return{min:-Ue,max:Ue}},[(Te=K==null?void 0:K.config)==null?void 0:Te.group_size]),G=M.useMemo(()=>{var _e;return(_e=$==null?void 0:$.available_steps)!=null&&_e.length&&n===null?$.available_steps[$.available_steps.length-1]:null},[$,n]);M.useEffect(()=>{G!==null&&n===null&&V==null&&r(G)},[G,V,n,r]);const j=_e=>{r(_e)},[ie,ce]=M.useState([]),[te,se]=M.useState(null);t!==te&&(ce([]),se(t));const le=$==null?void 0:$.available_steps,re=M.useMemo(()=>{const _e=le??[];return[...new Set([...ie,..._e])].sort((Ue,Oe)=>Ue-Oe)},[le,ie]);re.length>ie.length&&ce(re);const pe=re.length>0,be=pe?re[re.length-1]:0,xe=M.useMemo(()=>{if(n==null)return re.length-1;const _e=re.indexOf(n);return _e>=0?_e:re.length-1},[re,n]),Pe=_e=>{_e>=0&&_e<re.length&&j(re[_e])};return t?f.jsxs("div",{className:"flex h-full overflow-hidden",children:[f.jsx(Q9,{prompts:$==null?void 0:$.prompts,data:$==null?void 0:$.rollouts,samplesData:$==null?void 0:$.samples_data,rolloutMetrics:$==null?void 0:$.rollout_metrics,availableMetricNames:$==null?void 0:$.available_rollout_metric_names,isLoading:X,step:n??void 0,currentStepIndex:xe,totalSteps:re.length,onStepChange:Pe,hasSteps:pe,stepValues:re}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center justify-between h-7",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Z9,{}),l&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step ",((oe=l.sample.turns[0])==null?void 0:oe.step)??n]})," · ",f.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",f.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&f.jsx(sC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&f.jsxs(f.Fragment,{children:[f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(_e=>_e+1),R(!1)},children:"Collapse All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(_e=>_e+1),R(!0)},children:"Expand All"}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",w>0&&` (${w})`]})}),f.jsxs(ua,{align:"start",className:"w-auto",children:[f.jsx(ti,{checked:_,onCheckedChange:_e=>S(!!_e),onSelect:_e=>_e.preventDefault(),children:"Format Think"}),f.jsx(ti,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:_e=>_e.preventDefault(),children:"Markdown"}),f.jsx(ti,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:_e=>_e.preventDefault(),children:"LaTeX"}),f.jsx(ti,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:_e=>_e.preventDefault(),children:"Code"})]})]})]})]}),f.jsx(Y9,{})]})})}),f.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:f.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[Z&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",Z instanceof Error?Z.message:"Unknown error"]})})}),f.jsx(E1,{prompts:$==null?void 0:$.prompts,data:$==null?void 0:$.rollouts,samplesData:$==null?void 0:$.samples_data,rolloutMetrics:$==null?void 0:$.rollout_metrics,goldenAnswers:$==null?void 0:$.golden_answers,infoTurns:$==null?void 0:$.info_turns,isLoading:X,step:n??void 0,scrollToSampleId:F,filterGroupId:i,filterSampleIdx:o,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:O,envRewardRanges:ne,envMetricRanges:H,advantageRange:B,renderOptions:x,formatThinkBlocks:_})]})})]}),f.jsx(K9,{currentStep:n,maxSelectableStep:be})]}):f.jsx(bm,{description:"Select a run from the sidebar to view rollouts."})}function Q6e(){var Se,Ae,ve,qe,Ee;const t=Jn(xl),[e]=kk(),[n,r]=dn(KP),[i,s]=dn(ZP),[o,a]=dn(QP),l=Jn(JP),[c,d]=dn(ZE),[,p]=dn(eI),m=Jn(KE),[x,b]=dn(wT),[_,S]=dn(MT),w=x.length+(_?1:0),C=Ce=>{b(Ye=>Ye.includes(Ce)?Ye.filter(Ze=>Ze!==Ce):[...Ye,Ce])},[A,N]=M.useState(0),[D,P]=M.useState(0),[O,R]=M.useState(!0),L=!0,V=M.useMemo(()=>{const Ce=e.get("step")??e.get("trainer_step");if(!Ce)return null;const Ye=Number(Ce);return Number.isFinite(Ye)?Ye:null},[e]),F=M.useMemo(()=>{const Ce=e.get("sample");if(!Ce)return null;const Ye=Number(Ce);return Number.isFinite(Ye)?Ye:null},[e]),U=M.useMemo(()=>{const Ce=e.get("group");if(!Ce)return null;const Ye=Number(Ce);return Number.isFinite(Ye)?Ye:null},[e]),W=M.useRef(null),Y=M.useRef({group:null,sample:null});M.useEffect(()=>{if(!t){W.current=null,Y.current={group:null,sample:null};return}if(V==null){W.current=null;return}V!==W.current&&(r(V),W.current=V)},[V,t,r]),M.useEffect(()=>{t&&(U==null||F==null||Y.current.group===U&&Y.current.sample===F||(s(U),a(F),d(!0),p("samples"),Y.current={group:U,sample:F}))},[U,F,t,s,a,d,p]);const{data:$,isLoading:X,error:Z}=Hue(t||"",n,!!t),{data:K}=cd(t||"",!!t,L),ne=M.useMemo(()=>{var Ce;return _w((Ce=K==null?void 0:K.config)==null?void 0:Ce.environments)},[(Se=K==null?void 0:K.config)==null?void 0:Se.environments]),H=M.useMemo(()=>{var it,ut;const Ce=yp((it=K==null?void 0:K.config)==null?void 0:it.environments),Ye=yp((ut=K==null?void 0:K.summary)==null?void 0:ut.env_details),Ze=Sw(K==null?void 0:K.data_metric_ranges);return bp(bp(Ce,Ye),Ze)},[(Ae=K==null?void 0:K.config)==null?void 0:Ae.environments,(ve=K==null?void 0:K.summary)==null?void 0:ve.env_details,K==null?void 0:K.data_metric_ranges]),B=M.useMemo(()=>{var it;const Ce=(it=K==null?void 0:K.config)==null?void 0:it.group_size,Ye=typeof Ce=="object"&&Ce!==null&&"value"in Ce?Number(Ce.value):Number(Ce);if(!Ye||isNaN(Ye)||Ye<=1)return null;const Ze=Math.sqrt(Ye-1);return{min:-Ze,max:Ze}},[(qe=K==null?void 0:K.config)==null?void 0:qe.group_size]),G=M.useMemo(()=>{var Ce;return(Ce=$==null?void 0:$.available_trainer_steps)!=null&&Ce.length&&n===null?$.available_trainer_steps[$.available_trainer_steps.length-1]:null},[$,n]);M.useEffect(()=>{G!==null&&n===null&&V==null&&r(G)},[G,V,n,r]);const j=Ce=>{r(Ce)},[ie,ce]=M.useState([]),[te,se]=M.useState(null),[le,re]=M.useState(new Map);t!==te&&(ce([]),se(t),re(new Map));const pe=$==null?void 0:$.available_trainer_steps,be=M.useMemo(()=>{const Ce=pe??[];return[...new Set([...ie,...Ce])].sort((Ze,it)=>Ze-it)},[pe,ie]);be.length>ie.length&&ce(be);const xe=be.length>0,Pe=xe?be[be.length-1]:0,me=M.useMemo(()=>{if(n==null)return be.length-1;const Ce=be.indexOf(n);return Ce>=0?Ce:be.length-1},[be,n]),ke=Ce=>{Ce>=0&&Ce<be.length&&j(be[Ce])},we=M.useMemo(()=>{if($!=null&&$.prompts)return $.prompts.map(Ce=>({step:Ce.trainer_step,group_id:Ce.group_id,env:Ce.env,system_prompt:Ce.system_prompt,tokens_system_prompt:Ce.tokens_system_prompt,prompt:Ce.prompt,tokens_prompt:Ce.tokens_prompt}))},[$]),Te=M.useMemo(()=>{if($!=null&&$.rollouts)return $.rollouts.map(Ce=>({step:Ce.trainer_step,group_id:Ce.group_id,sample_idx:Ce.sample_idx,turn_order:Ce.turn_order,turn_type:Ce.turn_type,content:Ce.content,tokens:Ce.tokens}))},[$]),oe=M.useMemo(()=>{if($!=null&&$.samples_data)return $.samples_data.map(Ce=>({step:Ce.trainer_step,group_id:Ce.group_id,sample_idx:Ce.sample_idx,reward:Ce.reward,advantage:Ce.advantage,turns:Ce.turns,total_tokens:Ce.total_tokens,raw_string:Ce.raw_string}))},[$]),_e=M.useMemo(()=>{if(!($!=null&&$.rollout_metrics))return;const Ce=n??0;return $.rollout_metrics.map(Ye=>({step:Ce,sample_idx:Ye.sample_idx,env:Ye.env,metric_name:Ye.metric_name,value:Ye.value}))},[$,n]),Fe=M.useMemo(()=>{if(!($!=null&&$.golden_answers))return;const Ce=n??0;return $.golden_answers.map(Ye=>({step:Ce,sample_idx:Ye.sample_idx,env:Ye.env,key:Ye.key,value:Ye.value}))},[$,n]),Ue=M.useMemo(()=>{if(!($!=null&&$.info_turns))return;const Ce=n??0;return $.info_turns.map(Ye=>({step:Ce,sample_idx:Ye.sample_idx,turn_order:Ye.turn_order,env:Ye.env,info_key:Ye.info_key,info_value:Ye.info_value,info_type:Ye.info_type}))},[$,n]),Oe=M.useMemo(()=>{if(!($!=null&&$.prompts))return null;const Ce=new Map;for(const Ye of $.prompts)Ce.set(Ye.group_id,Ye.discard_reason);return Ce},[$]),ue=Oe??le;Oe&&Oe!==le&&re(Oe);const Q=Ce=>{switch(Ce){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return Ce.split("_").map(Ye=>Ye.charAt(0).toUpperCase()+Ye.slice(1)).join(" ")}},fe=Ce=>{switch(Ce){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}};return t?f.jsxs("div",{className:"flex h-full overflow-hidden",children:[f.jsx(Q9,{prompts:we,data:Te,samplesData:oe,rolloutMetrics:_e,isLoading:X,step:n??void 0,currentStepIndex:me,totalSteps:be.length,onStepChange:ke,hasSteps:xe,stepValues:be,openAtom:ZE,selectedGroupIdAtom:ZP,selectedSampleIdxAtom:QP,viewModeAtom:eI,getGroupBadge:Ce=>{const Ye=ue.get(Ce.group_id);return Ye?f.jsx(J1,{variant:fe(Ye),className:"text-[10px] h-4 px-1.5",children:Q(Ye)}):null}}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center justify-between h-7",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Z9,{openAtom:ZE}),l&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step"," ",((Ee=l.sample.turns[0])==null?void 0:Ee.step)??n]})," · ",f.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",f.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&f.jsx(sC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&f.jsxs(f.Fragment,{children:[f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(Ce=>Ce+1),R(!1)},children:"Collapse All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(Ce=>Ce+1),R(!0)},children:"Expand All"}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",w>0&&` (${w})`]})}),f.jsxs(ua,{align:"start",className:"w-auto",children:[f.jsx(ti,{checked:_,onCheckedChange:Ce=>S(!!Ce),onSelect:Ce=>Ce.preventDefault(),children:"Format Think"}),f.jsx(ti,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:Ce=>Ce.preventDefault(),children:"Markdown"}),f.jsx(ti,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:Ce=>Ce.preventDefault(),children:"LaTeX"}),f.jsx(ti,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:Ce=>Ce.preventDefault(),children:"Code"})]})]})]})]}),f.jsx(Y9,{openAtom:KE})]})})}),f.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:f.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[Z&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",Z instanceof Error?Z.message:"Unknown error"]})})}),f.jsx(E1,{prompts:we,data:Te,samplesData:oe,rolloutMetrics:_e,goldenAnswers:Fe,infoTurns:Ue,isLoading:X,step:n??void 0,scrollToSampleId:F,filterGroupId:i,filterSampleIdx:o,lastValidSampleAtom:JP,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:O,envRewardRanges:ne,envMetricRanges:H,advantageRange:B,renderOptions:x,formatThinkBlocks:_})]})})]}),f.jsx(K9,{currentStep:n,maxSelectableStep:Pe,openAtom:KE,selectedMetricsAtom:tce,selectedStepAtom:KP,includeDiscardedDefaults:!0})]}):f.jsx(bm,{description:"Select a run from the sidebar to view discarded rollouts."})}function J6e(){const t=Jn(xl),{data:e,error:n}=cd(t||"",!!t,!1),r=M.useMemo(()=>pZ(e==null?void 0:e.summary),[e==null?void 0:e.summary]);return t?n?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),f.jsx("div",{className:"text-xs text-muted-foreground",children:n instanceof Error?n.message:"Unknown error"})]})}):e?!r||r.nodes.length===0?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),f.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):f.jsx("div",{className:"h-full w-full",children:f.jsx(gZ,{topology:r})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})}):f.jsx(bm,{description:"Select a run from the sidebar to view cluster topology."})}const fs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],bk=["gpu_utilization_percent","gpu_memory_used_percent","gpu_memory_bandwidth_utilization_percent","gpu_memory_used_gb","gpu_memory_free_gb","gpu_memory_total_gb","gpu_temperature_c","gpu_power_w","gpu_power_limit_w","gpu_clock_sm_mhz","gpu_clock_mem_mhz","gpu_fan_speed_percent"],MF=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],TF=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],CF=["requests_running","requests_waiting","cache_usage","cache_hit_rate","requests_total","prompt_tokens_total","rollout_tokens_total","preemptions_total","cache_hits_total","cache_queries_total","ttft_mean","e2e_latency_mean","itl_mean"];function eNe(t){if(t.length===0)return{start:0,end:1};let e=1/0,n=-1/0;for(const r of t)r.timestamp<e&&(e=r.timestamp),r.timestamp>n&&(n=r.timestamp);return{start:e,end:n}}function W5(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function US(t,e){if(t.startsWith("#")){const n=t.slice(1),r=n.length===3?n.split("").map(i=>i+i).join(""):n;if(r.length===6){const i=Number.parseInt(r.slice(0,2),16),s=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${s}, ${o}, ${e})`}}return t}function _k(t,e){const n=new Map,r=[...t].sort((i,s)=>{const o=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:Number.MAX_SAFE_INTEGER,a=typeof s.node_id=="number"&&Number.isFinite(s.node_id)?s.node_id:Number.MAX_SAFE_INTEGER;return o!==a?o-a:i.gpu_index-s.gpu_index});for(const i of r){const s=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:null,o=`${s??"?"}:${i.gpu_index}`;n.has(o)||n.set(o,{node_id:s,gpu_index:i.gpu_index})}return Array.from(n.values()).map((i,s)=>({seriesKey:W5(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function tNe(t,e){const n=new Map;for(const i of t){const s=`${i.node_id}:${i.gpu_index}`;n.has(s)||n.set(s,{node_id:i.node_id,gpu_index:i.gpu_index})}return Array.from(n.values()).sort((i,s)=>i.node_id-s.node_id||i.gpu_index-s.gpu_index).map((i,s)=>({seriesKey:W5(i.node_id,i.gpu_index,e),node_id:i.node_id,gpu_index:i.gpu_index,label:e?`Node ${i.node_id} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function Sk({series:t,activeSeriesKeys:e,onSeriesHover:n,onSeriesToggle:r}){return t.length===0?null:f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mb-3",children:t.map(i=>{const s=!!(e!=null&&e.has(i.seriesKey)),o=!!e&&e.size>0&&!s;return f.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",s&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:n?()=>n(i.seriesKey):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(i.seriesKey):void 0,children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?US(i.color,.25):i.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function nNe({trainerLabels:t,inferenceLabels:e,activeSeriesKeys:n,onSeriesHover:r,onSeriesToggle:i}){return t.length===0&&e.length===0?null:f.jsxs("div",{className:"space-y-2 mb-3",children:[t.length>0&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Trainer"}),f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:t.map(s=>{const o=!!(n!=null&&n.has(s.seriesKey)),a=!!n&&n.size>0&&!o;return f.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",o&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?US(s.color,.25):s.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`trainer-${s.seriesKey}`)})})]}),e.length>0&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Inference"}),f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:e.map(s=>{const o=!!(n!=null&&n.has(s.seriesKey)),a=!!n&&n.size>0&&!o;return f.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",o&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?US(s.color,.25):s.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function yZ(t){const e=Math.abs(t);if(e>=60)return kT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return qd(t)}const bZ=28;function _Z(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]:void 0,d=l<t.length?t[l]:void 0,p=c!=null,m=d!=null;if(p&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(p)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function SZ(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}function R1({label:t,onRemove:e}){return f.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,f.jsx(fu,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function rNe({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=Jn(No),a=M.useRef(null),l=M.useRef(null),c=M.useRef(null),[d,p]=M.useState(!1),[m,x]=M.useState(null),[b,_]=M.useState(null),S=GT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:w,seriesConfig:C,hasData:A,nodeIds:N,timeRange:D,outlierBounds:P}=M.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:[],timeRange:i??{start:0,end:1},outlierBounds:null};const V=new Set;let F=1/0,U=-1/0;const W=[];for(const G of e){const j=typeof G.node_id=="number"&&Number.isFinite(G.node_id)?G.node_id:0;V.add(j),G.timestamp<F&&(F=G.timestamp),G.timestamp>U&&(U=G.timestamp),W.push(G.value)}const Y=Array.from(V).sort((G,j)=>G-j),$=i??{start:F,end:U},X={},Z=new Set;for(const G of e){const j=typeof G.node_id=="number"&&Number.isFinite(G.node_id)?G.node_id:0;Z.add(G.timestamp),X[G.timestamp]||(X[G.timestamp]={}),X[G.timestamp][j]=G.value}const K=Array.from(Z).sort((G,j)=>G-j);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:Y,timeRange:$,outlierBounds:null};const ne=K.map(G=>G-$.start),H=[{label:"Time"}],B=[ne];for(let G=0;G<Y.length;G++){const j=Y[G],ie=K.map(ce=>{var te;return((te=X[ce])==null?void 0:te[j])??null});B.push(ie),H.push({label:`Node ${j}`,stroke:fs[G%fs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:B,seriesConfig:H,hasData:!0,nodeIds:Y,timeRange:$,outlierBounds:SZ(W)}},[e,i]),O=N.length>1,R=M.useCallback(V=>Math.abs(V)>=1e3?`${parseFloat((V/1e3).toFixed(1))}k`:Number.isInteger(V)?V.toLocaleString():Math.abs(V)<.01&&V!==0?V.toExponential(1):String(parseFloat(V.toFixed(2))),[]);M.useEffect(()=>{if(!a.current||!w||!A)return;const V=a.current,F=V.clientWidth,U=192;let W=Number.POSITIVE_INFINITY,Y=Number.NEGATIVE_INFINITY;for(let te=1;te<w.length;te+=1){const se=w[te];for(let le=0;le<se.length;le+=1){const re=se[le];re!=null&&(d&&P?re>=P.lower&&re<=P.upper&&(re<W&&(W=re),re>Y&&(Y=re)):(re<W&&(W=re),re>Y&&(Y=re)))}}W===Number.POSITIVE_INFINITY&&P&&(W=P.lower,Y=P.upper);const $=Y-W,X=Math.max(Math.abs(Y),Math.abs(W)),Z=Math.max(X*.05,1e-10),K=Math.max($*.1,Z),ne=[m!==null?m:Math.max(0,W-K),b!==null?b:Y+K],H=o?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",B=o?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",j={width:F,height:U,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:O},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(te,se,le)=>{const re=D.end-D.start;return re>0?[0,re]:[se,le]}},y:{range:ne}},axes:[{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(te,se,le,re)=>[le,re],values:(te,se)=>se.map(le=>J0(D.start+Number(le),D.end-D.start))},{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(te,se)=>{if(!se||se.length===0)return 40;const le=Math.max(...se.map(re=>re.length));return Math.max(40,le*7+14)},values:(te,se)=>se.map(R)}],series:C,hooks:{setCursor:[te=>{if(!c.current||!a.current)return;const{left:se,idx:le}=te.cursor;if(le==null||se===void 0||se<0){c.current.style.display="none";return}const re=w[0][le];if(re===void 0){c.current.style.display="none";return}const pe=w[0],be=(()=>{const Ue=te.scales.x,Oe=Number(Ue.min),ue=Number(Ue.max);if(!Number.isFinite(Oe)||!Number.isFinite(ue))return null;const Q=Math.abs(ue-Oe);if(Q<=0)return null;const fe=Math.max(1,te.bbox.width);return Q*bZ/fe})(),xe=yZ(Number(re)+s),Pe=D.start+Number(re);let ke=`<div class="font-medium mb-1">${J0(Pe,D.end-D.start)}</div>`;ke+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${xe}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Pe.toFixed(3)}</div>`;let we=!1;for(let Ue=0;Ue<N.length;Ue+=1){const Oe=w[Ue+1],ue=_Z(Oe,pe,le,be);if(ue===null)continue;const Q=Oe==null?void 0:Oe[ue];if(Q==null)continue;we=!0;const fe=td(Q);ke+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ue%fs.length]}"></div>
                  <span class="text-muted-foreground">Node ${N[Ue]}:</span>
                  <span class="font-medium">${fe} ${S.unit}</span>
                </div>
              `}if(!we){c.current.style.display="none";return}c.current.innerHTML=ke,c.current.style.display="block";const Te=a.current.getBoundingClientRect(),oe=c.current.getBoundingClientRect();let _e=Te.left+se+15;_e+oe.width+20>window.innerWidth&&(_e=Te.left+se-oe.width-15+te.bbox.left),_e=Math.max(4,_e);let Fe=Te.top-oe.height+20;Fe<4&&(Fe=Te.bottom-20),c.current.style.left=`${_e}px`,c.current.style.top=`${Fe}px`}]}};l.current&&l.current.destroy();const ie=new no(j,w,V);l.current=ie;const ce=new ResizeObserver(te=>{for(const se of te){const{width:le}=se.contentRect;ie&&le>0&&ie.setSize({width:le,height:U})}});return ce.observe(V),()=>{ce.disconnect(),ie.destroy(),l.current=null}},[w,A,C,t,D,s,O,S.unit,N,R,d,P,m,b,o]);const L=M.useCallback(()=>{c.current&&(c.current.style.display="none")},[]);return f.jsxs("div",{className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background",n&&"opacity-60"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:S.label}),d&&f.jsx(R1,{label:"Ignore Outliers",onRemove:()=>p(!1)}),m!==null&&f.jsx(R1,{label:`Min Y: ${m}`,onRemove:()=>x(null)}),b!==null&&f.jsx(R1,{label:`Max Y: ${b}`,onRemove:()=>_(null)})]}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:d,onCheckedChange:p,children:"Ignore Outliers"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:m??"",onChange:V=>{const F=V.target.value;x(F===""?null:Number(F))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:b??"",onChange:V=>{const F=V.target.value;_(F===""?null:Number(F))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]})]})]})})]}),A?f.jsxs("div",{className:"h-48 relative bg-background rounded",ref:a,onMouseLeave:L,children:[r&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),f.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):f.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${S.label}`})]})}function wk({data:t,metricNames:e,intervalStart:n,intervalEnd:r,gpuIndices:i,seriesMode:s,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:d=0}){const p=M.useMemo(()=>{const x=new Map;for(const b of t)x.set(b.metric_name,(x.get(b.metric_name)??0)+1);return e.filter(b=>(x.get(b)??0)>0)},[t,e]),m=M.useMemo(()=>o&&e.length>0?e:o&&e.length===0?bk:p,[o,e,p]);return m.length===0&&!o?f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No GPU metrics data available"}):f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:m.map(x=>{const b=t.filter(_=>_.metric_name===x);return f.jsx(R$,{metricName:x,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:d,xAxisMode:"clock",xAxisTicks:"bounds"},x)})})}function iNe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=M.useMemo(()=>{const l=new Set;for(const d of t)d.metric_name.startsWith("cpu_core_")||l.add(d.metric_name);for(const d of e??[])d.startsWith("cpu_core_")||l.add(d);const c=TF.filter(d=>l.has(d));for(const d of l)c.includes(d)||c.push(d);return c},[t,e]),a=M.useMemo(()=>o.length>0?o:n?TF:o,[o,n]);return a.length===0&&!n?f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No CPU metrics data available"}):f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:a.map(l=>{const c=t.filter(d=>d.metric_name===l);return f.jsx(rNe,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function sNe({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=Jn(No),l=M.useRef(null),c=M.useRef(null),d=M.useRef(null),[p,m]=M.useState(!1),[x,b]=M.useState(null),[_,S]=M.useState(null),w=GT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:C,seriesConfig:A,hasData:N,serverIds:D,timeRange:P,outlierBounds:O}=M.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:[],timeRange:s??{start:0,end:1},outlierBounds:null};const V=new Set;let F=1/0,U=-1/0;const W=[];for(const G of e)V.add(G.server),G.timestamp<F&&(F=G.timestamp),G.timestamp>U&&(U=G.timestamp),W.push(G.value);const Y=Array.from(V).sort((G,j)=>G-j),$=s??{start:F,end:U},X={},Z=new Set;for(const G of e)Z.add(G.timestamp),X[G.timestamp]||(X[G.timestamp]={}),X[G.timestamp][G.server]=G.value;const K=Array.from(Z).sort((G,j)=>G-j);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:Y,timeRange:$,outlierBounds:null};const ne=K.map(G=>G-$.start),H=[{label:"Time"}],B=[ne];for(let G=0;G<Y.length;G++){const j=Y[G],ie=K.map(te=>{var se;return((se=X[te])==null?void 0:se[j])??null}),ce=!!i&&i.size>0&&!i.has(j);B.push(ie),H.push({label:`Server ${j}`,stroke:ce?US(fs[G%fs.length],.25):fs[G%fs.length],width:ce?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:B,seriesConfig:H,hasData:!0,serverIds:Y,timeRange:$,outlierBounds:SZ(W)}},[e,s,i]),R=M.useCallback(V=>Math.abs(V)>=1e3?`${parseFloat((V/1e3).toFixed(1))}k`:Number.isInteger(V)?V.toLocaleString():Math.abs(V)<.01&&V!==0?V.toExponential(1):String(parseFloat(V.toFixed(2))),[]);M.useEffect(()=>{if(!l.current||!C||!N)return;const V=l.current,F=V.clientWidth,U=192;let W=Number.POSITIVE_INFINITY,Y=Number.NEGATIVE_INFINITY;for(let te=1;te<C.length;te+=1){const se=C[te];for(let le=0;le<se.length;le+=1){const re=se[le];re!=null&&(p&&O?re>=O.lower&&re<=O.upper&&(re<W&&(W=re),re>Y&&(Y=re)):(re<W&&(W=re),re>Y&&(Y=re)))}}W===Number.POSITIVE_INFINITY&&O&&(W=O.lower,Y=O.upper);const $=Y-W,X=Math.max(Math.abs(Y),Math.abs(W)),Z=Math.max(X*.05,1e-10),K=Math.max($*.1,Z),ne=[x!==null?x:Math.max(0,W-K),_!==null?_:Y+K],H=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",B=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",j={width:F,height:U,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:!1},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(te,se,le)=>{const re=P.end-P.start;return re>0?[0,re]:[se,le]}},y:{range:ne}},axes:[{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(te,se,le,re)=>[le,re],values:(te,se)=>se.map(le=>J0(P.start+Number(le),P.end-P.start))},{stroke:B,grid:{stroke:H,width:1},ticks:{stroke:H,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(te,se)=>{if(!se||se.length===0)return 40;const le=Math.max(...se.map(re=>re.length));return Math.max(40,le*7+14)},values:(te,se)=>se.map(R)}],series:A,hooks:{setCursor:[te=>{if(!d.current||!l.current)return;const{left:se,idx:le}=te.cursor;if(le==null||se===void 0||se<0){d.current.style.display="none";return}const re=C[0][le];if(re===void 0){d.current.style.display="none";return}const pe=C[0],be=(()=>{const Ue=te.scales.x,Oe=Number(Ue.min),ue=Number(Ue.max);if(!Number.isFinite(Oe)||!Number.isFinite(ue))return null;const Q=Math.abs(ue-Oe);if(Q<=0)return null;const fe=Math.max(1,te.bbox.width);return Q*bZ/fe})(),xe=yZ(Number(re)+o),Pe=P.start+Number(re);let ke=`<div class="font-medium mb-1">${J0(Pe,P.end-P.start)}</div>`;ke+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${xe}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Pe.toFixed(3)}</div>`;let we=!1;for(let Ue=0;Ue<D.length;Ue+=1){const Oe=C[Ue+1],ue=_Z(Oe,pe,le,be);if(ue===null)continue;const Q=Oe==null?void 0:Oe[ue];if(Q==null)continue;we=!0;const fe=td(Q);ke+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ue%fs.length]}"></div>
                  <span class="text-muted-foreground">Server ${D[Ue]}:</span>
                  <span class="font-medium">${fe} ${w.unit}</span>
                </div>
              `}if(!we){d.current.style.display="none";return}d.current.innerHTML=ke,d.current.style.display="block";const Te=l.current.getBoundingClientRect(),oe=d.current.getBoundingClientRect();let _e=Te.left+se+15;_e+oe.width+20>window.innerWidth&&(_e=Te.left+se-oe.width-15+te.bbox.left),_e=Math.max(4,_e);let Fe=Te.top-oe.height+20;Fe<4&&(Fe=Te.bottom-20),d.current.style.left=`${_e}px`,d.current.style.top=`${Fe}px`}]}};c.current&&c.current.destroy();const ie=new no(j,C,V);c.current=ie;const ce=new ResizeObserver(te=>{for(const se of te){const{width:le}=se.contentRect;ie&&le>0&&ie.setSize({width:le,height:U})}});return ce.observe(V),()=>{ce.disconnect(),ie.destroy(),c.current=null}},[C,N,A,t,P,o,w.unit,D,R,p,O,x,_,a]);const L=M.useCallback(()=>{d.current&&(d.current.style.display="none")},[]);return f.jsxs("div",{className:Rt("group/chart rounded-lg border border-border p-3 transition-opacity bg-background",n&&"opacity-60"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:w.label}),p&&f.jsx(R1,{label:"Ignore Outliers",onRemove:()=>m(!1)}),x!==null&&f.jsx(R1,{label:`Min Y: ${x}`,onRemove:()=>b(null)}),_!==null&&f.jsx(R1,{label:`Max Y: ${_}`,onRemove:()=>S(null)})]}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:f.jsx(Cx,{className:"h-3 w-3"})})}),f.jsxs(ua,{align:"end",className:"min-w-[160px]",children:[f.jsx(ti,{checked:p,onCheckedChange:m,children:"Ignore Outliers"}),f.jsx(aa,{}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:x??"",onChange:V=>{const F=V.target.value;b(F===""?null:Number(F))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]}),f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),f.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:_??"",onChange:V=>{const F=V.target.value;S(F===""?null:Number(F))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]})]})]})})]}),N?f.jsxs("div",{className:"h-48 relative bg-background rounded",ref:l,onMouseLeave:L,children:[r&&f.jsx(ld,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),f.jsx("div",{ref:d,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):f.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${w.label}`})]})}function oNe({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=M.useMemo(()=>{const s=new Set;for(const a of t)s.add(a.server);return Array.from(s).sort((a,l)=>a-l).map((a,l)=>({serverId:a,label:`Server ${a}`,color:fs[l%fs.length]}))},[t]);return i.length<=1?null:f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mb-3",children:i.map(s=>{const o=!!(e!=null&&e.has(s.serverId)),a=!!e&&e.size>0&&!o;return f.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",o&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.3:1},onPointerEnter:n?()=>n(s.serverId):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(s.serverId):void 0,children:[f.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?US(s.color,.25):s.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function aNe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=M.useMemo(()=>{const c=new Set;for(const p of t)c.add(p.metric_name);for(const p of e??[])c.add(p);const d=CF.filter(p=>c.has(p));for(const p of c)d.includes(p)||d.push(p);return d},[t,e]),l=M.useMemo(()=>a.length>0?a:n?CF:a,[a,n]);return l.length===0&&!n?f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No vLLM metrics data available"}):f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(c=>{const d=t.filter(p=>p.metric_name===c);return f.jsx(sNe,{metricName:c,data:d,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o},c)})})}function lNe({nodeId:t,gpuCount:e,children:n}){const[r,i]=M.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return f.jsxs(Fi,{open:r,onOpenChange:i,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),f.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),f.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"mt-3",children:n})})]})}function EF({title:t,gpuData:e,gpuMetricNames:n,timeRange:r,nodeGpuMap:i,isLoading:s,isRefetching:o,open:a,onOpenChange:l,nodeMode:c,onNodeModeChange:d,xOffset:p=0}){const[m,x]=M.useState(!0),[b,_]=M.useState("combined"),S=a??m,w=l??x,C=c??b,A=d??_,[N,D]=M.useState(null),[P,O]=M.useState([]),R=i.size>1,L=M.useMemo(()=>{const K=[],ne=Array.from(i.keys()).sort((H,B)=>H-B);for(const H of ne){const B=[...i.get(H)??[]].sort((G,j)=>G-j);for(const G of B)K.push({nodeId:H,gpuIndex:G})}return K.map((H,B)=>({seriesKey:W5(H.nodeId,H.gpuIndex,R),node_id:H.nodeId,gpu_index:H.gpuIndex,label:R?`Node ${H.nodeId} GPU ${H.gpuIndex}`:`GPU ${H.gpuIndex}`,color:R?fs[B%fs.length]:fs[H.gpuIndex%fs.length]}))},[i,R]),V=M.useMemo(()=>{const K=_k(e,R);return K.length>0?K:L},[e,R,L]),F=M.useMemo(()=>{const K=new Set;for(const ne of e)K.add(ne.gpu_index);return Array.from(K).sort((ne,H)=>ne-H)},[e]),U=M.useMemo(()=>{const K=[],ne=Array.from(i.keys()).sort((H,B)=>H-B);for(const H of ne){const B=i.get(H),G=e.filter(ce=>(typeof ce.node_id=="number"?ce.node_id:null)===H&&B.includes(ce.gpu_index)),j=_k(G,!1),ie=j.length>0?j:B.map(ce=>({seriesKey:W5(H,ce,!1),node_id:H,gpu_index:ce,label:`GPU ${ce}`,color:fs[ce%fs.length]}));K.push({nodeId:H,gpuIndices:B,data:G,labels:ie})}return K},[e,i]),W=M.useMemo(()=>{const K=new Set;return C==="combined"||!R?(V.forEach(ne=>K.add(ne.seriesKey)),K):(U.forEach(ne=>{ne.labels.forEach(H=>K.add(H.seriesKey))}),K)},[C,R,V,U]),Y=M.useCallback(K=>{O(ne=>{const H=ne.filter(ce=>!W.has(ce)),B=ne.filter(ce=>W.has(ce)),j=B.includes(K)?B.filter(ce=>ce!==K):[...B,K],ie=W.size>0&&j.length===W.size?[]:j;return[...H,...ie]})},[W]),$=M.useMemo(()=>W.size===0?P:P.filter(K=>W.has(K)),[P,W]),X=M.useMemo(()=>N&&(W.size===0||W.has(N))?N:null,[N,W]),Z=M.useMemo(()=>$.length>0?new Set($):X?new Set([X]):null,[$,X]);return f.jsxs(Fi,{open:S,onOpenChange:w,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Ui,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:t})]})}),S&&R&&f.jsxs(em,{type:"single",variant:"selecting",size:"sm",value:C,onValueChange:K=>{K&&A(K)},children:[f.jsx(Wa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),f.jsx(Wa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-6",children:C==="combined"||!R?f.jsxs(f.Fragment,{children:[f.jsx(Sk,{series:V,activeSeriesKeys:Z,onSeriesHover:D,onSeriesToggle:Y}),f.jsx(wk,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:F,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:Z,xOffset:p})]}):U.map(K=>f.jsxs(lNe,{nodeId:K.nodeId,gpuCount:K.gpuIndices.length,children:[f.jsx(Sk,{series:K.labels,activeSeriesKeys:Z,onSeriesHover:D,onSeriesToggle:Y}),f.jsx(wk,{data:K.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:K.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:Z,xOffset:p})]},K.nodeId))})})]})}function cNe({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:o,inferenceGpus:a,isLoading:l,isRefetching:c,systemMetricsOpen:d,onSystemMetricsOpenChange:p,cpuMetricsOpen:m,onCpuMetricsOpenChange:x,vllmMetricsOpen:b,onVllmMetricsOpenChange:_,roleMode:S,onRoleModeChange:w,trainerSectionOpen:C,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:D,trainerNodeMode:P,onTrainerNodeModeChange:O,inferenceNodeMode:R,onInferenceNodeModeChange:L,overrideTimeRange:V,xOffset:F=0}){const[U,W]=M.useState(!0),[Y,$]=M.useState(!0),[X,Z]=M.useState(!0),[K,ne]=M.useState("separated"),H=d??U,B=p??W,G=m??Y,j=x??$,ie=b??X,ce=_??Z,te=S??K,se=w??ne,[le,re]=M.useState(null),[pe,be]=M.useState([]),[xe,Pe]=M.useState(null),[me,ke]=M.useState([]),we=M.useMemo(()=>V||eNe(t),[t,V]),Te=M.useMemo(()=>{const Ke=new Set(r),je=bk.filter(wt=>Ke.has(wt)),et=MF.filter(wt=>Ke.has(wt)),pt=new Set([...bk,...MF]),Lt=r.filter(wt=>!pt.has(wt)).sort();return[...je,...et,...Lt]},[r]),oe=M.useMemo(()=>new Set(o.map(Ke=>`${Ke.node_id}:${Ke.gpu_index}`)),[o]),_e=M.useMemo(()=>new Set(a.map(Ke=>`${Ke.node_id}:${Ke.gpu_index}`)),[a]),Fe=M.useMemo(()=>oe.size===0?[]:t.filter(Ke=>{const je=typeof Ke.node_id=="number"&&Number.isFinite(Ke.node_id)?Ke.node_id:null;return je===null?!1:oe.has(`${je}:${Ke.gpu_index}`)}),[t,oe]),Ue=M.useMemo(()=>_e.size===0?[]:t.filter(Ke=>{const je=typeof Ke.node_id=="number"&&Number.isFinite(Ke.node_id)?Ke.node_id:null;return je===null?!1:_e.has(`${je}:${Ke.gpu_index}`)}),[t,_e]),Oe=M.useMemo(()=>{const Ke=new Map;for(const je of o){const et=Ke.get(je.node_id)??[];et.includes(je.gpu_index)||et.push(je.gpu_index),Ke.set(je.node_id,et)}for(const[je,et]of Ke)Ke.set(je,et.sort((pt,Lt)=>pt-Lt));return Ke},[o]),ue=M.useMemo(()=>{const Ke=new Map;for(const je of a){const et=Ke.get(je.node_id)??[];et.includes(je.gpu_index)||et.push(je.gpu_index),Ke.set(je.node_id,et)}for(const[je,et]of Ke)Ke.set(je,et.sort((pt,Lt)=>pt-Lt));return Ke},[a]),Q=M.useMemo(()=>{const Ke=new Set;for(const je of t)Ke.add(je.gpu_index);return Array.from(Ke).sort((je,et)=>je-et)},[t]),fe=M.useMemo(()=>{const Ke=new Set;for(const je of t){const et=typeof je.node_id=="number"&&Number.isFinite(je.node_id)?je.node_id:null;Ke.add(et)}return Ke.size>1},[t]),Se=M.useMemo(()=>_k(t,fe),[t,fe]),Ae=M.useMemo(()=>{if(o.length===0&&a.length===0)return[];const Ke=[...o,...a],je=new Set(Ke.map(et=>et.node_id)).size>1;return tNe(Ke,je)},[o,a]),ve=M.useMemo(()=>{const Ke=Se.length>0?Se:Ae,je=new Set(o.map(et=>`${et.node_id}:${et.gpu_index}`));return Ke.filter(et=>{const pt=`${et.node_id??"?"}:${et.gpu_index}`;return je.has(pt)||je.has(`${et.node_id}:${et.gpu_index}`)})},[Se,Ae,o]),qe=M.useMemo(()=>{const Ke=Se.length>0?Se:Ae,je=new Set(a.map(et=>`${et.node_id}:${et.gpu_index}`));return Ke.filter(et=>{const pt=`${et.node_id??"?"}:${et.gpu_index}`;return je.has(pt)||je.has(`${et.node_id}:${et.gpu_index}`)})},[Se,Ae,a]),Ee=M.useMemo(()=>{const Ke={},je=new Set(o.map(pt=>`${pt.node_id}:${pt.gpu_index}`)),et=new Set(a.map(pt=>`${pt.node_id}:${pt.gpu_index}`));if(fe)for(const pt of t){const Lt=typeof pt.node_id=="number"&&Number.isFinite(pt.node_id)?pt.node_id:null,wt=`${Lt??"?"}:${pt.gpu_index}`,yt=`${Lt}:${pt.gpu_index}`;je.has(yt)||je.has(wt)?Ke[wt]="Trainer":(et.has(yt)||et.has(wt))&&(Ke[wt]="Inference")}else{for(const pt of o)Ke[`gpu:${pt.gpu_index}`]="Trainer";for(const pt of a)Ke[`gpu:${pt.gpu_index}`]="Inference"}return Ke},[t,o,a,fe]),Ce=o.length>0||a.length>0,Ye=Fe.length>0||!!l&&o.length>0,Ze=Ue.length>0||!!l&&a.length>0,it=M.useMemo(()=>{if(!Ce)return Se;const Ke=new Map;for(const je of ve)Ke.set(je.seriesKey,je);for(const je of qe)Ke.set(je.seriesKey,je);return Array.from(Ke.values())},[Ce,Se,ve,qe]),ut=M.useMemo(()=>new Set(it.map(Ke=>Ke.seriesKey)),[it]),De=M.useMemo(()=>ut.size===0?pe:pe.filter(Ke=>ut.has(Ke)),[pe,ut]),Ve=M.useCallback(Ke=>{be(je=>{const et=je.filter(Pt=>!ut.has(Pt)),pt=je.filter(Pt=>ut.has(Pt)),wt=pt.includes(Ke)?pt.filter(Pt=>Pt!==Ke):[...pt,Ke],yt=ut.size>0&&wt.length===ut.size?[]:wt;return[...et,...yt]})},[ut]),lt=M.useMemo(()=>le&&(ut.size===0||ut.has(le))?le:null,[le,ut]),Le=M.useMemo(()=>De.length>0?ut.size>0&&De.length===ut.size?null:new Set(De):lt?new Set([lt]):null,[De,lt,ut]),Ne=M.useMemo(()=>{const Ke=new Set;for(const je of n??[])Ke.add(je.server);return Ke},[n]),$e=M.useMemo(()=>Ne.size===0?me:me.filter(Ke=>Ne.has(Ke)),[me,Ne]),ft=M.useCallback(Ke=>{ke(je=>{const et=je.filter(Pt=>!Ne.has(Pt)),pt=je.filter(Pt=>Ne.has(Pt)),wt=pt.includes(Ke)?pt.filter(Pt=>Pt!==Ke):[...pt,Ke],yt=Ne.size>0&&wt.length===Ne.size?[]:wt;return[...et,...yt]})},[Ne]),nt=M.useMemo(()=>xe===null?null:Ne.size===0||Ne.has(xe)?xe:null,[xe,Ne]),We=M.useMemo(()=>$e.length>0?Ne.size>0&&$e.length===Ne.size?null:new Set($e):nt!==null?new Set([nt]):null,[$e,nt,Ne]);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(Fi,{open:H,onOpenChange:B,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!H&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),H&&Ce&&f.jsxs(em,{type:"single",variant:"selecting",size:"sm",value:te,onValueChange:Ke=>{Ke&&se(Ke)},children:[f.jsx(Wa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),f.jsx(Wa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),f.jsx(Bi,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:te==="combined"||!Ce?f.jsxs(f.Fragment,{children:[Ce?f.jsx(nNe,{trainerLabels:ve,inferenceLabels:qe,activeSeriesKeys:Le,onSeriesHover:re,onSeriesToggle:Ve}):f.jsx(Sk,{series:Se,activeSeriesKeys:Le,onSeriesHover:re,onSeriesToggle:Ve}),f.jsx(wk,{data:t,metricNames:Te,intervalStart:we.start,intervalEnd:we.end,gpuIndices:Q,seriesMode:fe?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:Ce?Ee:void 0,activeSeriesKeys:Le,xOffset:F})]}):f.jsxs(f.Fragment,{children:[Ye&&f.jsx(EF,{title:"Trainer",gpuData:Fe,gpuMetricNames:Te,timeRange:we,nodeGpuMap:Oe,isLoading:l,isRefetching:c,open:C,onOpenChange:A,nodeMode:P,onNodeModeChange:O,xOffset:F}),Ze&&f.jsxs(f.Fragment,{children:[Ye&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsx(EF,{title:"Inference",gpuData:Ue,gpuMetricNames:Te,timeRange:we,nodeGpuMap:ue,isLoading:l,isRefetching:c,open:N,onOpenChange:D,nodeMode:R,onNodeModeChange:L,xOffset:F})]}),!l&&Fe.length===0&&Ue.length===0&&f.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No GPU data matches the trainer/inference role configuration"})]})})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:G,onOpenChange:j,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!G&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),f.jsx(Bi,{children:f.jsx("div",{className:"mt-3 mb-4",children:f.jsx(iNe,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:V,xOffset:F})})})]}),n&&n.length>0||s&&s.length>0||l?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Fi,{open:ie,onOpenChange:ce,children:[f.jsx(Ui,{asChild:!0,children:f.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ir,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!ie&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),f.jsx(Bi,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[f.jsx(oNe,{data:n??[],activeServerIds:We,onServerHover:Pe,onServerToggle:ft}),f.jsx(aNe,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:We,overrideTimeRange:V,xOffset:F})]})})]})]}):null]})}function uNe(t){if(!t||typeof t!="string")return null;const e=t.split(`
`);if(e.length===0)return null;const n=e[0].match(/^(\w[\w.]*)(\(.*)?$/);if(!n)return null;const r={name:"",type:n[1],args:"",children:[],depth:0,repeatCount:1,estimatedParams:0};if(e.length===1){const s=e[0].match(/^\w[\w.]*\((.+)\)\s*$/);return r.args=s?s[1]:"",r.estimatedParams=aN(r.type,r.args),r}const i=[r];for(let s=1;s<e.length;s++){const a=e[s].trimStart();if(!a||a===")"){a===")"&&i.length>1&&i.pop();continue}const l=a.match(/^\(([^)]*)\):\s*(\d+)\s*x\s+(\w[\w.]*)\((.*)$/);if(l){const b=l[1],_=parseInt(l[2],10),S=l[3];let w=l[4];const C=i[i.length-1];if(w.endsWith(")")){w=w.slice(0,-1);const A={name:b,type:S,args:w,children:[],depth:i.length,repeatCount:_,estimatedParams:0};A.estimatedParams=aN(S,w),C.children.push(A)}else{const A={name:b,type:S,args:"",children:[],depth:i.length,repeatCount:_,estimatedParams:0};C.children.push(A),i.push(A)}continue}const c=a.match(/^\(([^)]*)\):\s*(\w[\w.]*)\((.*)$/);if(!c)continue;const d=c[1],p=c[2];let m=c[3];const x=i[i.length-1];if(m.endsWith(")")){m=m.slice(0,-1);const b={name:d,type:p,args:m,children:[],depth:i.length,repeatCount:1,estimatedParams:0};b.estimatedParams=aN(p,m),x.children.push(b)}else{const b={name:d,type:p,args:"",children:[],depth:i.length,repeatCount:1,estimatedParams:0};x.children.push(b),i.push(b)}}return wZ(r),TZ(r),r}function AF(t){return/^\d+(-\d+)?$/.test(t)}function wZ(t){for(const r of t.children)wZ(r);if(t.children.length<2)return;const e=[];let n=0;for(;n<t.children.length;){const r=t.children[n];let i=1;for(;n+i<t.children.length&&AF(r.name)&&AF(t.children[n+i].name)&&MZ(r,t.children[n+i]);)i++;if(i>1){const s={...r,repeatCount:i};e.push(s)}else e.push(r);n+=i}t.children=e}function MZ(t,e){if(t.type!==e.type||t.args!==e.args||t.children.length!==e.children.length)return!1;for(let n=0;n<t.children.length;n++)if(!MZ(t.children[n],e.children[n]))return!1;return!0}function TZ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=TZ(n);return t.estimatedParams=e,e*(t.repeatCount||1)}function aN(t,e){var s;if(!e)return 0;const n=((s=e.match(/\d+/g))==null?void 0:s.map(Number))??[],r=!e.includes("bias=False"),i=t.toLowerCase();if(i==="linear"&&n.length>=2){const o=n[0]*n[1];return r?o+n[1]:o}if(i==="embedding"&&n.length>=2)return n[0]*n[1];if((i.includes("norm")||i.includes("layernorm")||i.includes("rmsnorm"))&&n.length>=1){const o=n[0];return i.includes("rmsnorm")?o:r?o*2:o}if(i.startsWith("conv")&&n.length>=3){const[o,a,l]=n,c=o*a*l*(n[3]??l);return r?c+a:c}return 0}function dNe(t){const e={modelName:t.type,totalParams:0,numLayers:0,hiddenSize:null,vocabSize:null,intermediateSize:null,numAttentionHeads:null,numKvHeads:null,layerTypeCounts:{},paramsByCategory:{embedding:0,attention:0,feedforward:0,normalization:0,output:0,positional:0,activation:0,other:0}};return CZ(t,e,1),e}function CZ(t,e,n){var i,s;const r=(t.repeatCount||1)*n;if(t.children.length===0&&t.type){const o=t.type;e.layerTypeCounts[o]=(e.layerTypeCounts[o]||0)+r,e.totalParams+=t.estimatedParams*r;const a=fNe(t);e.paramsByCategory[a]+=t.estimatedParams*r;const l=((i=t.args.match(/\d+/g))==null?void 0:i.map(Number))??[],c=t.type.toLowerCase();if(c==="embedding"&&l.length>=2&&((!e.vocabSize||l[0]>e.vocabSize)&&(e.vocabSize=l[0]),e.hiddenSize||(e.hiddenSize=l[1])),c==="linear"&&l.length>=2){const d=Math.max(l[0],l[1]);e.hiddenSize&&d>e.hiddenSize&&(!e.intermediateSize||d>e.intermediateSize)&&(e.intermediateSize=d)}}else if(t.children.length>0){t.repeatCount>1&&t.depth>0&&(e.numLayers=Math.max(e.numLayers,t.repeatCount));for(const o of t.children)CZ(o,e,r)}if(t.children.length>0){const o=t.name.toLowerCase();if(o.includes("attn")||o.includes("attention")){for(const a of t.children)if(a.type.toLowerCase()==="linear"){const l=((s=a.args.match(/\d+/g))==null?void 0:s.map(Number))??[];if(l.length>=2){const c=a.name.toLowerCase();c.includes("q_proj")&&!e.numAttentionHeads&&e.hiddenSize,c.includes("k_proj")&&!e.numKvHeads&&e.hiddenSize&&l[1]<(e.hiddenSize??1/0)}}}}}function fNe(t){const e=t.type.toLowerCase(),n=t.name.toLowerCase();return e==="embedding"||n.includes("embed")?"embedding":e.includes("attention")||n.includes("attn")||n.includes("attention")||n.includes("q_proj")||n.includes("k_proj")||n.includes("v_proj")||n.includes("o_proj")?"attention":n.includes("mlp")||n.includes("feed_forward")||n.includes("ffn")||n.includes("gate_proj")||n.includes("up_proj")||n.includes("down_proj")||n.includes("fc1")||n.includes("fc2")?"feedforward":e.includes("norm")||n.includes("norm")?"normalization":n.includes("lm_head")||n.includes("output")||n.includes("head")?"output":e.includes("rotary")||e.includes("rope")||n.includes("rotary")||n.includes("rope")||n.includes("pos")?"positional":e.includes("relu")||e.includes("gelu")||e.includes("silu")||e.includes("swish")||e.includes("activation")||e==="silu"||e==="gelu"||e==="relu"?"activation":"other"}function gy(t){return t>=1e12?`${(t/1e12).toFixed(1)}T`:t>=1e9?`${(t/1e9).toFixed(1)}B`:t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(0)}K`:t>0?`${t}`:"0"}function EZ(t,e){if(!e)return"";let n=e;return n=n.replace(/in_features=/g,""),n=n.replace(/out_features=/g,""),n=n.replace(/num_embeddings=/g,""),n=n.replace(/embedding_dim=/g,""),n=n.replace(/,\s*bias=False/g,""),n=n.replace(/bias=False,?\s*/g,""),n=n.replace(/\((\d+),?\)/g,"$1"),t.toLowerCase().includes("norm")&&(n=n.replace(/,?\s*eps=[\d.eE+-]+/g,"")),n=n.replace(/,\s*$/,"").replace(/^\s*,\s*/,"").trim(),n}const NF={embedding:{border:"border-l-violet-500",bg:"bg-violet-500/10",text:"text-violet-600 dark:text-violet-400",bar:"bg-violet-500"},attention:{border:"border-l-blue-500",bg:"bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",bar:"bg-blue-500"},feedforward:{border:"border-l-amber-500",bg:"bg-amber-500/10",text:"text-amber-600 dark:text-amber-400",bar:"bg-amber-500"},normalization:{border:"border-l-emerald-500",bg:"bg-emerald-500/10",text:"text-emerald-600 dark:text-emerald-400",bar:"bg-emerald-500"},output:{border:"border-l-rose-500",bg:"bg-rose-500/10",text:"text-rose-600 dark:text-rose-400",bar:"bg-rose-500"},positional:{border:"border-l-cyan-500",bg:"bg-cyan-500/10",text:"text-cyan-600 dark:text-cyan-400",bar:"bg-cyan-500"},activation:{border:"border-l-orange-500",bg:"bg-orange-500/10",text:"text-orange-600 dark:text-orange-400",bar:"bg-orange-500"},other:{border:"border-l-gray-500",bg:"bg-gray-500/10",text:"text-gray-600 dark:text-gray-400",bar:"bg-gray-500"}},RF={self_attn:"Self Attention",q_proj:"Q Proj",k_proj:"K Proj",v_proj:"V Proj",o_proj:"O Proj",gate_proj:"Gate Proj",up_proj:"Up Proj",down_proj:"Down Proj",act_fn:"Activation",input_layernorm:"Input LayerNorm",post_attention_layernorm:"Post-Attention LayerNorm",embed_tokens:"Embed Tokens",rotary_emb:"Rotary Embedding",lm_head:"LM Head",mlp:"MLP",norm:"Norm",model:"Model",layers:"Layers"};function YC(t){return t?RF[t]?RF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function hNe(t){const e=[];function n(i){return i.name===""||i.name==="model"&&i.children.length>0||(i.type==="ModuleList"||i.type==="Sequential")&&i.children.length>0}function r(i){if(n(i))for(const s of i.children)r(s);else e.push(i)}return r(t),e}function $5(){return f.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function pNe({node:t}){const e=YC(t.name)||t.type,n=EZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?gy(t.estimatedParams):null;return f.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[f.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),r&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-all",children:r}),i&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:i})]})}function mNe({node:t}){const e=YC(t.name)||t.type,n=EZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?gy(t.estimatedParams):null;return f.jsxs("div",{className:"rounded-md border bg-background px-2.5 py-2 flex-1 min-w-0 text-center",children:[f.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),r&&f.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5 break-all",children:r}),i&&f.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:i})]})}function gNe({node:t}){const e=YC(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?gy(t.estimatedParams):null;return f.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[f.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),f.jsx("div",{className:"flex gap-1.5 flex-wrap mt-2",children:t.children.map((i,s)=>f.jsx(mNe,{node:i},s))})]})}function J9({node:t}){return t.children.length===0?f.jsx(pNe,{node:t}):t.repeatCount>1?f.jsx(xNe,{node:t}):t.children.every(n=>n.children.length===0)?f.jsx(gNe,{node:t}):f.jsx(vNe,{node:t})}function xNe({node:t}){return f.jsxs("div",{className:"relative w-full",children:[f.jsx("div",{className:"rounded-lg border-2 border-dashed border-muted-foreground/25 p-3 w-full",children:f.jsx("div",{className:"flex flex-col items-center w-full",children:t.children.map((e,n)=>f.jsxs("div",{className:"flex flex-col items-center w-full",children:[n>0&&f.jsx($5,{}),f.jsx(J9,{node:e})]},n))})}),f.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 pl-5 pointer-events-none select-none",children:f.jsxs("span",{className:"text-4xl font-extralight text-muted-foreground/50 whitespace-nowrap leading-tight",children:["×",t.repeatCount,f.jsx("br",{}),f.jsx("span",{className:"text-2xl",children:"layers"})]})})]})}function vNe({node:t}){const e=YC(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?gy(t.estimatedParams):null;return f.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full",children:[f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&f.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),f.jsx("div",{className:"flex flex-col items-center w-full mt-2",children:t.children.map((i,s)=>f.jsxs("div",{className:"flex flex-col items-center w-full",children:[s>0&&f.jsx($5,{}),f.jsx(J9,{node:i})]},s))})]})}function yNe({root:t}){const e=M.useMemo(()=>hNe(t),[t]);return f.jsxs("div",{className:"flex flex-col items-center py-8 px-6 max-w-2xl mx-auto",children:[f.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Input"}),e.map((n,r)=>f.jsxs("div",{className:"flex flex-col items-center w-full",children:[f.jsx($5,{}),f.jsx(J9,{node:n})]},r)),f.jsx($5,{}),f.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function bNe({stats:t,rawRepr:e}){const[n,r]=M.useState(!1),i=t.totalParams,s=M.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,a])=>a>0).sort((a,l)=>l[1]-a[1]),[t.paramsByCategory]),o=M.useMemo(()=>Object.entries(t.layerTypeCounts).sort((a,l)=>l[1]-a[1]),[t.layerTypeCounts]);return f.jsxs("div",{className:"w-72 shrink-0 border-l overflow-y-auto p-4 space-y-5",children:[f.jsxs("div",{children:[f.jsx("h2",{className:"text-base font-semibold",children:t.modelName}),i>0&&f.jsxs("p",{className:"text-sm text-muted-foreground",children:["~",gy(i)," parameters"]})]}),(t.numLayers>0||t.hiddenSize||t.vocabSize)&&f.jsxs("div",{children:[f.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Architecture"}),f.jsxs("div",{className:"space-y-1 text-sm",children:[t.numLayers>0&&f.jsx(DM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&f.jsx(DM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&f.jsx(DM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&f.jsx(DM,{label:"Intermediate",value:t.intermediateSize.toLocaleString()})]})]}),i>0&&s.length>0&&f.jsxs("div",{children:[f.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Parameters"}),f.jsx("div",{className:"flex h-2 rounded-full overflow-hidden mb-2.5",children:s.map(([a,l])=>f.jsx("div",{className:`${NF[a].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},a))}),f.jsx("div",{className:"space-y-0.5",children:s.map(([a,l])=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("div",{className:`w-2 h-2 rounded-sm shrink-0 ${NF[a].bar}`}),f.jsx("span",{className:"capitalize text-muted-foreground",children:a}),f.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[gy(l)," (",(l/i*100).toFixed(0),"%)"]})]},a))})]}),o.length>0&&f.jsxs("div",{children:[f.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Layer Types"}),f.jsx("div",{className:"space-y-0.5",children:o.map(([a,l])=>f.jsxs("div",{className:"flex items-center text-xs",children:[f.jsx("span",{className:"text-foreground",children:a}),f.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},a))})]}),f.jsxs(Fi,{open:n,onOpenChange:r,children:[f.jsxs(Ui,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[n?f.jsx(Ir,{className:"size-3"}):f.jsx(Zg,{className:"size-3"}),"Raw repr"]}),f.jsx(Bi,{children:f.jsx("pre",{className:"mt-2 text-[10px] leading-tight bg-muted/50 rounded-md p-2 overflow-x-auto max-h-96 overflow-y-auto whitespace-pre font-sans",children:e})})]})]})}function DM({label:t,value:e}){return f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-muted-foreground",children:t}),f.jsx("span",{className:"font-medium tabular-nums",children:e})]})}function _Ne({modelRepr:t}){const e=M.useMemo(()=>uNe(t),[t]),n=M.useMemo(()=>e?dNe(e):null,[e]);return!e||!n?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx(oue,{className:"size-8 text-muted-foreground mx-auto mb-2"}),f.jsx("div",{className:"text-sm text-muted-foreground",children:"Could not parse model architecture"})]})}):f.jsxs("div",{className:"flex h-full",children:[f.jsx("div",{className:"flex-1 overflow-auto",children:f.jsx(yNe,{root:e})}),f.jsx(bNe,{stats:n,rawRepr:t})]})}function AZ(t){return q9(t==null?void 0:t.setup)}function SNe(t){const e=AZ(t),n=[],r=vi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Nr(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Nr(d.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}function wNe(t){const e=AZ(t),n=[],r=vi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Nr(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Nr(d.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}const MNe=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],TNe=[1,5,10,30,60,120,300],lN=rh;function CNe(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function PM(t){if(t<1)return`${t}s`;if(t<60)return`${Math.round(t)}s`;const e=Math.floor(t/60),n=Math.round(t%60);return n===0?`${e}m`:`${e}m ${n}s`}function ENe(t){const e=t.trim().toLowerCase();if(!e)return null;const n=e.match(/^(\d+(?:\.\d+)?)\s*ms$/i);if(n){const o=parseFloat(n[1]);return o>0?o/1e3:null}const r=/^(?:(\d+)\s*m)?\s*(?:(\d+(?:\.\d+)?)\s*s)?$/i,i=e.match(r);if(i&&(i[1]||i[2])){const o=parseInt(i[1]||"0",10),a=parseFloat(i[2]||"0"),l=o*60+a;return l>0?l:null}const s=parseFloat(e);return Number.isFinite(s)&&s>0?s:null}function ANe(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.gpu_index}|${i.node_id??""}`;let o=n.get(s);o||(o={key:{metric_name:i.metric_name,gpu_index:i.gpu_index,node_id:i.node_id,source:i.source,rank:i.rank,local_rank:i.local_rank},entries:[]},n.set(s,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function NNe(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.node_id??""}`;let o=n.get(s);o||(o={key:{metric_name:i.metric_name,node_id:i.node_id,source:i.source},entries:[]},n.set(s,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function RNe(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.server}`;let o=n.get(s);o||(o={key:{metric_name:i.metric_name,server:i.server,node_id:i.node_id,tp_group_id:i.tp_group_id,tp_size:i.tp_size},entries:[]},n.set(s,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function kNe({value:t,onChange:e}){const[n,r]=M.useState(!1),[i,s]=M.useState(""),o=M.useRef(null),a=c=>{c&&(s(lN(t)),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=CNe(i);c!==null&&(e(c),r(!1))};return f.jsxs(AT,{open:n,onOpenChange:a,children:[f.jsx(NT,{asChild:!0,children:f.jsxs("button",{className:"inline-flex items-center gap-1 rounded-lg border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors select-none whitespace-nowrap",children:[lN(t),f.jsx(Ir,{className:"size-3 text-muted-foreground"})]})}),f.jsxs(RT,{align:"start",className:"w-40 p-1.5 gap-1",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("input",{ref:o,type:"text",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()},className:"h-7 w-full rounded-md border border-input bg-transparent px-2 text-xs outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[2px]",placeholder:"e.g. 30s, 2m, 1h"}),f.jsx("button",{onClick:l,className:"shrink-0 h-7 px-2 rounded-md text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:"Go"})]}),f.jsx("div",{className:"flex flex-col",children:TNe.map(c=>f.jsx("button",{onClick:()=>{e(c),r(!1)},className:`text-left rounded-md px-2 py-1 text-xs transition-colors ${c===t?"bg-accent text-accent-foreground font-medium":"hover:bg-accent hover:text-accent-foreground"}`,children:lN(c)},c))})]})]})}function DNe(){var Pt;const[t,e]=M.useState(null),n=M.useRef(0),r=Jn(xl),i=!0,[s,o]=dn(ace),[a,l]=dn(lce),[c,d]=dn(cce),[p,m]=dn(uce),[x,b]=dn(dce),[_,S]=dn(fce),[w,C]=dn(hce),[A,N]=dn(pce),[D,P]=dn(mce),[O,R]=dn(gce),[L,V]=dn(_ce),[F,U]=dn(xce),[W,Y]=dn(vce),[$,X]=dn(yce),[Z,K]=dn(bce),[ne,H]=M.useState(PM(_));M.useEffect(()=>{t&&(t.scrollTop=w,n.current=w)},[t]),M.useEffect(()=>{if(!t)return;const zt=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",zt,{passive:!0}),()=>{t.removeEventListener("scroll",zt),C(n.current)}},[t]);const{data:B,error:G}=cd(r||"",!!r,i),j=M.useMemo(()=>pZ(B==null?void 0:B.summary),[B==null?void 0:B.summary]),{data:ie,isFetching:ce,isPlaceholderData:te}=Yue(r||"",a,c,p,!!r),se=!!r&&ie!==void 0,{data:le,isFetching:re,isPlaceholderData:pe}=Kue(r||"",a,c,(ie==null?void 0:ie.global_min_time)??null,p,MNe,se),be=!!r&&ie!==void 0,{data:xe,isFetching:Pe,isPlaceholderData:me}=Zue(r||"",a,c,(ie==null?void 0:ie.global_min_time)??null,p,null,be),ke=(ie==null?void 0:ie.total_pages)??(le==null?void 0:le.total_pages)??null,we=ie,Te=le,oe=xe,[_e,Fe]=M.useState([]),[Ue,Oe]=M.useState([]),[ue,Q]=M.useState([]);M.useEffect(()=>{we!=null&&we.available_metrics&&we.available_metrics.length>0&&Fe(we.available_metrics)},[we==null?void 0:we.available_metrics]),M.useEffect(()=>{Te!=null&&Te.available_metrics&&Te.available_metrics.length>0&&Oe(Te.available_metrics)},[Te==null?void 0:Te.available_metrics]),M.useEffect(()=>{oe!=null&&oe.available_metrics&&oe.available_metrics.length>0&&Q(oe.available_metrics)},[oe==null?void 0:oe.available_metrics]);const[fe,Se]=M.useState(1),[Ae,ve]=M.useState(null),[qe,Ee]=M.useState(null),[Ce,Ye]=M.useState(null);M.useEffect(()=>{ke!==null&&ke>0&&Se(ke)},[ke]),M.useEffect(()=>{const zt=(we==null?void 0:we.global_min_time)??(Te==null?void 0:Te.global_min_time)??null;zt!==null&&ve(zt)},[we==null?void 0:we.global_min_time,Te==null?void 0:Te.global_min_time]),M.useEffect(()=>{const zt=(we==null?void 0:we.interval_start)??(Te==null?void 0:Te.interval_start)??null,Dt=(we==null?void 0:we.interval_end)??(Te==null?void 0:Te.interval_end)??null;zt!==null&&Dt!==null&&Ee({start:zt,end:Dt})},[we==null?void 0:we.interval_start,we==null?void 0:we.interval_end,Te==null?void 0:Te.interval_start,Te==null?void 0:Te.interval_end]),M.useEffect(()=>{Se(1),ve(null),Ee(null),Ye(null)},[r]);const Ze=ke??fe,it=(we==null?void 0:we.interval_start)??(Te==null?void 0:Te.interval_start)??null,ut=(we==null?void 0:we.interval_end)??(Te==null?void 0:Te.interval_end)??null,De=(we==null?void 0:we.global_min_time)??(Te==null?void 0:Te.global_min_time)??Ae;M.useEffect(()=>{if(p&&ke!==null&&ke>0){const zt=ke-1;a!==zt&&l(zt)}},[p,ke,a,l]);const Ve=zt=>{m(!1),l(zt)},lt=zt=>{if(!p){const Dt=Math.floor(a*c/zt);l(Dt)}d(zt)},Le=()=>{p?m(!1):(m(!0),ke!==null&&ke>0&&l(ke-1))};M.useEffect(()=>{H(PM(_))},[_]);const Ne=M.useMemo(()=>{const zt=(we==null?void 0:we.metrics)??[];return!x||_<=0?zt:ANe(zt,_)},[we==null?void 0:we.metrics,x,_]),$e=M.useMemo(()=>{const zt=(Te==null?void 0:Te.metrics)??[];return!x||_<=0?zt:NNe(zt,_)},[Te==null?void 0:Te.metrics,x,_]),ft=M.useMemo(()=>{const zt=(oe==null?void 0:oe.metrics)??[];return!x||_<=0?zt:RNe(zt,_)},[oe==null?void 0:oe.metrics,x,_]),nt=M.useMemo(()=>{if(p){const Qe=[],ht=[];if((we==null?void 0:we.interval_start)!=null&&ht.push(we.interval_start),(we==null?void 0:we.interval_end)!=null&&Qe.push(we.interval_end),(Te==null?void 0:Te.interval_start)!=null&&ht.push(Te.interval_start),(Te==null?void 0:Te.interval_end)!=null&&Qe.push(Te.interval_end),(oe==null?void 0:oe.interval_start)!=null&&ht.push(oe.interval_start),(oe==null?void 0:oe.interval_end)!=null&&Qe.push(oe.interval_end),Qe.length===0)return null;const It=Math.min(...Qe),Tt=Math.max(De??It,It-c),ct=ht.length>0?Math.max(...ht):Tt;return{start:Math.min(It,Math.max(Tt,ct)),end:It}}const zt=(qe==null?void 0:qe.start)??null,Dt=(qe==null?void 0:qe.end)??null,Et=it??zt,Be=ut??Dt;return Et===null||Be===null?null:{start:Et,end:Be}},[p,we==null?void 0:we.interval_end,we==null?void 0:we.interval_start,Te==null?void 0:Te.interval_end,Te==null?void 0:Te.interval_start,oe==null?void 0:oe.interval_end,oe==null?void 0:oe.interval_start,De,c,it,ut,qe==null?void 0:qe.start,qe==null?void 0:qe.end]);M.useEffect(()=>{nt&&Ye(nt)},[nt]);const We=nt??Ce,Ke=M.useMemo(()=>!We||De===null?0:We.start-De,[We,De]),je=ce&&te||re&&pe||Pe&&me,et=ce&&!we||se&&re&&!Te||be&&Pe&&!oe,pt=!je&&!et&&(ce&&!!we||re&&!!Te||Pe&&!!oe),Lt=je||et,wt=M.useMemo(()=>SNe(B==null?void 0:B.summary),[B==null?void 0:B.summary]),yt=M.useMemo(()=>wNe(B==null?void 0:B.summary),[B==null?void 0:B.summary]);return r?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center gap-2 h-7",children:[f.jsxs(em,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:zt=>{zt&&o(zt)},children:[f.jsx(Wa,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),f.jsx(Wa,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),f.jsx(Wa,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&f.jsxs(f.Fragment,{children:[f.jsx(q8,{currentPage:a,totalPages:Ze,onPageChange:Ve}),f.jsx(kNe,{value:c,onChange:lt}),We&&f.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[J0(We.start,We.end-We.start)," ","–"," ",J0(We.end,We.end-We.start)]}),f.jsx("button",{onClick:Le,className:`ml-1 inline-flex items-center rounded-lg px-2.5 h-7 text-xs font-medium transition-all select-none whitespace-nowrap ${p?"bg-emerald-500 text-white hover:bg-emerald-600":"bg-accent text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:"Live"}),f.jsx(mS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:x,onEnabledChange:b,value:ne,onValueChange:H,onValueCommit:zt=>{const Dt=ENe(zt);Dt!==null?(S(Dt),H(PM(Dt))):H(PM(_))},inputWidth:"w-10"})]})]})})}),s==="metrics"&&f.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:f.jsxs("div",{className:"max-w-7xl mx-auto",children:[G&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",G instanceof Error?G.message:"Unknown error"]})})}),f.jsx(cNe,{gpuMetrics:Ne,cpuMetrics:$e,vllmMetrics:ft,availableGpuMetrics:(we==null?void 0:we.available_metrics)??_e,availableCpuMetrics:(Te==null?void 0:Te.available_metrics)??Ue,availableVllmMetrics:(oe==null?void 0:oe.available_metrics)??ue,trainerGpus:wt,inferenceGpus:yt,isLoading:Lt,isRefetching:pt,roleMode:A,onRoleModeChange:N,systemMetricsOpen:D,onSystemMetricsOpenChange:P,cpuMetricsOpen:O,onCpuMetricsOpenChange:R,vllmMetricsOpen:L,onVllmMetricsOpenChange:V,trainerSectionOpen:F,onTrainerSectionOpenChange:U,inferenceSectionOpen:W,onInferenceSectionOpenChange:Y,trainerNodeMode:$,onTrainerNodeModeChange:X,inferenceNodeMode:Z,onInferenceNodeModeChange:K,overrideTimeRange:We,xOffset:Ke})]})}),s==="topology"&&f.jsx("div",{className:"flex-1 overflow-hidden",children:G?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),f.jsx("div",{className:"text-xs text-muted-foreground",children:G instanceof Error?G.message:"Unknown error"})]})}):B?!j||j.nodes.length===0?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),f.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):f.jsx("div",{className:"h-full w-full",children:f.jsx(gZ,{topology:j})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})})}),s==="model"&&f.jsx("div",{className:"flex-1 overflow-hidden",children:G?f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load model data"}),f.jsx("div",{className:"text-xs text-muted-foreground",children:G instanceof Error?G.message:"Unknown error"})]})}):B?(Pt=B.summary)!=null&&Pt.model_architecture?f.jsx("div",{className:"h-full w-full",children:f.jsx(_Ne,{modelRepr:B.summary.model_architecture})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No model architecture available"}),f.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have model_architecture in its W&B summary."})]})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading model architecture…"})})})]}):f.jsx(bm,{description:"Select a run from the sidebar to view infrastructure metrics."})}const NZ=1e4;function x_(t,e){return t*NZ+e}function PNe(){var ve,qe;const t=Jn(xl),[e]=kk(),[n,r]=dn(tI),[i,s]=dn(sce),[o,a]=dn(nI),[l,c]=dn(rI),d=Jn(iI),[p]=dn(QE),[,m]=dn(sI),x=Jn(JE),[b,_]=dn(wT),[S,w]=dn(MT),C=b.length+(S?1:0),A=Ee=>{_(Ce=>Ce.includes(Ee)?Ce.filter(Ye=>Ye!==Ee):[...Ce,Ee])},[N,D]=M.useState(0),[P,O]=M.useState(0),[R,L]=M.useState(!0),V=!0,F=M.useMemo(()=>{const Ee=e.get("step");if(!Ee)return null;const Ce=Number(Ee);return Number.isFinite(Ce)?Ce:null},[e]),U=M.useRef(null);M.useEffect(()=>{if(!t){U.current=null;return}if(F==null){U.current=null;return}F!==U.current&&(r(F),U.current=F)},[F,t,r]);const{data:W,isLoading:Y,error:$}=Vue(t||"",n,i,!!t),{data:X}=cd(t||"",!!t,V),Z=((ve=X==null?void 0:X.summary)==null?void 0:ve.eval_env_details)??((qe=X==null?void 0:X.config)==null?void 0:qe.eval_env_details),K=M.useMemo(()=>_w(Z),[Z]),ne=M.useMemo(()=>{const Ee=yp(Z),Ce=Sw(X==null?void 0:X.data_metric_ranges);return bp(Ee,Ce)},[Z,X==null?void 0:X.data_metric_ranges]),[H,B]=M.useState([]),G=W==null?void 0:W.available_rollout_metric_names,j=G&&G.length>0?G:H;G&&G.length>0&&G!==H&&B(G);const ie=M.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:j,selectedSampleIdx:o}},[i,j,o]);M.useEffect(()=>{if(!W)return;const Ee=W.available_eval_names;Ee.length&&(i&&Ee.includes(i)||s(Ee[0]))},[W==null?void 0:W.available_eval_names,i,s,W]);const ce=M.useMemo(()=>{var Ee;return(Ee=W==null?void 0:W.available_steps)!=null&&Ee.length&&n===null?W.available_steps[W.available_steps.length-1]:null},[W==null?void 0:W.available_steps,n]);M.useEffect(()=>{ce!==null&&n===null&&F==null&&r(ce)},[ce,F,n,r]);const te=Ee=>{r(Ee)},[se,le]=M.useState([]),[re,pe]=M.useState(null);t!==re&&(le([]),pe(t));const be=W==null?void 0:W.available_steps,xe=M.useMemo(()=>{const Ee=be??[];return[...new Set([...se,...Ee])].sort((Ye,Ze)=>Ye-Ze)},[be,se]);xe.length>se.length&&le(xe);const Pe=xe.length>0,me=Pe?xe[xe.length-1]:0,ke=M.useMemo(()=>{if(n==null)return xe.length-1;const Ee=xe.indexOf(n);return Ee>=0?Ee:xe.length-1},[xe,n]),we=Ee=>{Ee>=0&&Ee<xe.length&&te(xe[Ee])},Te=M.useMemo(()=>{if(W!=null&&W.prompts)return W.prompts.map(Ee=>({step:Ee.step,group_id:Ee.sample_idx,env:Ee.env,system_prompt:Ee.system_prompt,tokens_system_prompt:Ee.tokens_system_prompt,prompt:Ee.prompt,tokens_prompt:Ee.tokens_prompt}))},[W]),oe=M.useMemo(()=>{if(W!=null&&W.rollouts)return W.rollouts.map(Ee=>({step:Ee.step,group_id:Ee.sample_idx,sample_idx:x_(Ee.sample_idx,Ee.completion_idx),turn_order:Ee.turn_order,turn_type:Ee.turn_type,content:Ee.content,tokens:Ee.tokens}))},[W]),_e=M.useMemo(()=>{if(W!=null&&W.samples_data)return W.samples_data.map(Ee=>({step:Ee.step,group_id:Ee.sample_idx,sample_idx:x_(Ee.sample_idx,Ee.completion_idx),reward:null,advantage:null,turns:Ee.turns,total_tokens:null,raw_string:null}))},[W]),Fe=M.useMemo(()=>{if(W!=null&&W.rollout_metrics)return W.rollout_metrics.map(Ee=>({step:Ee.step,sample_idx:x_(Ee.sample_idx,Ee.completion_idx),env:Ee.env,metric_name:Ee.metric_name,value:Ee.value}))},[W]),Ue=M.useMemo(()=>{if(W!=null&&W.golden_answers)return W.golden_answers.map(Ee=>({step:Ee.step,sample_idx:x_(Ee.sample_idx,Ee.completion_idx),env:Ee.env,key:Ee.key,value:Ee.value}))},[W]),Oe=M.useMemo(()=>{if(W!=null&&W.info_turns)return W.info_turns.map(Ee=>({step:Ee.step,sample_idx:x_(Ee.sample_idx,Ee.completion_idx),turn_order:Ee.turn_order,env:Ee.env,info_key:Ee.info_key,info_value:Ee.info_value,info_type:Ee.info_type}))},[W]),ue=M.useMemo(()=>{if(!(W!=null&&W.samples_data))return new Map;const Ee=new Map;for(const Ce of W.samples_data)Ee.set(Ce.sample_idx,(Ee.get(Ce.sample_idx)??0)+1);return Ee},[W]),Q=M.useCallback((Ee,Ce)=>{const Ye=ue.get(Ee)??Ce.samples.length;if(a(Ee),Ye<=1){const Ze=Ce.samples[0];Ze&&c(Ze.sample_idx)}else m("samples")},[ue,a,c,m]),fe=M.useCallback(()=>{m("groups")},[m]),Se=M.useCallback(({viewMode:Ee})=>f.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[Ee==="samples"&&f.jsx(Mn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:fe,children:f.jsx(w7,{className:"h-4 w-4"})}),f.jsxs(o8,{value:i??"",onValueChange:Ce=>{s(Ce),a(null),c(null),m("groups")},children:[f.jsx(l8,{className:"h-7 text-xs min-w-0 flex-1",children:f.jsx(a8,{placeholder:"Select eval..."})}),f.jsx(c8,{children:((W==null?void 0:W.available_eval_names)??[]).map(Ce=>f.jsx(u8,{value:Ce,className:"text-xs",children:Ce},Ce))})]})]}),[i,W==null?void 0:W.available_eval_names,s,a,c,m,fe]),Ae=M.useMemo(()=>{var ut;if(!d)return null;const Ee=((ut=d.sample.turns[0])==null?void 0:ut.step)??n,Ce=d.sample.group_id,Ze=d.sample.sample_idx%NZ,it=ue.get(Ce)??1;return{step:Ee,evalSampleIdx:Ce,completionIdx:Ze,numCompletions:it}},[d,n,ue]);return t?f.jsxs("div",{className:"flex h-full overflow-hidden",children:[f.jsx(Q9,{prompts:Te,data:oe,samplesData:_e,rolloutMetrics:Fe,availableMetricNames:j,isLoading:Y,step:n??void 0,currentStepIndex:ke,totalSteps:xe.length,onStepChange:we,hasSteps:Pe,stepValues:xe,openAtom:QE,selectedGroupIdAtom:nI,selectedSampleIdxAtom:rI,viewModeAtom:sI,renderLeftControls:Se,onGroupClick:Q,hideRewardAdvantage:!0,envDetailsOverride:Z}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[f.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:f.jsx("div",{className:"py-2.5 px-4",children:f.jsxs("div",{className:"flex items-center justify-between h-7",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Z9,{openAtom:QE}),Ae&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step ",Ae.step]}),i&&f.jsxs(f.Fragment,{children:[" · ",f.jsx("span",{children:i})]})," · ",f.jsxs("span",{children:["Sample ",Ae.evalSampleIdx]}),Ae.numCompletions>1&&f.jsxs(f.Fragment,{children:[" · ",f.jsxs("span",{children:["Completion ",Ae.completionIdx]})]})]}),(d==null?void 0:d.sample.raw_string)&&f.jsx(sC,{rawString:d.sample.raw_string,totalTokens:d.sample.total_tokens,turns:d.sample.turns.length}),d&&f.jsxs(f.Fragment,{children:[f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{D(Ee=>Ee+1),L(!1)},children:"Collapse All"}),f.jsx(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{O(Ee=>Ee+1),L(!0)},children:"Expand All"}),f.jsxs(la,{children:[f.jsx(ca,{asChild:!0,children:f.jsxs(Mn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",C>0&&` (${C})`]})}),f.jsxs(ua,{align:"start",className:"w-auto",children:[f.jsx(ti,{checked:S,onCheckedChange:Ee=>w(!!Ee),onSelect:Ee=>Ee.preventDefault(),children:"Format Think"}),f.jsx(ti,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:Ee=>Ee.preventDefault(),children:"Markdown"}),f.jsx(ti,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:Ee=>Ee.preventDefault(),children:"LaTeX"}),f.jsx(ti,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:Ee=>Ee.preventDefault(),children:"Code"})]})]})]})]}),ie&&f.jsx(Y9,{openAtom:JE})]})})}),f.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:f.jsxs("div",{className:p||x?"max-w-5xl mx-auto":"",children:[$&&f.jsx(Ju,{className:"border-destructive mb-6",children:f.jsx(ih,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",$ instanceof Error?$.message:"Unknown error"]})})}),f.jsx(E1,{prompts:Te,data:oe,samplesData:_e,rolloutMetrics:Fe,goldenAnswers:Ue,infoTurns:Oe,isLoading:Y,step:n??void 0,filterGroupId:o,filterSampleIdx:l,lastValidSampleAtom:iI,collapseAllSignal:N,expandAllSignal:P,defaultSectionsOpen:R,envRewardRanges:K,envMetricRanges:ne,renderOptions:b,formatThinkBlocks:S})]})})]}),ie&&f.jsx(K9,{currentStep:n,maxSelectableStep:me,openAtom:JE,selectedMetricsAtom:oce,selectedStepAtom:tI,evalConfig:ie})]}):f.jsx(bm,{description:"Select a run from the sidebar to view evals."})}function INe(){const t=Jn(No);return f.jsx("div",{className:"h-full flex items-center justify-center overflow-auto pb-40",children:f.jsxs("div",{className:"max-w-2xl px-6 py-12 text-center",children:[f.jsx("div",{className:"flex items-center justify-center mb-8",children:f.jsx("img",{src:t?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-12"})}),f.jsxs("div",{className:"space-y-4 text-base text-foreground/60 leading-relaxed text-justify",children:[f.jsx("p",{children:"Telescope is a framework to post-train LLMs with reinforcement learning for reasoning and agents."}),f.jsx("p",{children:"It comes with a trainer repository to run the training process easily, with a highly configurable setup that supports both simple and complex environments, tested on clusters with hundreds of GPUs."}),f.jsx("p",{children:"This visualization tool provides critical insight into your runs: metrics, rollouts, infrastructure, inference traces, trainer GPU events, and more."}),f.jsx("p",{children:"Telescope is built with a modern stack and focused on infrastructure, observability, scalability, and reliability."}),f.jsxs("p",{children:["You can find the documentation at"," ",f.jsx("a",{href:"https://docs.telescope.training",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"docs.telescope.training"}),"."]})]}),f.jsxs("div",{className:"mt-10 flex items-center justify-center gap-6 text-xs text-muted-foreground",children:[f.jsx("a",{href:"https://github.com/eduardoslonski/telescope",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Trainer"}),f.jsx("span",{className:"text-border",children:"|"}),f.jsx("a",{href:"https://github.com/eduardoslonski/telescope-ui",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"UI Visualization"}),f.jsx("span",{className:"text-border",children:"|"}),f.jsx("a",{href:"https://eduardoslonski.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Created by Eduardo Slonski"})]})]})})}function ONe(){return f.jsxs(wce,{children:[f.jsx(wde,{}),f.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:f.jsxs(pJ,{children:[f.jsx(Ff,{path:"/",element:f.jsx($0e,{})}),f.jsx(Ff,{path:"/metrics",element:f.jsx(X0e,{})}),f.jsx(Ff,{path:"/timeline",element:f.jsx(k6e,{})}),f.jsx(Ff,{path:"/rollouts",element:f.jsx(Z6e,{})}),f.jsx(Ff,{path:"/rollouts-discarded",element:f.jsx(Q6e,{})}),f.jsx(Ff,{path:"/topology",element:f.jsx(J6e,{})}),f.jsx(Ff,{path:"/infra",element:f.jsx(DNe,{})}),f.jsx(Ff,{path:"/evals",element:f.jsx(PNe,{})}),f.jsx(Ff,{path:"/about",element:f.jsx(INe,{})})]})})]})}WF.createRoot(document.getElementById("root")).render(f.jsx(M.StrictMode,{children:f.jsx(FJ,{children:f.jsx(ONe,{})})}));
