var iD=t=>{throw TypeError(t)};var QE=(t,e,n)=>e.has(t)||iD("Cannot "+n);var ot=(t,e,n)=>(QE(t,e,"read from private field"),n?n.call(t):e.get(t)),Bn=(t,e,n)=>e.has(t)?iD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),yn=(t,e,n,r)=>(QE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),yr=(t,e,n)=>(QE(t,e,"access private method"),n);var d4=(t,e,n,r)=>({set _(i){yn(t,e,i,n)},get _(){return ot(t,e,r)}});function LQ(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 Ay(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var JE={exports:{}},t_={};/**
 * @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 sD;function jQ(){if(sD)return t_;sD=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 t_.Fragment=e,t_.jsx=n,t_.jsxs=n,t_}var oD;function zQ(){return oD||(oD=1,JE.exports=jQ()),JE.exports}var f=zQ(),eA={exports:{}},Tr={};/**
 * @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 aD;function FQ(){if(aD)return Tr;aD=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(H){return H===null||typeof H!="object"?null:(H=m&&H[m]||H["@@iterator"],typeof H=="function"?H:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function M(H,X,j){this.props=H,this.context=X,this.refs=S,this.updater=j||b}M.prototype.isReactComponent={},M.prototype.setState=function(H,X){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,X,"setState")},M.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function C(){}C.prototype=M.prototype;function A(H,X,j){this.props=H,this.context=X,this.refs=S,this.updater=j||b}var N=A.prototype=new C;N.constructor=A,_(N,M.prototype),N.isPureReactComponent=!0;var D=Array.isArray;function R(){}var L={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function O(H,X,j){var le=j.ref;return{$$typeof:t,type:H,key:X,ref:le!==void 0?le:null,props:j}}function F(H,X){return O(H.type,X,H.props)}function B(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function Y(H){var X={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(j){return X[j]})}var V=/\/+/g;function q(H,X){return typeof H=="object"&&H!==null&&H.key!=null?Y(""+H.key):X.toString(36)}function G(H){switch(H.status){case"fulfilled":return H.value;case"rejected":throw H.reason;default:switch(typeof H.status=="string"?H.then(R,R):(H.status="pending",H.then(function(X){H.status==="pending"&&(H.status="fulfilled",H.value=X)},function(X){H.status==="pending"&&(H.status="rejected",H.reason=X)})),H.status){case"fulfilled":return H.value;case"rejected":throw H.reason}}throw H}function $(H,X,j,le,se){var J=typeof H;(J==="undefined"||J==="boolean")&&(H=null);var ee=!1;if(H===null)ee=!0;else switch(J){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(H.$$typeof){case t:case e:ee=!0;break;case d:return ee=H._init,$(ee(H._payload),X,j,le,se)}}if(ee)return se=se(H),ee=le===""?"."+q(H,0):le,D(se)?(j="",ee!=null&&(j=ee.replace(V,"$&/")+"/"),$(se,X,j,"",function(de){return de})):se!=null&&(B(se)&&(se=F(se,j+(se.key==null||H&&H.key===se.key?"":(""+se.key).replace(V,"$&/")+"/")+ee)),X.push(se)),1;ee=0;var ie=le===""?".":le+":";if(D(H))for(var oe=0;oe<H.length;oe++)le=H[oe],J=ie+q(le,oe),ee+=$(le,X,j,J,se);else if(oe=x(H),typeof oe=="function")for(H=oe.call(H),oe=0;!(le=H.next()).done;)le=le.value,J=ie+q(le,oe++),ee+=$(le,X,j,J,se);else if(J==="object"){if(typeof H.then=="function")return $(G(H),X,j,le,se);throw X=String(H),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ee}function Q(H,X,j){if(H==null)return H;var le=[],se=0;return $(H,le,"","",function(J){return X.call(j,J,se++)}),le}function K(H){if(H._status===-1){var X=H._result;X=X(),X.then(function(j){(H._status===0||H._status===-1)&&(H._status=1,H._result=j)},function(j){(H._status===0||H._status===-1)&&(H._status=2,H._result=j)}),H._status===-1&&(H._status=0,H._result=X)}if(H._status===1)return H._result.default;throw H._result}var re=typeof reportError=="function"?reportError:function(H){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof H=="object"&&H!==null&&typeof H.message=="string"?String(H.message):String(H),error:H});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",H);return}console.error(H)},U={map:Q,forEach:function(H,X,j){Q(H,function(){X.apply(this,arguments)},j)},count:function(H){var X=0;return Q(H,function(){X++}),X},toArray:function(H){return Q(H,function(X){return X})||[]},only:function(H){if(!B(H))throw Error("React.Children.only expected to receive a single React element child.");return H}};return Tr.Activity=p,Tr.Children=U,Tr.Component=M,Tr.Fragment=n,Tr.Profiler=i,Tr.PureComponent=A,Tr.StrictMode=r,Tr.Suspense=l,Tr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Tr.__COMPILER_RUNTIME={__proto__:null,c:function(H){return L.H.useMemoCache(H)}},Tr.cache=function(H){return function(){return H.apply(null,arguments)}},Tr.cacheSignal=function(){return null},Tr.cloneElement=function(H,X,j){if(H==null)throw Error("The argument must be a React element, but you passed "+H+".");var le=_({},H.props),se=H.key;if(X!=null)for(J in X.key!==void 0&&(se=""+X.key),X)!k.call(X,J)||J==="key"||J==="__self"||J==="__source"||J==="ref"&&X.ref===void 0||(le[J]=X[J]);var J=arguments.length-2;if(J===1)le.children=j;else if(1<J){for(var ee=Array(J),ie=0;ie<J;ie++)ee[ie]=arguments[ie+2];le.children=ee}return O(H.type,se,le)},Tr.createContext=function(H){return H={$$typeof:o,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null},H.Provider=H,H.Consumer={$$typeof:s,_context:H},H},Tr.createElement=function(H,X,j){var le,se={},J=null;if(X!=null)for(le in X.key!==void 0&&(J=""+X.key),X)k.call(X,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(se[le]=X[le]);var ee=arguments.length-2;if(ee===1)se.children=j;else if(1<ee){for(var ie=Array(ee),oe=0;oe<ee;oe++)ie[oe]=arguments[oe+2];se.children=ie}if(H&&H.defaultProps)for(le in ee=H.defaultProps,ee)se[le]===void 0&&(se[le]=ee[le]);return O(H,J,se)},Tr.createRef=function(){return{current:null}},Tr.forwardRef=function(H){return{$$typeof:a,render:H}},Tr.isValidElement=B,Tr.lazy=function(H){return{$$typeof:d,_payload:{_status:-1,_result:H},_init:K}},Tr.memo=function(H,X){return{$$typeof:c,type:H,compare:X===void 0?null:X}},Tr.startTransition=function(H){var X=L.T,j={};L.T=j;try{var le=H(),se=L.S;se!==null&&se(j,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(R,re)}catch(J){re(J)}finally{X!==null&&j.types!==null&&(X.types=j.types),L.T=X}},Tr.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Tr.use=function(H){return L.H.use(H)},Tr.useActionState=function(H,X,j){return L.H.useActionState(H,X,j)},Tr.useCallback=function(H,X){return L.H.useCallback(H,X)},Tr.useContext=function(H){return L.H.useContext(H)},Tr.useDebugValue=function(){},Tr.useDeferredValue=function(H,X){return L.H.useDeferredValue(H,X)},Tr.useEffect=function(H,X){return L.H.useEffect(H,X)},Tr.useEffectEvent=function(H){return L.H.useEffectEvent(H)},Tr.useId=function(){return L.H.useId()},Tr.useImperativeHandle=function(H,X,j){return L.H.useImperativeHandle(H,X,j)},Tr.useInsertionEffect=function(H,X){return L.H.useInsertionEffect(H,X)},Tr.useLayoutEffect=function(H,X){return L.H.useLayoutEffect(H,X)},Tr.useMemo=function(H,X){return L.H.useMemo(H,X)},Tr.useOptimistic=function(H,X){return L.H.useOptimistic(H,X)},Tr.useReducer=function(H,X,j){return L.H.useReducer(H,X,j)},Tr.useRef=function(H){return L.H.useRef(H)},Tr.useState=function(H){return L.H.useState(H)},Tr.useSyncExternalStore=function(H,X,j){return L.H.useSyncExternalStore(H,X,j)},Tr.useTransition=function(){return L.H.useTransition()},Tr.version="19.2.1",Tr}var lD;function pw(){return lD||(lD=1,eA.exports=FQ()),eA.exports}var w=pw();const ni=Ay(w),lU=LQ({__proto__:null,default:ni},[w]);var tA={exports:{}},n_={},nA={exports:{}},rA={};/**
 * @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 cD;function UQ(){return cD||(cD=1,(function(t){function e($,Q){var K=$.length;$.push(Q);e:for(;0<K;){var re=K-1>>>1,U=$[re];if(0<i(U,Q))$[re]=Q,$[K]=U,K=re;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var Q=$[0],K=$.pop();if(K!==Q){$[0]=K;e:for(var re=0,U=$.length,H=U>>>1;re<H;){var X=2*(re+1)-1,j=$[X],le=X+1,se=$[le];if(0>i(j,K))le<U&&0>i(se,j)?($[re]=se,$[le]=K,re=le):($[re]=j,$[X]=K,re=X);else if(le<U&&0>i(se,K))$[re]=se,$[le]=K,re=le;else break e}}return Q}function i($,Q){var K=$.sortIndex-Q.sortIndex;return K!==0?K:$.id-Q.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,M=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N($){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=$)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function D($){if(_=!1,N($),!b)if(n(l)!==null)b=!0,R||(R=!0,Y());else{var Q=n(c);Q!==null&&G(D,Q.startTime-$)}}var R=!1,L=-1,k=5,O=-1;function F(){return S?!0:!(t.unstable_now()-O<k)}function B(){if(S=!1,R){var $=t.unstable_now();O=$;var Q=!0;try{e:{b=!1,_&&(_=!1,C(L),L=-1),x=!0;var K=m;try{t:{for(N($),p=n(l);p!==null&&!(p.expirationTime>$&&F());){var re=p.callback;if(typeof re=="function"){p.callback=null,m=p.priorityLevel;var U=re(p.expirationTime<=$);if($=t.unstable_now(),typeof U=="function"){p.callback=U,N($),Q=!0;break t}p===n(l)&&r(l),N($)}else r(l);p=n(l)}if(p!==null)Q=!0;else{var H=n(c);H!==null&&G(D,H.startTime-$),Q=!1}}break e}finally{p=null,m=K,x=!1}Q=void 0}}finally{Q?Y():R=!1}}}var Y;if(typeof A=="function")Y=function(){A(B)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,q=V.port2;V.port1.onmessage=B,Y=function(){q.postMessage(null)}}else Y=function(){M(B,0)};function G($,Q){L=M(function(){$(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function($){switch(m){case 1:case 2:case 3:var Q=3;break;default:Q=m}var K=m;m=Q;try{return $()}finally{m=K}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function($,Q){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var K=m;m=$;try{return Q()}finally{m=K}},t.unstable_scheduleCallback=function($,Q,K){var re=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?re+K:re):K=re,$){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=K+U,$={id:d++,callback:Q,priorityLevel:$,startTime:K,expirationTime:U,sortIndex:-1},K>re?($.sortIndex=K,e(c,$),n(l)===null&&$===n(c)&&(_?(C(L),L=-1):_=!0,G(D,K-re))):($.sortIndex=U,e(l,$),b||x||(b=!0,R||(R=!0,Y()))),$},t.unstable_shouldYield=F,t.unstable_wrapCallback=function($){var Q=m;return function(){var K=m;m=Q;try{return $.apply(this,arguments)}finally{m=K}}}})(rA)),rA}var uD;function cU(){return uD||(uD=1,nA.exports=UQ()),nA.exports}var iA={exports:{}},dl={};/**
 * @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 dD;function BQ(){if(dD)return dl;dD=1;var t=pw();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 dl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,dl.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)},dl.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()}},dl.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))},dl.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},dl.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})}},dl.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)},dl.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})}},dl.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)},dl.requestFormReset=function(l){r.d.r(l)},dl.unstable_batchedUpdates=function(l,c){return l(c)},dl.useFormState=function(l,c,d){return o.H.useFormState(l,c,d)},dl.useFormStatus=function(){return o.H.useHostTransitionStatus()},dl.version="19.2.1",dl}var fD;function uU(){if(fD)return iA.exports;fD=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(),iA.exports=BQ(),iA.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 hD;function HQ(){if(hD)return n_;hD=1;var t=cU(),e=pw(),n=uU();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 pe=!1,Le=I.child;Le;){if(Le===y){pe=!0,y=I,T=z;break}if(Le===T){pe=!0,T=I,y=z;break}Le=Le.sibling}if(!pe){for(Le=z.child;Le;){if(Le===y){pe=!0,y=z,T=I;break}if(Le===T){pe=!0,T=z,y=I;break}Le=Le.sibling}if(!pe)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"),M=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"),R=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function Y(u){return u===null||typeof u!="object"?null:(u=B&&u[B]||u["@@iterator"],typeof u=="function"?u:null)}var V=Symbol.for("react.client.reference");function q(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===V?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case M:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case R:return"SuspenseList";case O: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 L:return h=u.displayName||null,h!==null?h:q(u.type)||"Memo";case k:h=u._payload,u=u._init;try{return q(u(h))}catch{}}return null}var G=Array.isArray,$=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},re=[],U=-1;function H(u){return{current:u}}function X(u){0>U||(u.current=re[U],re[U]=null,U--)}function j(u,h){U++,re[U]=u.current,u.current=h}var le=H(null),se=H(null),J=H(null),ee=H(null);function ie(u,h){switch(j(J,h),j(se,u),j(le,null),h.nodeType){case 9:case 11:u=(u=h.documentElement)&&(u=u.namespaceURI)?EP(u):0;break;default:if(u=h.tagName,h=h.namespaceURI)h=EP(h),u=AP(h,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(le),j(le,u)}function oe(){X(le),X(se),X(J)}function de(u){u.memoizedState!==null&&j(ee,u);var h=le.current,y=AP(h,u.type);h!==y&&(j(se,u),j(le,y))}function ye(u){se.current===u&&(X(le),X(se)),ee.current===u&&(X(ee),Zb._currentValue=K)}var ge,Me;function fe(u){if(ge===void 0)try{throw Error()}catch(y){var h=y.stack.trim().match(/\n( *(at )?)/);ge=h&&h[1]||"",Me=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ge+u+Me}var Se=!1;function me(u,h){if(!u||Se)return"";Se=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var T={DetermineComponentFrameRoot:function(){try{if(h){var Yt=function(){throw Error()};if(Object.defineProperty(Yt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Yt,[])}catch(Ft){var It=Ft}Reflect.construct(u,[],Yt)}else{try{Yt.call()}catch(Ft){It=Ft}u.call(Yt.prototype)}}else{try{throw Error()}catch(Ft){It=Ft}(Yt=u())&&typeof Yt.catch=="function"&&Yt.catch(function(){})}}catch(Ft){if(Ft&&It&&typeof Ft.stack=="string")return[Ft.stack,It.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(),pe=z[0],Le=z[1];if(pe&&Le){var st=pe.split(`
`),kt=Le.split(`
`);for(I=T=0;T<st.length&&!st[T].includes("DetermineComponentFrameRoot");)T++;for(;I<kt.length&&!kt[I].includes("DetermineComponentFrameRoot");)I++;if(T===st.length||I===kt.length)for(T=st.length-1,I=kt.length-1;1<=T&&0<=I&&st[T]!==kt[I];)I--;for(;1<=T&&0<=I;T--,I--)if(st[T]!==kt[I]){if(T!==1||I!==1)do if(T--,I--,0>I||st[T]!==kt[I]){var Gt=`
`+st[T].replace(" at new "," at ");return u.displayName&&Gt.includes("<anonymous>")&&(Gt=Gt.replace("<anonymous>",u.displayName)),Gt}while(1<=T&&0<=I);break}}}finally{Se=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?fe(y):""}function Pe(u,h){switch(u.tag){case 26:case 27:case 5:return fe(u.type);case 16:return fe("Lazy");case 13:return u.child!==h&&h!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return me(u.type,!1);case 11:return me(u.type.render,!1);case 1:return me(u.type,!0);case 31:return fe("Activity");default:return""}}function ce(u){try{var h="",y=null;do h+=Pe(u,y),y=u,u=u.return;while(u);return h}catch(T){return`
Error generating stack: `+T.message+`
`+T.stack}}var He=Object.prototype.hasOwnProperty,Be=t.unstable_scheduleCallback,Ge=t.unstable_cancelCallback,We=t.unstable_shouldYield,ae=t.unstable_requestPaint,Z=t.unstable_now,he=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,we=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,Re=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,Oe=t.log,qe=t.unstable_setDisableYieldValue,Fe=null,Ke=null;function je(u){if(typeof Oe=="function"&&qe(u),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode(Fe,u)}catch{}}var Te=Math.clz32?Math.clz32:ke,Xe=Math.log,ht=Math.LN2;function ke(u){return u>>>=0,u===0?32:31-(Xe(u)/ht|0)|0}var et=256,ct=262144,yt=4194304;function lt(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 Je(u,h,y){var T=u.pendingLanes;if(T===0)return 0;var I=0,z=u.suspendedLanes,pe=u.pingedLanes;u=u.warmLanes;var Le=T&134217727;return Le!==0?(T=Le&~z,T!==0?I=lt(T):(pe&=Le,pe!==0?I=lt(pe):y||(y=Le&~u,y!==0&&(I=lt(y))))):(Le=T&~z,Le!==0?I=lt(Le):pe!==0?I=lt(pe):y||(y=T&~u,y!==0&&(I=lt(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 Ee(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function Ze(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 Ie(){var u=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),u}function Ue(u){for(var h=[],y=0;31>y;y++)h.push(u);return h}function rt(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function ut(u,h,y,T,I,z){var pe=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 Le=u.entanglements,st=u.expirationTimes,kt=u.hiddenUpdates;for(y=pe&~y;0<y;){var Gt=31-Te(y),Yt=1<<Gt;Le[Gt]=0,st[Gt]=-1;var It=kt[Gt];if(It!==null)for(kt[Gt]=null,Gt=0;Gt<It.length;Gt++){var Ft=It[Gt];Ft!==null&&(Ft.lane&=-536870913)}y&=~Yt}T!==0&&Dt(u,T,0),z!==0&&I===0&&u.tag!==0&&(u.suspendedLanes|=z&~(pe&~h))}function Dt(u,h,y){u.pendingLanes|=h,u.suspendedLanes&=~h;var T=31-Te(h);u.entangledLanes|=h,u.entanglements[T]=u.entanglements[T]|1073741824|y&261930}function Rt(u,h){var y=u.entangledLanes|=h;for(u=u.entanglements;y;){var T=31-Te(y),I=1<<T;I&h|u[T]&h&&(u[T]|=h),y&=~I}}function St(u,h){var y=h&-h;return y=(y&42)!==0?1:Ht(y),(y&(u.suspendedLanes|h))!==0?0:y}function Ht(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 en(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Ut(){var u=Q.p;return u!==0?u:(u=window.event,u===void 0?32:ZP(u.type))}function $e(u,h){var y=Q.p;try{return Q.p=u,h()}finally{Q.p=y}}var dt=Math.random().toString(36).slice(2),Tt="__reactFiber$"+dt,Bt="__reactProps$"+dt,Ct="__reactContainer$"+dt,At="__reactEvents$"+dt,Ot="__reactListeners$"+dt,cn="__reactHandles$"+dt,Lt="__reactResources$"+dt,wt="__reactMarker$"+dt;function Zt(u){delete u[Tt],delete u[Bt],delete u[At],delete u[Ot],delete u[cn]}function Jt(u){var h=u[Tt];if(h)return h;for(var y=u.parentNode;y;){if(h=y[Ct]||y[Tt]){if(y=h.alternate,h.child!==null||y!==null&&y.child!==null)for(u=OP(u);u!==null;){if(y=u[Tt])return y;u=OP(u)}return h}u=y,y=u.parentNode}return null}function vn(u){if(u=u[Tt]||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 Fn(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(r(33))}function _e(u){var h=u[Lt];return h||(h=u[Lt]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function nt(u){u[wt]=!0}var mt=new Set,xt={};function vt(u,h){qt(u,h),qt(u+"Capture",h)}function qt(u,h){for(xt[u]=h,u=0;u<h.length;u++)mt.add(h[u])}var tn=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={},Vt={};function dn(u){return He.call(Vt,u)?!0:He.call(Kt,u)?!1:tn.test(u)?Vt[u]=!0:(Kt[u]=!0,!1)}function _n(u,h,y){if(dn(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 An(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 rn(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 Gn(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function xr(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function sr(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(pe){y=""+pe,z.call(this,pe)}}),Object.defineProperty(u,h,{enumerable:T.enumerable}),{getValue:function(){return y},setValue:function(pe){y=""+pe},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Xn(u){if(!u._valueTracker){var h=xr(u)?"checked":"value";u._valueTracker=sr(u,h,""+u[h])}}function dr(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var y=h.getValue(),T="";return u&&(T=xr(u)?u.checked?"true":"false":u.value),u=T,u!==y?(h.setValue(u),!0):!1}function un(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 Ln(u){return u.replace(ss,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function vs(u,h,y,T,I,z,pe,Le){u.name="",pe!=null&&typeof pe!="function"&&typeof pe!="symbol"&&typeof pe!="boolean"?u.type=pe:u.removeAttribute("type"),h!=null?pe==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+Gn(h)):u.value!==""+Gn(h)&&(u.value=""+Gn(h)):pe!=="submit"&&pe!=="reset"||u.removeAttribute("value"),h!=null?Li(u,pe,Gn(h)):y!=null?Li(u,pe,Gn(y)):T!=null&&u.removeAttribute("value"),I==null&&z!=null&&(u.defaultChecked=!!z),I!=null&&(u.checked=I&&typeof I!="function"&&typeof I!="symbol"),Le!=null&&typeof Le!="function"&&typeof Le!="symbol"&&typeof Le!="boolean"?u.name=""+Gn(Le):u.removeAttribute("name")}function Rs(u,h,y,T,I,z,pe,Le){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)){Xn(u);return}y=y!=null?""+Gn(y):"",h=h!=null?""+Gn(h):y,Le||h===u.value||(u.value=h),u.defaultValue=h}T=T??I,T=typeof T!="function"&&typeof T!="symbol"&&!!T,u.checked=Le?u.checked:!!T,u.defaultChecked=!!T,pe!=null&&typeof pe!="function"&&typeof pe!="symbol"&&typeof pe!="boolean"&&(u.name=pe),Xn(u)}function Li(u,h,y){h==="number"&&un(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function ys(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=""+Gn(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 _r(u,h,y){if(h!=null&&(h=""+Gn(h),h!==u.value&&(u.value=h),y==null)){u.defaultValue!==h&&(u.defaultValue=h);return}u.defaultValue=y!=null?""+Gn(y):""}function pi(u,h,y,T){if(h==null){if(T!=null){if(y!=null)throw Error(r(92));if(G(T)){if(1<T.length)throw Error(r(93));T=T[0]}y=T}y==null&&(y=""),h=y}y=Gn(h),u.defaultValue=y,T=u.textContent,T===y&&T!==""&&T!==null&&(u.value=T),Xn(u)}function Ps(u,h){if(h){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=h;return}}u.textContent=h}var ji=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 ea(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||ji.has(h)?h==="float"?u.cssFloat=y:u[h]=(""+y).trim():u[h]=y+"px"}function va(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&&ea(u,I,T)}else for(var z in h)h.hasOwnProperty(z)&&ea(u,z,h[z])}function ka(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 ec=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"]]),Ml=/^[\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 ya(u){return Ml.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Ds(){}var tc=null;function Qa(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Ra=null,Pa=null;function Bc(u){var h=vn(u);if(h&&(u=h.stateNode)){var y=u[Bt]||null;e:switch(u=h.stateNode,h.type){case"input":if(vs(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="'+Ln(""+h)+'"][type="radio"]'),h=0;h<y.length;h++){var T=y[h];if(T!==u&&T.form===u.form){var I=T[Bt]||null;if(!I)throw Error(r(90));vs(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&&dr(T)}break e;case"textarea":_r(u,y.value,y.defaultValue);break e;case"select":h=y.value,h!=null&&ys(u,!!y.multiple,h,!1)}}}var Hc=!1;function nc(u,h,y){if(Hc)return u(h,y);Hc=!0;try{var T=u(h);return T}finally{if(Hc=!1,(Ra!==null||Pa!==null)&&(Kc(),Ra&&(h=Ra,u=Pa,Pa=Ra=null,Bc(h),u)))for(h=0;h<u.length;h++)Bc(u[h])}}function ta(u,h){var y=u.stateNode;if(y===null)return null;var T=y[Bt]||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 co=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lo=!1;if(co)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){Lo=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{Lo=!1}var bs=null,Ja=null,el=null;function Vc(){if(el)return el;var u,h=Ja,y=h.length,T,I="value"in bs?bs.value:bs.textContent,z=I.length;for(u=0;u<y&&h[u]===I[u];u++);var pe=y-u;for(T=1;T<=pe&&h[y-T]===I[z-T];T++);return el=I.slice(u,1<T?1-T:void 0)}function ii(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 Wr(){return!0}function na(){return!1}function Sr(u){function h(y,T,I,z,pe){this._reactName=y,this._targetInst=I,this.type=T,this.nativeEvent=z,this.target=pe,this.currentTarget=null;for(var Le in u)u.hasOwnProperty(Le)&&(y=u[Le],this[Le]=y?y(z):z[Le]);return this.isDefaultPrevented=(z.defaultPrevented!=null?z.defaultPrevented:z.returnValue===!1)?Wr:na,this.isPropagationStopped=na,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=Wr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Wr)},persist:function(){},isPersistent:Wr}),h}var Si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zi=Sr(Si),Kr=p({},Si,{view:0,detail:0}),Da=Sr(Kr),Cl,rc,_o,gi=p({},Kr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lp,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!==_o&&(_o&&u.type==="mousemove"?(Cl=u.screenX-_o.screenX,rc=u.screenY-_o.screenY):rc=Cl=0,_o=u),Cl)},movementY:function(u){return"movementY"in u?u.movementY:rc}}),Ch=Sr(gi),vd=p({},gi,{dataTransfer:0}),yd=Sr(vd),cf=p({},Kr,{relatedTarget:0}),ba=Sr(cf),qi=p({},Si,{animationName:0,elapsedTime:0,pseudoElement:0}),Gs=Sr(qi),_s=p({},Si,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),El=Sr(_s),So=p({},Si,{data:0}),Op=Sr(So),Eh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jm={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"},uf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bd(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=uf[u])?!!h[u]:!1}function Lp(){return bd}var jp=p({},Kr,{key:function(u){if(u.key){var h=Eh[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=ii(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?jm[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lp,charCode:function(u){return u.type==="keypress"?ii(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ii(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),_d=Sr(jp),ic=p({},gi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sc=Sr(ic),Sd=p({},Kr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lp}),zm=Sr(Sd),zp=p({},Si,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fm=Sr(zp),Ws=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}),Um=Sr(Ws),Bm=p({},Si,{newState:0,oldState:0}),Hm=Sr(Bm),Vm=[9,13,27,32],wu=co&&"CompositionEvent"in window,wd=null;co&&"documentMode"in document&&(wd=document.documentMode);var Fp=co&&"TextEvent"in window&&!wd,Up=co&&(!wu||wd&&8<wd&&11>=wd),Gm=" ",oc=!1;function Md(u,h){switch(u){case"keyup":return Vm.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Is(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Mu=!1;function Ss(u,h){switch(u){case"compositionend":return Is(h);case"keypress":return h.which!==32?null:(oc=!0,Gm);case"textInput":return u=h.data,u===Gm&&oc?null:u;default:return null}}function Bp(u,h){if(Mu)return u==="compositionend"||!wu&&Md(u,h)?(u=Vc(),el=Ja=bs=null,Mu=!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 Up&&h.locale!=="ko"?null:h.data;default:return null}}var Ah={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 Td(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!Ah[u.type]:h==="textarea"}function Hp(u,h,y,T){Ra?Pa?Pa.push(T):Pa=[T]:Ra=T,h=K3(h,"onChange"),0<h.length&&(y=new zi("onChange","change",null,y,T),u.push({event:y,listeners:h}))}var Tu=null,Gc=null;function xe(u){_P(u,0)}function Ne(u){var h=Fn(u);if(dr(h))return u}function Ye(u,h){if(u==="change")return h}var Qe=!1;if(co){var ft;if(co){var Et="oninput"in document;if(!Et){var $t=document.createElement("div");$t.setAttribute("oninput","return;"),Et=typeof $t.oninput=="function"}ft=Et}else ft=!1;Qe=ft&&(!document.documentMode||9<document.documentMode)}function Qt(){Tu&&(Tu.detachEvent("onpropertychange",ln),Gc=Tu=null)}function ln(u){if(u.propertyName==="value"&&Ne(Gc)){var h=[];Hp(h,Gc,u,Qa(u)),nc(xe,h)}}function Mn(u,h,y){u==="focusin"?(Qt(),Tu=h,Gc=y,Tu.attachEvent("onpropertychange",ln)):u==="focusout"&&Qt()}function Cn(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Ne(Gc)}function Pn(u,h){if(u==="click")return Ne(h)}function ar(u,h){if(u==="input"||u==="change")return Ne(h)}function Jr(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var lr=typeof Object.is=="function"?Object.is:Jr;function gr(u,h){if(lr(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(!He.call(h,I)||!lr(u[I],h[I]))return!1}return!0}function $n(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function On(u,h){var y=$n(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=$n(y)}}function Zn(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?Zn(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=un(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=un(u.document)}return h}function Os(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=co&&"documentMode"in document&&11>=document.documentMode,ci=null,os=null,Ls=null,ra=!1;function jo(u,h,y){var T=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;ra||ci==null||ci!==un(T)||(T=ci,"selectionStart"in T&&Os(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}),Ls&&gr(Ls,T)||(Ls=T,T=K3(os,"onSelect"),0<T.length&&(h=new zi("onSelect","select",null,h,y),u.push({event:h,listeners:T}),h.target=ci)))}function Wi(u,h){var y={};return y[u.toLowerCase()]=h.toLowerCase(),y["Webkit"+u]="webkit"+h,y["Moz"+u]="moz"+h,y}var $s={animationend:Wi("Animation","AnimationEnd"),animationiteration:Wi("Animation","AnimationIteration"),animationstart:Wi("Animation","AnimationStart"),transitionrun:Wi("Transition","TransitionRun"),transitionstart:Wi("Transition","TransitionStart"),transitioncancel:Wi("Transition","TransitionCancel"),transitionend:Wi("Transition","TransitionEnd")},zo={},Ia={};co&&(Ia=document.createElement("div").style,"AnimationEvent"in window||(delete $s.animationend.animation,delete $s.animationiteration.animation,delete $s.animationstart.animation),"TransitionEvent"in window||delete $s.transitionend.transition);function uo(u){if(zo[u])return zo[u];if(!$s[u])return u;var h=$s[u],y;for(y in h)if(h.hasOwnProperty(y)&&y in Ia)return zo[u]=h[y];return u}var fo=uo("animationend"),wo=uo("animationiteration"),Wc=uo("animationstart"),Fo=uo("transitionrun"),Gx=uo("transitionstart"),Jw=uo("transitioncancel"),Jy=uo("transitionend"),ac=new Map,Wm="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(" ");Wm.push("scrollEnd");function lc(u,h){ac.set(u,h),vt(h,[u])}var $m=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)},cc=[],Cd=0,Uo=0;function qm(){for(var u=Cd,h=Uo=Cd=0;h<u;){var y=cc[h];cc[h++]=null;var T=cc[h];cc[h++]=null;var I=cc[h];cc[h++]=null;var z=cc[h];if(cc[h++]=null,T!==null&&I!==null){var pe=T.pending;pe===null?I.next=I:(I.next=pe.next,pe.next=I),T.pending=I}z!==0&&df(y,I,z)}}function Bo(u,h,y,T){cc[Cd++]=u,cc[Cd++]=h,cc[Cd++]=y,cc[Cd++]=T,Uo|=T,u.lanes|=T,u=u.alternate,u!==null&&(u.lanes|=T)}function Wx(u,h,y,T){return Bo(u,h,y,T),uc(u)}function Oa(u,h){return Bo(u,null,null,h),uc(u)}function df(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-Te(y),u=z.hiddenUpdates,T=u[I],T===null?u[I]=[h]:T.push(h),h.lane=y|536870912),z):null}function uc(u){if(50<kf)throw kf=0,qh=null,Error(r(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var ff={};function eb(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 ws(u,h,y,T){return new eb(u,h,y,T)}function $x(u){return u=u.prototype,!(!u||!u.isReactComponent)}function tl(u,h){var y=u.alternate;return y===null?(y=ws(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 Vp(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 Cu(u,h,y,T,I,z){var pe=0;if(T=u,typeof u=="function")$x(u)&&(pe=1);else if(typeof u=="string")pe=MQ(u,y,le.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case O:return u=ws(31,y,h,I),u.elementType=O,u.lanes=z,u;case _:return hf(y.children,I,z,h);case S:pe=8,I|=24;break;case M:return u=ws(12,y,h,I|2),u.elementType=M,u.lanes=z,u;case D:return u=ws(13,y,h,I),u.elementType=D,u.lanes=z,u;case R:return u=ws(19,y,h,I),u.elementType=R,u.lanes=z,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:pe=10;break e;case C:pe=9;break e;case N:pe=11;break e;case L:pe=14;break e;case k:pe=16,T=null;break e}pe=29,y=Error(r(130,u===null?"null":typeof u,"")),T=null}return h=ws(pe,y,h,I),h.elementType=u,h.type=T,h.lanes=z,h}function hf(u,h,y,T){return u=ws(7,u,T,h),u.lanes=y,u}function qx(u,h,y){return u=ws(6,u,null,h),u.lanes=y,u}function Gp(u){var h=ws(18,null,null,0);return h.stateNode=u,h}function Xx(u,h,y){return h=ws(4,u.children!==null?u.children:[],u.key,h),h.lanes=y,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}var Xm=new WeakMap;function Al(u,h){if(typeof u=="object"&&u!==null){var y=Xm.get(u);return y!==void 0?y:(h={value:u,source:h,stack:ce(h)},Xm.set(u,h),h)}return{value:u,source:h,stack:ce(h)}}var pf=[],mf=0,Wp=null,$p=0,nl=[],as=0,Ed=null,Ms=1,$c="";function Eu(u,h){pf[mf++]=$p,pf[mf++]=Wp,Wp=u,$p=h}function e3(u,h,y){nl[as++]=Ms,nl[as++]=$c,nl[as++]=Ed,Ed=u;var T=Ms;u=$c;var I=32-Te(T)-1;T&=~(1<<I),y+=1;var z=32-Te(h)+I;if(30<z){var pe=I-I%5;z=(T&(1<<pe)-1).toString(32),T>>=pe,I-=pe,Ms=1<<32-Te(h)+I|y<<I|T,$c=z+u}else Ms=1<<z|y<<I|T,$c=u}function Au(u){u.return!==null&&(Eu(u,1),e3(u,1,0))}function Yx(u){for(;u===Wp;)Wp=pf[--mf],pf[mf]=null,$p=pf[--mf],pf[mf]=null;for(;u===Ed;)Ed=nl[--as],nl[as]=null,$c=nl[--as],nl[as]=null,Ms=nl[--as],nl[as]=null}function Kx(u,h){nl[as++]=Ms,nl[as++]=$c,nl[as++]=Ed,Ms=h.id,$c=h.overflow,Ed=u}var js=null,Xi=null,Zr=!1,Ad=null,Nl=!1,qp=Error(r(519));function Nu(u){var h=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ku(Al(h,u)),qp}function t3(u){var h=u.stateNode,y=u.type,T=u.memoizedProps;switch(h[Tt]=u,h[Bt]=T,y){case"dialog":ti("cancel",h),ti("close",h);break;case"iframe":case"object":case"embed":ti("load",h);break;case"video":case"audio":for(y=0;y<wc.length;y++)ti(wc[y],h);break;case"source":ti("error",h);break;case"img":case"image":case"link":ti("error",h),ti("load",h);break;case"details":ti("toggle",h);break;case"input":ti("invalid",h),Rs(h,T.value,T.defaultValue,T.checked,T.defaultChecked,T.type,T.name,!0);break;case"select":ti("invalid",h);break;case"textarea":ti("invalid",h),pi(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||TP(h.textContent,y)?(T.popover!=null&&(ti("beforetoggle",h),ti("toggle",h)),T.onScroll!=null&&ti("scroll",h),T.onScrollEnd!=null&&ti("scrollend",h),T.onClick!=null&&(h.onclick=Ds),h=!0):h=!1,h||Nu(u,!0)}function n3(u){for(js=u.return;js;)switch(js.tag){case 5:case 31:case 13:Nl=!1;return;case 27:case 3:Nl=!0;return;default:js=js.return}}function Xp(u){if(u!==js)return!1;if(!Zr)return n3(u),Zr=!0,!1;var h=u.tag,y;if((y=h!==3&&h!==27)&&((y=h===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||jE(u.type,u.memoizedProps)),y=!y),y&&Xi&&Nu(u),n3(u),h===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=IP(u)}else if(h===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=IP(u)}else h===27?(h=Xi,p0(u.type)?(u=HE,HE=null,Xi=u):Xi=h):Xi=js?Gu(u.stateNode.nextSibling):null;return!0}function gf(){Xi=js=null,Zr=!1}function Zx(){var u=Ad;return u!==null&&(Fs===null?Fs=u:Fs.push.apply(Fs,u),Ad=null),u}function ku(u){Ad===null?Ad=[u]:Ad.push(u)}var Yp=H(null),xf=null,Ru=null;function Nd(u,h,y){j(Yp,h._currentValue),h._currentValue=y}function Pu(u){u._currentValue=Yp.current,X(Yp)}function Qx(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 Jx(u,h,y,T){var I=u.child;for(I!==null&&(I.return=u);I!==null;){var z=I.dependencies;if(z!==null){var pe=I.child;z=z.firstContext;e:for(;z!==null;){var Le=z;z=I;for(var st=0;st<h.length;st++)if(Le.context===h[st]){z.lanes|=y,Le=z.alternate,Le!==null&&(Le.lanes|=y),Qx(z.return,y,u),T||(pe=null);break e}z=Le.next}}else if(I.tag===18){if(pe=I.return,pe===null)throw Error(r(341));pe.lanes|=y,z=pe.alternate,z!==null&&(z.lanes|=y),Qx(pe,y,u),pe=null}else pe=I.child;if(pe!==null)pe.return=I;else for(pe=I;pe!==null;){if(pe===u){pe=null;break}if(I=pe.sibling,I!==null){I.return=pe.return,pe=I;break}pe=pe.return}I=pe}}function Du(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 pe=I.alternate;if(pe===null)throw Error(r(387));if(pe=pe.memoizedProps,pe!==null){var Le=I.type;lr(I.pendingProps.value,pe.value)||(u!==null?u.push(Le):u=[Le])}}else if(I===ee.current){if(pe=I.alternate,pe===null)throw Error(r(387));pe.memoizedState.memoizedState!==I.memoizedState.memoizedState&&(u!==null?u.push(Zb):u=[Zb])}I=I.return}u!==null&&Jx(h,u,y,T),h.flags|=262144}function Ym(u){for(u=u.firstContext;u!==null;){if(!lr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function vf(u){xf=u,Ru=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function cr(u){return r3(xf,u)}function Kp(u,h){return xf===null&&vf(u),r3(u,h)}function r3(u,h){var y=h._currentValue;if(h={context:h,memoizedValue:y,next:null},Ru===null){if(u===null)throw Error(r(308));Ru=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else Ru=Ru.next=h;return y}var i3=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()})}},SE=t.unstable_scheduleCallback,wE=t.unstable_NormalPriority,ho={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tb(){return{controller:new i3,data:new Map,refCount:0}}function Nh(u){u.refCount--,u.refCount===0&&SE(wE,function(){u.controller.abort()})}var kl=null,ev=0,kd=0,dc=null;function nb(u,h){if(kl===null){var y=kl=[];ev=0,kd=jt(),dc={status:"pending",value:void 0,then:function(T){y.push(T)}}}return ev++,h.then(rb,rb),h}function rb(){if(--ev===0&&kl!==null){dc!==null&&(dc.status="fulfilled");var u=kl;kl=null,kd=0,dc=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function ib(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 s3=$.S;$.S=function(u,h){Wb=Z(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&nb(u,h),s3!==null&&s3(u,h)};var yf=H(null);function tv(){var u=yf.current;return u!==null?u:pr.pooledCache}function Km(u,h){h===null?j(yf,yf.current):j(yf,h.pool)}function sb(){var u=tv();return u===null?null:{parent:ho._currentValue,pool:u}}var kh=Error(r(460)),Zm=Error(r(474)),Pr=Error(r(542)),nv={then:function(){}};function rl(u){return u=u.status,u==="fulfilled"||u==="rejected"}function rv(u,h,y){switch(y=u[y],y===void 0?u.push(h):y!==h&&(h.then(Ds,Ds),h=y),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,Dh(u),u;default:if(typeof h.status=="string")h.then(Ds,Ds);else{if(u=pr,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,Dh(u),u}throw Iu=h,kh}}function Rh(u){try{var h=u._init;return h(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Iu=y,kh):y}}var Iu=null;function Ph(){if(Iu===null)throw Error(r(459));var u=Iu;return Iu=null,u}function Dh(u){if(u===kh||u===Pr)throw Error(r(483))}var Ih=null,Oh=0;function Qm(u){var h=Oh;return Oh+=1,Ih===null&&(Ih=[]),rv(Ih,u,h)}function fc(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function Zp(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 iv(u){function h(_t,pt){if(u){var Nt=_t.deletions;Nt===null?(_t.deletions=[pt],_t.flags|=16):Nt.push(pt)}}function y(_t,pt){if(!u)return null;for(;pt!==null;)h(_t,pt),pt=pt.sibling;return null}function T(_t){for(var pt=new Map;_t!==null;)_t.key!==null?pt.set(_t.key,_t):pt.set(_t.index,_t),_t=_t.sibling;return pt}function I(_t,pt){return _t=tl(_t,pt),_t.index=0,_t.sibling=null,_t}function z(_t,pt,Nt){return _t.index=Nt,u?(Nt=_t.alternate,Nt!==null?(Nt=Nt.index,Nt<pt?(_t.flags|=67108866,pt):Nt):(_t.flags|=67108866,pt)):(_t.flags|=1048576,pt)}function pe(_t){return u&&_t.alternate===null&&(_t.flags|=67108866),_t}function Le(_t,pt,Nt,Xt){return pt===null||pt.tag!==6?(pt=qx(Nt,_t.mode,Xt),pt.return=_t,pt):(pt=I(pt,Nt),pt.return=_t,pt)}function st(_t,pt,Nt,Xt){var Kn=Nt.type;return Kn===_?Gt(_t,pt,Nt.props.children,Xt,Nt.key):pt!==null&&(pt.elementType===Kn||typeof Kn=="object"&&Kn!==null&&Kn.$$typeof===k&&Rh(Kn)===pt.type)?(pt=I(pt,Nt.props),fc(pt,Nt),pt.return=_t,pt):(pt=Cu(Nt.type,Nt.key,Nt.props,null,_t.mode,Xt),fc(pt,Nt),pt.return=_t,pt)}function kt(_t,pt,Nt,Xt){return pt===null||pt.tag!==4||pt.stateNode.containerInfo!==Nt.containerInfo||pt.stateNode.implementation!==Nt.implementation?(pt=Xx(Nt,_t.mode,Xt),pt.return=_t,pt):(pt=I(pt,Nt.children||[]),pt.return=_t,pt)}function Gt(_t,pt,Nt,Xt,Kn){return pt===null||pt.tag!==7?(pt=hf(Nt,_t.mode,Xt,Kn),pt.return=_t,pt):(pt=I(pt,Nt),pt.return=_t,pt)}function Yt(_t,pt,Nt){if(typeof pt=="string"&&pt!==""||typeof pt=="number"||typeof pt=="bigint")return pt=qx(""+pt,_t.mode,Nt),pt.return=_t,pt;if(typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case x:return Nt=Cu(pt.type,pt.key,pt.props,null,_t.mode,Nt),fc(Nt,pt),Nt.return=_t,Nt;case b:return pt=Xx(pt,_t.mode,Nt),pt.return=_t,pt;case k:return pt=Rh(pt),Yt(_t,pt,Nt)}if(G(pt)||Y(pt))return pt=hf(pt,_t.mode,Nt,null),pt.return=_t,pt;if(typeof pt.then=="function")return Yt(_t,Qm(pt),Nt);if(pt.$$typeof===A)return Yt(_t,Kp(_t,pt),Nt);Zp(_t,pt)}return null}function It(_t,pt,Nt,Xt){var Kn=pt!==null?pt.key:null;if(typeof Nt=="string"&&Nt!==""||typeof Nt=="number"||typeof Nt=="bigint")return Kn!==null?null:Le(_t,pt,""+Nt,Xt);if(typeof Nt=="object"&&Nt!==null){switch(Nt.$$typeof){case x:return Nt.key===Kn?st(_t,pt,Nt,Xt):null;case b:return Nt.key===Kn?kt(_t,pt,Nt,Xt):null;case k:return Nt=Rh(Nt),It(_t,pt,Nt,Xt)}if(G(Nt)||Y(Nt))return Kn!==null?null:Gt(_t,pt,Nt,Xt,null);if(typeof Nt.then=="function")return It(_t,pt,Qm(Nt),Xt);if(Nt.$$typeof===A)return It(_t,pt,Kp(_t,Nt),Xt);Zp(_t,Nt)}return null}function Ft(_t,pt,Nt,Xt,Kn){if(typeof Xt=="string"&&Xt!==""||typeof Xt=="number"||typeof Xt=="bigint")return _t=_t.get(Nt)||null,Le(pt,_t,""+Xt,Kn);if(typeof Xt=="object"&&Xt!==null){switch(Xt.$$typeof){case x:return _t=_t.get(Xt.key===null?Nt:Xt.key)||null,st(pt,_t,Xt,Kn);case b:return _t=_t.get(Xt.key===null?Nt:Xt.key)||null,kt(pt,_t,Xt,Kn);case k:return Xt=Rh(Xt),Ft(_t,pt,Nt,Xt,Kn)}if(G(Xt)||Y(Xt))return _t=_t.get(Nt)||null,Gt(pt,_t,Xt,Kn,null);if(typeof Xt.then=="function")return Ft(_t,pt,Nt,Qm(Xt),Kn);if(Xt.$$typeof===A)return Ft(_t,pt,Nt,Kp(pt,Xt),Kn);Zp(pt,Xt)}return null}function jn(_t,pt,Nt,Xt){for(var Kn=null,wi=null,Hn=pt,zr=pt=0,oi=null;Hn!==null&&zr<Nt.length;zr++){Hn.index>zr?(oi=Hn,Hn=null):oi=Hn.sibling;var Mi=It(_t,Hn,Nt[zr],Xt);if(Mi===null){Hn===null&&(Hn=oi);break}u&&Hn&&Mi.alternate===null&&h(_t,Hn),pt=z(Mi,pt,zr),wi===null?Kn=Mi:wi.sibling=Mi,wi=Mi,Hn=oi}if(zr===Nt.length)return y(_t,Hn),Zr&&Eu(_t,zr),Kn;if(Hn===null){for(;zr<Nt.length;zr++)Hn=Yt(_t,Nt[zr],Xt),Hn!==null&&(pt=z(Hn,pt,zr),wi===null?Kn=Hn:wi.sibling=Hn,wi=Hn);return Zr&&Eu(_t,zr),Kn}for(Hn=T(Hn);zr<Nt.length;zr++)oi=Ft(Hn,_t,zr,Nt[zr],Xt),oi!==null&&(u&&oi.alternate!==null&&Hn.delete(oi.key===null?zr:oi.key),pt=z(oi,pt,zr),wi===null?Kn=oi:wi.sibling=oi,wi=oi);return u&&Hn.forEach(function(y0){return h(_t,y0)}),Zr&&Eu(_t,zr),Kn}function or(_t,pt,Nt,Xt){if(Nt==null)throw Error(r(151));for(var Kn=null,wi=null,Hn=pt,zr=pt=0,oi=null,Mi=Nt.next();Hn!==null&&!Mi.done;zr++,Mi=Nt.next()){Hn.index>zr?(oi=Hn,Hn=null):oi=Hn.sibling;var y0=It(_t,Hn,Mi.value,Xt);if(y0===null){Hn===null&&(Hn=oi);break}u&&Hn&&y0.alternate===null&&h(_t,Hn),pt=z(y0,pt,zr),wi===null?Kn=y0:wi.sibling=y0,wi=y0,Hn=oi}if(Mi.done)return y(_t,Hn),Zr&&Eu(_t,zr),Kn;if(Hn===null){for(;!Mi.done;zr++,Mi=Nt.next())Mi=Yt(_t,Mi.value,Xt),Mi!==null&&(pt=z(Mi,pt,zr),wi===null?Kn=Mi:wi.sibling=Mi,wi=Mi);return Zr&&Eu(_t,zr),Kn}for(Hn=T(Hn);!Mi.done;zr++,Mi=Nt.next())Mi=Ft(Hn,_t,zr,Mi.value,Xt),Mi!==null&&(u&&Mi.alternate!==null&&Hn.delete(Mi.key===null?zr:Mi.key),pt=z(Mi,pt,zr),wi===null?Kn=Mi:wi.sibling=Mi,wi=Mi);return u&&Hn.forEach(function(OQ){return h(_t,OQ)}),Zr&&Eu(_t,zr),Kn}function Zi(_t,pt,Nt,Xt){if(typeof Nt=="object"&&Nt!==null&&Nt.type===_&&Nt.key===null&&(Nt=Nt.props.children),typeof Nt=="object"&&Nt!==null){switch(Nt.$$typeof){case x:e:{for(var Kn=Nt.key;pt!==null;){if(pt.key===Kn){if(Kn=Nt.type,Kn===_){if(pt.tag===7){y(_t,pt.sibling),Xt=I(pt,Nt.props.children),Xt.return=_t,_t=Xt;break e}}else if(pt.elementType===Kn||typeof Kn=="object"&&Kn!==null&&Kn.$$typeof===k&&Rh(Kn)===pt.type){y(_t,pt.sibling),Xt=I(pt,Nt.props),fc(Xt,Nt),Xt.return=_t,_t=Xt;break e}y(_t,pt);break}else h(_t,pt);pt=pt.sibling}Nt.type===_?(Xt=hf(Nt.props.children,_t.mode,Xt,Nt.key),Xt.return=_t,_t=Xt):(Xt=Cu(Nt.type,Nt.key,Nt.props,null,_t.mode,Xt),fc(Xt,Nt),Xt.return=_t,_t=Xt)}return pe(_t);case b:e:{for(Kn=Nt.key;pt!==null;){if(pt.key===Kn)if(pt.tag===4&&pt.stateNode.containerInfo===Nt.containerInfo&&pt.stateNode.implementation===Nt.implementation){y(_t,pt.sibling),Xt=I(pt,Nt.children||[]),Xt.return=_t,_t=Xt;break e}else{y(_t,pt);break}else h(_t,pt);pt=pt.sibling}Xt=Xx(Nt,_t.mode,Xt),Xt.return=_t,_t=Xt}return pe(_t);case k:return Nt=Rh(Nt),Zi(_t,pt,Nt,Xt)}if(G(Nt))return jn(_t,pt,Nt,Xt);if(Y(Nt)){if(Kn=Y(Nt),typeof Kn!="function")throw Error(r(150));return Nt=Kn.call(Nt),or(_t,pt,Nt,Xt)}if(typeof Nt.then=="function")return Zi(_t,pt,Qm(Nt),Xt);if(Nt.$$typeof===A)return Zi(_t,pt,Kp(_t,Nt),Xt);Zp(_t,Nt)}return typeof Nt=="string"&&Nt!==""||typeof Nt=="number"||typeof Nt=="bigint"?(Nt=""+Nt,pt!==null&&pt.tag===6?(y(_t,pt.sibling),Xt=I(pt,Nt),Xt.return=_t,_t=Xt):(y(_t,pt),Xt=qx(Nt,_t.mode,Xt),Xt.return=_t,_t=Xt),pe(_t)):y(_t,pt)}return function(_t,pt,Nt,Xt){try{Oh=0;var Kn=Zi(_t,pt,Nt,Xt);return Ih=null,Kn}catch(Hn){if(Hn===kh||Hn===Pr)throw Hn;var wi=ws(29,Hn,null,_t.mode);return wi.lanes=Xt,wi.return=_t,wi}finally{}}}var Rd=iv(!0),sv=iv(!1),La=!1;function Jm(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ob(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 Pd(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function bf(u,h,y){var T=u.updateQueue;if(T===null)return null;if(T=T.shared,(Vn&2)!==0){var I=T.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),T.pending=h,h=uc(u),df(u,null,y),h}return Bo(u,T,h,y),uc(u)}function _f(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,Rt(u,y)}}function Yn(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 pe={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};z===null?I=z=pe:z=z.next=pe,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 ab=!1;function eg(){if(ab){var u=dc;if(u!==null)throw u}}function Qp(u,h,y,T){ab=!1;var I=u.updateQueue;La=!1;var z=I.firstBaseUpdate,pe=I.lastBaseUpdate,Le=I.shared.pending;if(Le!==null){I.shared.pending=null;var st=Le,kt=st.next;st.next=null,pe===null?z=kt:pe.next=kt,pe=st;var Gt=u.alternate;Gt!==null&&(Gt=Gt.updateQueue,Le=Gt.lastBaseUpdate,Le!==pe&&(Le===null?Gt.firstBaseUpdate=kt:Le.next=kt,Gt.lastBaseUpdate=st))}if(z!==null){var Yt=I.baseState;pe=0,Gt=kt=st=null,Le=z;do{var It=Le.lane&-536870913,Ft=It!==Le.lane;if(Ft?(Nr&It)===It:(T&It)===It){It!==0&&It===kd&&(ab=!0),Gt!==null&&(Gt=Gt.next={lane:0,tag:Le.tag,payload:Le.payload,callback:null,next:null});e:{var jn=u,or=Le;It=h;var Zi=y;switch(or.tag){case 1:if(jn=or.payload,typeof jn=="function"){Yt=jn.call(Zi,Yt,It);break e}Yt=jn;break e;case 3:jn.flags=jn.flags&-65537|128;case 0:if(jn=or.payload,It=typeof jn=="function"?jn.call(Zi,Yt,It):jn,It==null)break e;Yt=p({},Yt,It);break e;case 2:La=!0}}It=Le.callback,It!==null&&(u.flags|=64,Ft&&(u.flags|=8192),Ft=I.callbacks,Ft===null?I.callbacks=[It]:Ft.push(It))}else Ft={lane:It,tag:Le.tag,payload:Le.payload,callback:Le.callback,next:null},Gt===null?(kt=Gt=Ft,st=Yt):Gt=Gt.next=Ft,pe|=It;if(Le=Le.next,Le===null){if(Le=I.shared.pending,Le===null)break;Ft=Le,Le=Ft.next,Ft.next=null,I.lastBaseUpdate=Ft,I.shared.pending=null}}while(!0);Gt===null&&(st=Yt),I.baseState=st,I.firstBaseUpdate=kt,I.lastBaseUpdate=Gt,z===null&&(I.shared.lanes=0),Bu|=pe,u.lanes=pe,u.memoizedState=Yt}}function Jp(u,h){if(typeof u!="function")throw Error(r(191,u));u.call(h)}function o3(u,h){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)Jp(y[u],h)}var e0=H(null),ov=H(0);function a3(u,h){u=Il,j(ov,u),j(e0,h),Il=u|h.baseLanes}function lb(){j(ov,Il),j(e0,e0.current)}function tg(){Il=ov.current,X(e0),X(ov)}var il=H(null),ja=null;function Dd(u){var h=u.alternate;j(Qr,Qr.current&1),j(il,u),ja===null&&(h===null||e0.current!==null||h.memoizedState!==null)&&(ja=u)}function cb(u){j(Qr,Qr.current),j(il,u),ja===null&&(ja=u)}function l3(u){u.tag===22?(j(Qr,Qr.current),j(il,u),ja===null&&(ja=u)):sl()}function sl(){j(Qr,Qr.current),j(il,il.current)}function qs(u){X(il),ja===u&&(ja=null),X(Qr)}var Qr=H(0);function Rl(u){for(var h=u;h!==null;){if(h.tag===13){var y=h.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||UE(y)||BE(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,wr=null,Fi=null,$r=null,hc=!1,t0=!1,Lh=!1,av=0,ng=0,n0=null,ub=0;function Ts(){throw Error(r(321))}function db(u,h){if(h===null)return!1;for(var y=0;y<h.length&&y<u.length;y++)if(!lr(u[y],h[y]))return!1;return!0}function lv(u,h,y,T,I,z){return ls=z,wr=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,$.H=u===null||u.memoizedState===null?U3:Rb,Lh=!1,z=y(T,I),Lh=!1,t0&&(z=jh(h,y,T,I)),c3(u),z}function c3(u){$.H=r0;var h=Fi!==null&&Fi.next!==null;if(ls=0,$r=Fi=wr=null,hc=!1,ng=0,n0=null,h)throw Error(r(300));u===null||po||(u=u.dependencies,u!==null&&Ym(u)&&(po=!0))}function jh(u,h,y,T){wr=u;var I=0;do{if(t0&&(n0=null),ng=0,t0=!1,25<=I)throw Error(r(301));if(I+=1,$r=Fi=null,u.updateQueue!=null){var z=u.updateQueue;z.lastEffect=null,z.events=null,z.stores=null,z.memoCache!=null&&(z.memoCache.index=0)}$.H=pc,z=h(y,T)}while(t0);return z}function zh(){var u=$.H,h=u.useState()[0];return h=typeof h.then=="function"?rg(h):h,u=u.useState()[0],(Fi!==null?Fi.memoizedState:null)!==u&&(wr.flags|=1024),h}function fb(){var u=av!==0;return av=0,u}function hb(u,h,y){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~y}function pb(u){if(hc){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}hc=!1}ls=0,$r=Fi=wr=null,t0=!1,ng=av=0,n0=null}function Mo(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $r===null?wr.memoizedState=$r=u:$r=$r.next=u,$r}function Xs(){if(Fi===null){var u=wr.alternate;u=u!==null?u.memoizedState:null}else u=Fi.next;var h=$r===null?wr.memoizedState:$r.next;if(h!==null)$r=h,Fi=u;else{if(u===null)throw wr.alternate===null?Error(r(467)):Error(r(310));Fi=u,u={memoizedState:Fi.memoizedState,baseState:Fi.baseState,baseQueue:Fi.baseQueue,queue:Fi.queue,next:null},$r===null?wr.memoizedState=$r=u:$r=$r.next=u}return $r}function cv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rg(u){var h=ng;return ng+=1,n0===null&&(n0=[]),u=rv(n0,u,h),h=wr,($r===null?h.memoizedState:$r.next)===null&&(h=h.alternate,$.H=h===null||h.memoizedState===null?U3:Rb),u}function Sf(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return rg(u);if(u.$$typeof===A)return cr(u)}throw Error(r(438,String(u)))}function mb(u){var h=null,y=wr.updateQueue;if(y!==null&&(h=y.memoCache),h==null){var T=wr.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=cv(),wr.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]=F;return h.index++,y}function Id(u,h){return typeof h=="function"?h(u):h}function uv(u){var h=Xs();return gb(h,Fi,u)}function gb(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 pe=I.next;I.next=z.next,z.next=pe}h.baseQueue=I=z,T.pending=null}if(z=u.baseState,I===null)u.memoizedState=z;else{h=I.next;var Le=pe=null,st=null,kt=h,Gt=!1;do{var Yt=kt.lane&-536870913;if(Yt!==kt.lane?(Nr&Yt)===Yt:(ls&Yt)===Yt){var It=kt.revertLane;if(It===0)st!==null&&(st=st.next={lane:0,revertLane:0,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null}),Yt===kd&&(Gt=!0);else if((ls&It)===It){kt=kt.next,It===kd&&(Gt=!0);continue}else Yt={lane:0,revertLane:kt.revertLane,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},st===null?(Le=st=Yt,pe=z):st=st.next=Yt,wr.lanes|=It,Bu|=It;Yt=kt.action,Lh&&y(z,Yt),z=kt.hasEagerState?kt.eagerState:y(z,Yt)}else It={lane:Yt,revertLane:kt.revertLane,gesture:kt.gesture,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},st===null?(Le=st=It,pe=z):st=st.next=It,wr.lanes|=Yt,Bu|=Yt;kt=kt.next}while(kt!==null&&kt!==h);if(st===null?pe=z:st.next=Le,!lr(z,u.memoizedState)&&(po=!0,Gt&&(y=dc,y!==null)))throw y;u.memoizedState=z,u.baseState=pe,u.baseQueue=st,T.lastRenderedState=z}return I===null&&(T.lanes=0),[u.memoizedState,T.dispatch]}function xb(u){var h=Xs(),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 pe=I=I.next;do z=u(z,pe.action),pe=pe.next;while(pe!==I);lr(z,h.memoizedState)||(po=!0),h.memoizedState=z,h.baseQueue===null&&(h.baseState=z),y.lastRenderedState=z}return[z,T]}function u3(u,h,y){var T=wr,I=Xs(),z=Zr;if(z){if(y===void 0)throw Error(r(407));y=y()}else y=h();var pe=!lr((Fi||I).memoizedState,y);if(pe&&(I.memoizedState=y,po=!0),I=I.queue,Tb(h3.bind(null,T,I,u),[u]),I.getSnapshot!==h||pe||$r!==null&&$r.memoizedState.tag&1){if(T.flags|=2048,wf(9,{destroy:void 0},f3.bind(null,T,I,y,h),null),pr===null)throw Error(r(349));z||(ls&127)!==0||d3(T,h,y)}return y}function d3(u,h,y){u.flags|=16384,u={getSnapshot:h,value:y},h=wr.updateQueue,h===null?(h=cv(),wr.updateQueue=h,h.stores=[u]):(y=h.stores,y===null?h.stores=[u]:y.push(u))}function f3(u,h,y,T){h.value=y,h.getSnapshot=T,p3(h)&&m3(u)}function h3(u,h,y){return y(function(){p3(h)&&m3(u)})}function p3(u){var h=u.getSnapshot;u=u.value;try{var y=h();return!lr(u,y)}catch{return!0}}function m3(u){var h=Oa(u,2);h!==null&&Ir(h,u,2)}function vb(u){var h=Mo();if(typeof u=="function"){var y=u;if(u=y(),Lh){je(!0);try{y()}finally{je(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Id,lastRenderedState:u},h}function yb(u,h,y,T){return u.baseState=y,gb(u,Fi,typeof T=="function"?T:Id)}function ME(u,h,y,T,I){if(pv(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(pe){z.listeners.push(pe)}};$.T!==null?y(!0):z.isTransition=!1,T(z),y=h.pending,y===null?(z.next=h.pending=z,g3(h,z)):(z.next=y.next,h.pending=y.next=z)}}function g3(u,h){var y=h.action,T=h.payload,I=u.state;if(h.isTransition){var z=$.T,pe={};$.T=pe;try{var Le=y(I,T),st=$.S;st!==null&&st(pe,Le),x3(u,h,Le)}catch(kt){bb(u,h,kt)}finally{z!==null&&pe.types!==null&&(z.types=pe.types),$.T=z}}else try{z=y(I,T),x3(u,h,z)}catch(kt){bb(u,h,kt)}}function x3(u,h,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(T){v3(u,h,T)},function(T){return bb(u,h,T)}):v3(u,h,y)}function v3(u,h,y){h.status="fulfilled",h.value=y,y3(h),u.state=y,h=u.pending,h!==null&&(y=h.next,y===h?u.pending=null:(y=y.next,h.next=y,g3(u,y)))}function bb(u,h,y){var T=u.pending;if(u.pending=null,T!==null){T=T.next;do h.status="rejected",h.reason=y,y3(h),h=h.next;while(h!==T)}u.action=null}function y3(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function _b(u,h){return h}function Sb(u,h){if(Zr){var y=pr.formState;if(y!==null){e:{var T=wr;if(Zr){if(Xi){t:{for(var I=Xi,z=Nl;I.nodeType!==8;){if(!z){I=null;break t}if(I=Gu(I.nextSibling),I===null){I=null;break t}}z=I.data,I=z==="F!"||z==="F"?I:null}if(I){Xi=Gu(I.nextSibling),T=I.data==="F!";break e}}Nu(T)}T=!1}T&&(h=y[0])}}return y=Mo(),y.memoizedState=y.baseState=h,T={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_b,lastRenderedState:h},y.queue=T,y=j3.bind(null,wr,T),T.dispatch=y,T=vb(!1),z=kb.bind(null,wr,!1,T.queue),T=Mo(),I={state:h,dispatch:null,action:u,pending:null},T.queue=I,y=ME.bind(null,wr,I,z,y),I.dispatch=y,T.memoizedState=u,[h,y,!1]}function b3(u){var h=Xs();return wb(h,Fi,u)}function wb(u,h,y){if(h=gb(u,h,_b)[0],u=uv(Id)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var T=rg(h)}catch(pe){throw pe===kh?Pr:pe}else T=h;h=Xs();var I=h.queue,z=I.dispatch;return y!==h.memoizedState&&(wr.flags|=2048,wf(9,{destroy:void 0},_3.bind(null,I,y),null)),[T,z,u]}function _3(u,h){u.action=h}function Mb(u){var h=Xs(),y=Fi;if(y!==null)return wb(h,y,u);Xs(),h=h.memoizedState,y=Xs();var T=y.queue.dispatch;return y.memoizedState=u,[h,T,!1]}function wf(u,h,y,T){return u={tag:u,create:y,deps:T,inst:h,next:null},h=wr.updateQueue,h===null&&(h=cv(),wr.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 dv(){return Xs().memoizedState}function fv(u,h,y,T){var I=Mo();wr.flags|=u,I.memoizedState=wf(1|h,{destroy:void 0},y,T===void 0?null:T)}function hv(u,h,y,T){var I=Xs();T=T===void 0?null:T;var z=I.memoizedState.inst;Fi!==null&&T!==null&&db(T,Fi.memoizedState.deps)?I.memoizedState=wf(h,z,y,T):(wr.flags|=u,I.memoizedState=wf(1|h,z,y,T))}function S3(u,h){fv(8390656,8,u,h)}function Tb(u,h){hv(2048,8,u,h)}function w3(u){wr.flags|=4;var h=wr.updateQueue;if(h===null)h=cv(),wr.updateQueue=h,h.events=[u];else{var y=h.events;y===null?h.events=[u]:y.push(u)}}function M3(u){var h=Xs().memoizedState;return w3({ref:h,nextImpl:u}),function(){if((Vn&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}function T3(u,h){return hv(4,2,u,h)}function C3(u,h){return hv(4,4,u,h)}function E3(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 A3(u,h,y){y=y!=null?y.concat([u]):null,hv(4,4,E3.bind(null,h,u),y)}function Cb(){}function N3(u,h){var y=Xs();h=h===void 0?null:h;var T=y.memoizedState;return h!==null&&db(h,T[1])?T[0]:(y.memoizedState=[u,h],u)}function k3(u,h){var y=Xs();h=h===void 0?null:h;var T=y.memoizedState;if(h!==null&&db(h,T[1]))return T[0];if(T=u(),Lh){je(!0);try{u()}finally{je(!1)}}return y.memoizedState=[T,h],T}function Eb(u,h,y){return y===void 0||(ls&1073741824)!==0&&(Nr&261930)===0?u.memoizedState=h:(u.memoizedState=y,u=Br(),wr.lanes|=u,Bu|=u,y)}function R3(u,h,y,T){return lr(y,h)?y:e0.current!==null?(u=Eb(u,y,T),lr(u,h)||(po=!0),u):(ls&42)===0||(ls&1073741824)!==0&&(Nr&261930)===0?(po=!0,u.memoizedState=y):(u=Br(),wr.lanes|=u,Bu|=u,h)}function P3(u,h,y,T,I){var z=Q.p;Q.p=z!==0&&8>z?z:8;var pe=$.T,Le={};$.T=Le,kb(u,!1,h,y);try{var st=I(),kt=$.S;if(kt!==null&&kt(Le,st),st!==null&&typeof st=="object"&&typeof st.then=="function"){var Gt=ib(st,T);ig(u,h,Gt,Ll(u))}else ig(u,h,T,Ll(u))}catch(Yt){ig(u,h,{then:function(){},status:"rejected",reason:Yt},Ll())}finally{Q.p=z,pe!==null&&Le.types!==null&&(pe.types=Le.types),$.T=pe}}function TE(){}function Ab(u,h,y,T){if(u.tag!==5)throw Error(r(476));var I=D3(u).queue;P3(u,I,h,K,y===null?TE:function(){return I3(u),y(T)})}function D3(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:Id,lastRenderedState:K},next:null};var y={};return h.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Id,lastRenderedState:y},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function I3(u){var h=D3(u);h.next===null&&(h=u.alternate.memoizedState),ig(u,h.next.queue,{},Ll())}function Nb(){return cr(Zb)}function O3(){return Xs().memoizedState}function L3(){return Xs().memoizedState}function CE(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var y=Ll();u=Pd(y);var T=bf(h,u,y);T!==null&&(Ir(T,h,y),_f(T,h,y)),h={cache:tb()},u.payload=h;return}h=h.return}}function EE(u,h,y){var T=Ll();y={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},pv(u)?z3(h,y):(y=Wx(u,h,y,T),y!==null&&(Ir(y,u,T),F3(y,h,T)))}function j3(u,h,y){var T=Ll();ig(u,h,y,T)}function ig(u,h,y,T){var I={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(pv(u))z3(h,I);else{var z=u.alternate;if(u.lanes===0&&(z===null||z.lanes===0)&&(z=h.lastRenderedReducer,z!==null))try{var pe=h.lastRenderedState,Le=z(pe,y);if(I.hasEagerState=!0,I.eagerState=Le,lr(Le,pe))return Bo(u,h,I,0),pr===null&&qm(),!1}catch{}finally{}if(y=Wx(u,h,I,T),y!==null)return Ir(y,u,T),F3(y,h,T),!0}return!1}function kb(u,h,y,T){if(T={lane:2,revertLane:jt(),gesture:null,action:T,hasEagerState:!1,eagerState:null,next:null},pv(u)){if(h)throw Error(r(479))}else h=Wx(u,y,T,2),h!==null&&Ir(h,u,2)}function pv(u){var h=u.alternate;return u===wr||h!==null&&h===wr}function z3(u,h){t0=hc=!0;var y=u.pending;y===null?h.next=h:(h.next=y.next,y.next=h),u.pending=h}function F3(u,h,y){if((y&4194048)!==0){var T=h.lanes;T&=u.pendingLanes,y|=T,h.lanes=y,Rt(u,y)}}var r0={readContext:cr,use:Sf,useCallback:Ts,useContext:Ts,useEffect:Ts,useImperativeHandle:Ts,useLayoutEffect:Ts,useInsertionEffect:Ts,useMemo:Ts,useReducer:Ts,useRef:Ts,useState:Ts,useDebugValue:Ts,useDeferredValue:Ts,useTransition:Ts,useSyncExternalStore:Ts,useId:Ts,useHostTransitionStatus:Ts,useFormState:Ts,useActionState:Ts,useOptimistic:Ts,useMemoCache:Ts,useCacheRefresh:Ts};r0.useEffectEvent=Ts;var U3={readContext:cr,use:Sf,useCallback:function(u,h){return Mo().memoizedState=[u,h===void 0?null:h],u},useContext:cr,useEffect:S3,useImperativeHandle:function(u,h,y){y=y!=null?y.concat([u]):null,fv(4194308,4,E3.bind(null,h,u),y)},useLayoutEffect:function(u,h){return fv(4194308,4,u,h)},useInsertionEffect:function(u,h){fv(4,2,u,h)},useMemo:function(u,h){var y=Mo();h=h===void 0?null:h;var T=u();if(Lh){je(!0);try{u()}finally{je(!1)}}return y.memoizedState=[T,h],T},useReducer:function(u,h,y){var T=Mo();if(y!==void 0){var I=y(h);if(Lh){je(!0);try{y(h)}finally{je(!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=EE.bind(null,wr,u),[T.memoizedState,u]},useRef:function(u){var h=Mo();return u={current:u},h.memoizedState=u},useState:function(u){u=vb(u);var h=u.queue,y=j3.bind(null,wr,h);return h.dispatch=y,[u.memoizedState,y]},useDebugValue:Cb,useDeferredValue:function(u,h){var y=Mo();return Eb(y,u,h)},useTransition:function(){var u=vb(!1);return u=P3.bind(null,wr,u.queue,!0,!1),Mo().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,y){var T=wr,I=Mo();if(Zr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=h(),pr===null)throw Error(r(349));(Nr&127)!==0||d3(T,h,y)}I.memoizedState=y;var z={value:y,getSnapshot:h};return I.queue=z,S3(h3.bind(null,T,z,u),[u]),T.flags|=2048,wf(9,{destroy:void 0},f3.bind(null,T,z,y,h),null),y},useId:function(){var u=Mo(),h=pr.identifierPrefix;if(Zr){var y=$c,T=Ms;y=(T&~(1<<32-Te(T)-1)).toString(32)+y,h="_"+h+"R_"+y,y=av++,0<y&&(h+="H"+y.toString(32)),h+="_"}else y=ub++,h="_"+h+"r_"+y.toString(32)+"_";return u.memoizedState=h},useHostTransitionStatus:Nb,useFormState:Sb,useActionState:Sb,useOptimistic:function(u){var h=Mo();h.memoizedState=h.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=y,h=kb.bind(null,wr,!0,y),y.dispatch=h,[u,h]},useMemoCache:mb,useCacheRefresh:function(){return Mo().memoizedState=CE.bind(null,wr)},useEffectEvent:function(u){var h=Mo(),y={impl:u};return h.memoizedState=y,function(){if((Vn&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},Rb={readContext:cr,use:Sf,useCallback:N3,useContext:cr,useEffect:Tb,useImperativeHandle:A3,useInsertionEffect:T3,useLayoutEffect:C3,useMemo:k3,useReducer:uv,useRef:dv,useState:function(){return uv(Id)},useDebugValue:Cb,useDeferredValue:function(u,h){var y=Xs();return R3(y,Fi.memoizedState,u,h)},useTransition:function(){var u=uv(Id)[0],h=Xs().memoizedState;return[typeof u=="boolean"?u:rg(u),h]},useSyncExternalStore:u3,useId:O3,useHostTransitionStatus:Nb,useFormState:b3,useActionState:b3,useOptimistic:function(u,h){var y=Xs();return yb(y,Fi,u,h)},useMemoCache:mb,useCacheRefresh:L3};Rb.useEffectEvent=M3;var pc={readContext:cr,use:Sf,useCallback:N3,useContext:cr,useEffect:Tb,useImperativeHandle:A3,useInsertionEffect:T3,useLayoutEffect:C3,useMemo:k3,useReducer:xb,useRef:dv,useState:function(){return xb(Id)},useDebugValue:Cb,useDeferredValue:function(u,h){var y=Xs();return Fi===null?Eb(y,u,h):R3(y,Fi.memoizedState,u,h)},useTransition:function(){var u=xb(Id)[0],h=Xs().memoizedState;return[typeof u=="boolean"?u:rg(u),h]},useSyncExternalStore:u3,useId:O3,useHostTransitionStatus:Nb,useFormState:Mb,useActionState:Mb,useOptimistic:function(u,h){var y=Xs();return Fi!==null?yb(y,Fi,u,h):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:mb,useCacheRefresh:L3};pc.useEffectEvent=M3;function mv(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 sg={enqueueSetState:function(u,h,y){u=u._reactInternals;var T=Ll(),I=Pd(T);I.payload=h,y!=null&&(I.callback=y),h=bf(u,I,T),h!==null&&(Ir(h,u,T),_f(h,u,T))},enqueueReplaceState:function(u,h,y){u=u._reactInternals;var T=Ll(),I=Pd(T);I.tag=1,I.payload=h,y!=null&&(I.callback=y),h=bf(u,I,T),h!==null&&(Ir(h,u,T),_f(h,u,T))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var y=Ll(),T=Pd(y);T.tag=2,h!=null&&(T.callback=h),h=bf(u,T,y),h!==null&&(Ir(h,u,y),_f(h,u,y))}};function Pb(u,h,y,T,I,z,pe){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(T,z,pe):h.prototype&&h.prototype.isPureReactComponent?!gr(y,T)||!gr(I,z):!0}function Db(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&&sg.enqueueReplaceState(h,h.state,null)}function Mf(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 B3(u){$m(u)}function Ib(u){console.error(u)}function Ob(u){$m(u)}function gv(u,h){try{var y=u.onUncaughtError;y(h.value,{componentStack:h.stack})}catch(T){setTimeout(function(){throw T})}}function H3(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 Lb(u,h,y){return y=Pd(y),y.tag=3,y.payload={element:null},y.callback=function(){gv(u,h)},y}function jb(u){return u=Pd(u),u.tag=3,u}function V3(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(){H3(h,y,T)}}var pe=y.stateNode;pe!==null&&typeof pe.componentDidCatch=="function"&&(u.callback=function(){H3(h,y,T),typeof I!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var Le=T.stack;this.componentDidCatch(T.value,{componentStack:Le!==null?Le:""})})}function To(u,h,y,T,I){if(y.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){if(h=y.alternate,h!==null&&Du(h,y,I,!0),y=il.current,y!==null){switch(y.tag){case 31:case 13:return ja===null?u0():y.alternate===null&&Cs===0&&(Cs=3),y.flags&=-257,y.flags|=65536,y.lanes=I,T===nv?y.flags|=16384:(h=y.updateQueue,h===null?y.updateQueue=new Set([T]):h.add(T),xg(u,T,I)),!1;case 22:return y.flags|=65536,T===nv?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)),xg(u,T,I)),!1}throw Error(r(435,y.tag))}return xg(u,T,I),u0(),!1}if(Zr)return h=il.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=I,T!==qp&&(u=Error(r(422),{cause:T}),ku(Al(u,y)))):(T!==qp&&(h=Error(r(423),{cause:T}),ku(Al(h,y))),u=u.current.alternate,u.flags|=65536,I&=-I,u.lanes|=I,T=Al(T,y),I=Lb(u.stateNode,T,I),Yn(u,I),Cs!==4&&(Cs=2)),!1;var z=Error(r(520),{cause:T});if(z=Al(z,y),$h===null?$h=[z]:$h.push(z),Cs!==4&&(Cs=2),h===null)return!0;T=Al(T,y),y=h;do{switch(y.tag){case 3:return y.flags|=65536,u=I&-I,y.lanes|=u,u=Lb(y.stateNode,T,u),Yn(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"&&(Zs===null||!Zs.has(z))))return y.flags|=65536,I&=-I,y.lanes|=I,I=jb(I),V3(I,u,y,T),Yn(y,I),!1}y=y.return}while(y!==null);return!1}var xv=Error(r(461)),po=!1;function Ho(u,h,y,T){h.child=u===null?sv(h,null,y,T):Rd(h,u.child,y,T)}function zb(u,h,y,T,I){y=y.render;var z=h.ref;if("ref"in T){var pe={};for(var Le in T)Le!=="ref"&&(pe[Le]=T[Le])}else pe=T;return vf(h),T=lv(u,h,y,pe,z,I),Le=fb(),u!==null&&!po?(hb(u,h,I),Ys(u,h,I)):(Zr&&Le&&Au(h),h.flags|=1,Ho(u,h,T,I),h.child)}function Fh(u,h,y,T,I){if(u===null){var z=y.type;return typeof z=="function"&&!$x(z)&&z.defaultProps===void 0&&y.compare===null?(h.tag=15,h.type=z,vv(u,h,z,T,I)):(u=Cu(y.type,null,T,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(z=u.child,!Mv(u,I)){var pe=z.memoizedProps;if(y=y.compare,y=y!==null?y:gr,y(pe,T)&&u.ref===h.ref)return Ys(u,h,I)}return h.flags|=1,u=tl(z,T),u.ref=h.ref,u.return=h,h.child=u}function vv(u,h,y,T,I){if(u!==null){var z=u.memoizedProps;if(gr(z,T)&&u.ref===h.ref)if(po=!1,h.pendingProps=T=z,Mv(u,I))(u.flags&131072)!==0&&(po=!0);else return h.lanes=u.lanes,Ys(u,h,I)}return i0(u,h,y,T,I)}function Uh(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 ol(u,h,z,y,T)}if((y&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&Km(h,z!==null?z.cachePool:null),z!==null?a3(h,z):lb(),l3(h);else return T=h.lanes=536870912,ol(u,h,z!==null?z.baseLanes|y:y,y,T)}else z!==null?(Km(h,z.cachePool),a3(h,z),sl(),h.memoizedState=null):(u!==null&&Km(h,null),lb(),sl());return Ho(u,h,I,y),h.child}function Ou(u,h){return u!==null&&u.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function ol(u,h,y,T,I){var z=tv();return z=z===null?null:{parent:ho._currentValue,pool:z},h.memoizedState={baseLanes:y,cachePool:z},u!==null&&Km(h,null),lb(),l3(h),u!==null&&Du(u,h,T,!0),h.childLanes=I,null}function yv(u,h){return h=wv({mode:h.mode,children:h.children},u.mode),h.ref=u.ref,u.child=h,h.return=u,h}function G3(u,h,y){return Rd(h,u.child,null,y),u=yv(h,h.pendingProps),u.flags|=2,qs(h),h.memoizedState=null,u}function bv(u,h,y){var T=h.pendingProps,I=(h.flags&128)!==0;if(h.flags&=-129,u===null){if(Zr){if(T.mode==="hidden")return u=yv(h,T),h.lanes=536870912,Ou(null,u);if(cb(h),(u=Xi)?(u=DP(u,Nl),u=u!==null&&u.data==="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:Ed!==null?{id:Ms,overflow:$c}:null,retryLane:536870912,hydrationErrors:null},y=Gp(u),y.return=h,h.child=y,js=h,Xi=null)):u=null,u===null)throw Nu(h);return h.lanes=536870912,null}return yv(h,T)}var z=u.memoizedState;if(z!==null){var pe=z.dehydrated;if(cb(h),I)if(h.flags&256)h.flags&=-257,h=G3(u,h,y);else if(h.memoizedState!==null)h.child=u.child,h.flags|=128,h=null;else throw Error(r(558));else if(po||Du(u,h,y,!1),I=(y&u.childLanes)!==0,po||I){if(T=pr,T!==null&&(pe=St(T,y),pe!==0&&pe!==z.retryLane))throw z.retryLane=pe,Oa(u,pe),Ir(T,u,pe),xv;u0(),h=G3(u,h,y)}else u=z.treeContext,Xi=Gu(pe.nextSibling),js=h,Zr=!0,Ad=null,Nl=!1,u!==null&&Kx(h,u),h=yv(h,T),h.flags|=4096;return h}return u=tl(u.child,{mode:T.mode,children:T.children}),u.ref=h.ref,h.child=u,u.return=h,u}function Bh(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 i0(u,h,y,T,I){return vf(h),y=lv(u,h,y,T,void 0,I),T=fb(),u!==null&&!po?(hb(u,h,I),Ys(u,h,I)):(Zr&&T&&Au(h),h.flags|=1,Ho(u,h,y,I),h.child)}function og(u,h,y,T,I,z){return vf(h),h.updateQueue=null,y=jh(h,T,y,I),c3(u),T=fb(),u!==null&&!po?(hb(u,h,z),Ys(u,h,z)):(Zr&&T&&Au(h),h.flags|=1,Ho(u,h,y,z),h.child)}function _v(u,h,y,T,I){if(vf(h),h.stateNode===null){var z=ff,pe=y.contextType;typeof pe=="object"&&pe!==null&&(z=cr(pe)),z=new y(T,z),h.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,z.updater=sg,h.stateNode=z,z._reactInternals=h,z=h.stateNode,z.props=T,z.state=h.memoizedState,z.refs={},Jm(h),pe=y.contextType,z.context=typeof pe=="object"&&pe!==null?cr(pe):ff,z.state=h.memoizedState,pe=y.getDerivedStateFromProps,typeof pe=="function"&&(mv(h,y,pe,T),z.state=h.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(pe=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),pe!==z.state&&sg.enqueueReplaceState(z,z.state,null),Qp(h,T,z,I),eg(),z.state=h.memoizedState),typeof z.componentDidMount=="function"&&(h.flags|=4194308),T=!0}else if(u===null){z=h.stateNode;var Le=h.memoizedProps,st=Mf(y,Le);z.props=st;var kt=z.context,Gt=y.contextType;pe=ff,typeof Gt=="object"&&Gt!==null&&(pe=cr(Gt));var Yt=y.getDerivedStateFromProps;Gt=typeof Yt=="function"||typeof z.getSnapshotBeforeUpdate=="function",Le=h.pendingProps!==Le,Gt||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Le||kt!==pe)&&Db(h,z,T,pe),La=!1;var It=h.memoizedState;z.state=It,Qp(h,T,z,I),eg(),kt=h.memoizedState,Le||It!==kt||La?(typeof Yt=="function"&&(mv(h,y,Yt,T),kt=h.memoizedState),(st=La||Pb(h,y,st,T,It,kt,pe))?(Gt||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=kt),z.props=T,z.state=kt,z.context=pe,T=st):(typeof z.componentDidMount=="function"&&(h.flags|=4194308),T=!1)}else{z=h.stateNode,ob(u,h),pe=h.memoizedProps,Gt=Mf(y,pe),z.props=Gt,Yt=h.pendingProps,It=z.context,kt=y.contextType,st=ff,typeof kt=="object"&&kt!==null&&(st=cr(kt)),Le=y.getDerivedStateFromProps,(kt=typeof Le=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(pe!==Yt||It!==st)&&Db(h,z,T,st),La=!1,It=h.memoizedState,z.state=It,Qp(h,T,z,I),eg();var Ft=h.memoizedState;pe!==Yt||It!==Ft||La||u!==null&&u.dependencies!==null&&Ym(u.dependencies)?(typeof Le=="function"&&(mv(h,y,Le,T),Ft=h.memoizedState),(Gt=La||Pb(h,y,Gt,T,It,Ft,st)||u!==null&&u.dependencies!==null&&Ym(u.dependencies))?(kt||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"||pe===u.memoizedProps&&It===u.memoizedState||(h.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||pe===u.memoizedProps&&It===u.memoizedState||(h.flags|=1024),h.memoizedProps=T,h.memoizedState=Ft),z.props=T,z.state=Ft,z.context=st,T=Gt):(typeof z.componentDidUpdate!="function"||pe===u.memoizedProps&&It===u.memoizedState||(h.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||pe===u.memoizedProps&&It===u.memoizedState||(h.flags|=1024),T=!1)}return z=T,Bh(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=Rd(h,u.child,null,I),h.child=Rd(h,null,y,I)):Ho(u,h,y,I),h.memoizedState=z.state,u=h.child):u=Ys(u,h,I),u}function W3(u,h,y,T){return gf(),h.flags|=256,Ho(u,h,y,T),h.child}var Fb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _a(u){return{baseLanes:u,cachePool:sb()}}function Sv(u,h,y){return u=u!==null?u.childLanes&~y:0,h&&(u|=Ua),u}function $3(u,h,y){var T=h.pendingProps,I=!1,z=(h.flags&128)!==0,pe;if((pe=z)||(pe=u!==null&&u.memoizedState===null?!1:(Qr.current&2)!==0),pe&&(I=!0,h.flags&=-129),pe=(h.flags&32)!==0,h.flags&=-33,u===null){if(Zr){if(I?Dd(h):sl(),(u=Xi)?(u=DP(u,Nl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:Ed!==null?{id:Ms,overflow:$c}:null,retryLane:536870912,hydrationErrors:null},y=Gp(u),y.return=h,h.child=y,js=h,Xi=null)):u=null,u===null)throw Nu(h);return BE(u)?h.lanes=32:h.lanes=536870912,null}var Le=T.children;return T=T.fallback,I?(sl(),I=h.mode,Le=wv({mode:"hidden",children:Le},I),T=hf(T,I,y,null),Le.return=h,T.return=h,Le.sibling=T,h.child=Le,T=h.child,T.memoizedState=_a(y),T.childLanes=Sv(u,pe,y),h.memoizedState=Fb,Ou(null,T)):(Dd(h),ag(h,Le))}var st=u.memoizedState;if(st!==null&&(Le=st.dehydrated,Le!==null)){if(z)h.flags&256?(Dd(h),h.flags&=-257,h=Ub(u,h,y)):h.memoizedState!==null?(sl(),h.child=u.child,h.flags|=128,h=null):(sl(),Le=T.fallback,I=h.mode,T=wv({mode:"visible",children:T.children},I),Le=hf(Le,I,y,null),Le.flags|=2,T.return=h,Le.return=h,T.sibling=Le,h.child=T,Rd(h,u.child,null,y),T=h.child,T.memoizedState=_a(y),T.childLanes=Sv(u,pe,y),h.memoizedState=Fb,h=Ou(null,T));else if(Dd(h),BE(Le)){if(pe=Le.nextSibling&&Le.nextSibling.dataset,pe)var kt=pe.dgst;pe=kt,T=Error(r(419)),T.stack="",T.digest=pe,ku({value:T,source:null,stack:null}),h=Ub(u,h,y)}else if(po||Du(u,h,y,!1),pe=(y&u.childLanes)!==0,po||pe){if(pe=pr,pe!==null&&(T=St(pe,y),T!==0&&T!==st.retryLane))throw st.retryLane=T,Oa(u,T),Ir(pe,u,T),xv;UE(Le)||u0(),h=Ub(u,h,y)}else UE(Le)?(h.flags|=192,h.child=u.child,h=null):(u=st.treeContext,Xi=Gu(Le.nextSibling),js=h,Zr=!0,Ad=null,Nl=!1,u!==null&&Kx(h,u),h=ag(h,T.children),h.flags|=4096);return h}return I?(sl(),Le=T.fallback,I=h.mode,st=u.child,kt=st.sibling,T=tl(st,{mode:"hidden",children:T.children}),T.subtreeFlags=st.subtreeFlags&65011712,kt!==null?Le=tl(kt,Le):(Le=hf(Le,I,y,null),Le.flags|=2),Le.return=h,T.return=h,T.sibling=Le,h.child=T,Ou(null,T),T=h.child,Le=u.child.memoizedState,Le===null?Le=_a(y):(I=Le.cachePool,I!==null?(st=ho._currentValue,I=I.parent!==st?{parent:st,pool:st}:I):I=sb(),Le={baseLanes:Le.baseLanes|y,cachePool:I}),T.memoizedState=Le,T.childLanes=Sv(u,pe,y),h.memoizedState=Fb,Ou(u.child,T)):(Dd(h),y=u.child,u=y.sibling,y=tl(y,{mode:"visible",children:T.children}),y.return=h,y.sibling=null,u!==null&&(pe=h.deletions,pe===null?(h.deletions=[u],h.flags|=16):pe.push(u)),h.child=y,h.memoizedState=null,y)}function ag(u,h){return h=wv({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function wv(u,h){return u=ws(22,u,null,h),u.lanes=0,u}function Ub(u,h,y){return Rd(h,u.child,null,y),u=ag(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function q3(u,h,y){u.lanes|=h;var T=u.alternate;T!==null&&(T.lanes|=h),Qx(u.return,h,y)}function Hh(u,h,y,T,I,z){var pe=u.memoizedState;pe===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:T,tail:y,tailMode:I,treeForkCount:z}:(pe.isBackwards=h,pe.rendering=null,pe.renderingStartTime=0,pe.last=T,pe.tail=y,pe.tailMode=I,pe.treeForkCount=z)}function al(u,h,y){var T=h.pendingProps,I=T.revealOrder,z=T.tail;T=T.children;var pe=Qr.current,Le=(pe&2)!==0;if(Le?(pe=pe&1|2,h.flags|=128):pe&=1,j(Qr,pe),Ho(u,h,T,y),T=Zr?$p:0,!Le&&u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&q3(u,y,h);else if(u.tag===19)q3(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&&Rl(u)===null&&(I=y),y=y.sibling;y=I,y===null?(I=h.child,h.child=null):(I=y.sibling,y.sibling=null),Hh(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&&Rl(u)===null){h.child=I;break}u=I.sibling,I.sibling=y,y=I,I=u}Hh(h,!0,y,null,z,T);break;case"together":Hh(h,!1,null,null,void 0,T);break;default:h.memoizedState=null}return h.child}function Ys(u,h,y){if(u!==null&&(h.dependencies=u.dependencies),Bu|=h.lanes,(y&h.childLanes)===0)if(u!==null){if(Du(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=tl(u,u.pendingProps),h.child=y,y.return=h;u.sibling!==null;)u=u.sibling,y=y.sibling=tl(u,u.pendingProps),y.return=h;y.sibling=null}return h.child}function Mv(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&Ym(u)))}function AE(u,h,y){switch(h.tag){case 3:ie(h,h.stateNode.containerInfo),Nd(h,ho,u.memoizedState.cache),gf();break;case 27:case 5:de(h);break;case 4:ie(h,h.stateNode.containerInfo);break;case 10:Nd(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,cb(h),null;break;case 13:var T=h.memoizedState;if(T!==null)return T.dehydrated!==null?(Dd(h),h.flags|=128,null):(y&h.child.childLanes)!==0?$3(u,h,y):(Dd(h),u=Ys(u,h,y),u!==null?u.sibling:null);Dd(h);break;case 19:var I=(u.flags&128)!==0;if(T=(y&h.childLanes)!==0,T||(Du(u,h,y,!1),T=(y&h.childLanes)!==0),I){if(T)return al(u,h,y);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),j(Qr,Qr.current),T)break;return null;case 22:return h.lanes=0,Uh(u,h,y,h.pendingProps);case 24:Nd(h,ho,u.memoizedState.cache)}return Ys(u,h,y)}function Tv(u,h,y){if(u!==null)if(u.memoizedProps!==h.pendingProps)po=!0;else{if(!Mv(u,y)&&(h.flags&128)===0)return po=!1,AE(u,h,y);po=(u.flags&131072)!==0}else po=!1,Zr&&(h.flags&1048576)!==0&&e3(h,$p,h.index);switch(h.lanes=0,h.tag){case 16:e:{var T=h.pendingProps;if(u=Rh(h.elementType),h.type=u,typeof u=="function")$x(u)?(T=Mf(u,T),h.tag=1,h=_v(null,h,u,T,y)):(h.tag=0,h=i0(null,h,u,T,y));else{if(u!=null){var I=u.$$typeof;if(I===N){h.tag=11,h=zb(null,h,u,T,y);break e}else if(I===L){h.tag=14,h=Fh(null,h,u,T,y);break e}}throw h=q(u)||u,Error(r(306,h,""))}}return h;case 0:return i0(u,h,h.type,h.pendingProps,y);case 1:return T=h.type,I=Mf(T,h.pendingProps),_v(u,h,T,I,y);case 3:e:{if(ie(h,h.stateNode.containerInfo),u===null)throw Error(r(387));T=h.pendingProps;var z=h.memoizedState;I=z.element,ob(u,h),Qp(h,T,null,y);var pe=h.memoizedState;if(T=pe.cache,Nd(h,ho,T),T!==z.cache&&Jx(h,[ho],y,!0),eg(),T=pe.element,z.isDehydrated)if(z={element:T,isDehydrated:!1,cache:pe.cache},h.updateQueue.baseState=z,h.memoizedState=z,h.flags&256){h=W3(u,h,T,y);break e}else if(T!==I){I=Al(Error(r(424)),h),ku(I),h=W3(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=Gu(u.firstChild),js=h,Zr=!0,Ad=null,Nl=!0,y=sv(h,null,T,y),h.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(gf(),T===I){h=Ys(u,h,y);break e}Ho(u,h,T,y)}h=h.child}return h;case 26:return Bh(u,h),u===null?(y=FP(h.type,null,h.pendingProps,null))?h.memoizedState=y:Zr||(y=h.type,u=h.pendingProps,T=Z3(J.current).createElement(y),T[Tt]=h,T[Bt]=u,Ha(T,y,u),nt(T),h.stateNode=T):h.memoizedState=FP(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return de(h),u===null&&Zr&&(T=h.stateNode=LP(h.type,h.pendingProps,J.current),js=h,Nl=!0,I=Xi,p0(h.type)?(HE=I,Xi=Gu(T.firstChild)):Xi=I),Ho(u,h,h.pendingProps.children,y),Bh(u,h),u===null&&(h.flags|=4194304),h.child;case 5:return u===null&&Zr&&((I=T=Xi)&&(T=dQ(T,h.type,h.pendingProps,Nl),T!==null?(h.stateNode=T,js=h,Xi=Gu(T.firstChild),Nl=!1,I=!0):I=!1),I||Nu(h)),de(h),I=h.type,z=h.pendingProps,pe=u!==null?u.memoizedProps:null,T=z.children,jE(I,z)?T=null:pe!==null&&jE(I,pe)&&(h.flags|=32),h.memoizedState!==null&&(I=lv(u,h,zh,null,null,y),Zb._currentValue=I),Bh(u,h),Ho(u,h,T,y),h.child;case 6:return u===null&&Zr&&((u=y=Xi)&&(y=fQ(y,h.pendingProps,Nl),y!==null?(h.stateNode=y,js=h,Xi=null,u=!0):u=!1),u||Nu(h)),null;case 13:return $3(u,h,y);case 4:return ie(h,h.stateNode.containerInfo),T=h.pendingProps,u===null?h.child=Rd(h,null,T,y):Ho(u,h,T,y),h.child;case 11:return zb(u,h,h.type,h.pendingProps,y);case 7:return Ho(u,h,h.pendingProps,y),h.child;case 8:return Ho(u,h,h.pendingProps.children,y),h.child;case 12:return Ho(u,h,h.pendingProps.children,y),h.child;case 10:return T=h.pendingProps,Nd(h,h.type,T.value),Ho(u,h,T.children,y),h.child;case 9:return I=h.type._context,T=h.pendingProps.children,vf(h),I=cr(I),T=T(I),h.flags|=1,Ho(u,h,T,y),h.child;case 14:return Fh(u,h,h.type,h.pendingProps,y);case 15:return vv(u,h,h.type,h.pendingProps,y);case 19:return al(u,h,y);case 31:return bv(u,h,y);case 22:return Uh(u,h,y,h.pendingProps);case 24:return vf(h),T=cr(ho),u===null?(I=tv(),I===null&&(I=pr,z=tb(),I.pooledCache=z,z.refCount++,z!==null&&(I.pooledCacheLanes|=y),I=z),h.memoizedState={parent:T,cache:I},Jm(h),Nd(h,ho,I)):((u.lanes&y)!==0&&(ob(u,h),Qp(h,null,null,y),eg()),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),Nd(h,ho,T)):(T=z.cache,Nd(h,ho,T),T!==I.cache&&Jx(h,[ho],y,!0))),Ho(u,h,h.pendingProps.children,y),h.child;case 29:throw h.pendingProps}throw Error(r(156,h.tag))}function Lu(u){u.flags|=4}function lg(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(As())u.flags|=8192;else throw Iu=nv,Zm}else u.flags&=-16777217}function Bb(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!GP(h))if(As())u.flags|=8192;else throw Iu=nv,Zm}function Od(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?Ie():536870912,u.lanes|=h,es|=h)}function ju(u,h){if(!Zr)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 Ui(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 cg(u,h,y){var T=h.pendingProps;switch(Yx(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ui(h),null;case 1:return Ui(h),null;case 3:return y=h.stateNode,T=null,u!==null&&(T=u.memoizedState.cache),h.memoizedState.cache!==T&&(h.flags|=2048),Pu(ho),oe(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(Xp(h)?Lu(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Zx())),Ui(h),null;case 26:var I=h.type,z=h.memoizedState;return u===null?(Lu(h),z!==null?(Ui(h),Bb(h,z)):(Ui(h),lg(h,I,null,T,y))):z?z!==u.memoizedState?(Lu(h),Ui(h),Bb(h,z)):(Ui(h),h.flags&=-16777217):(u=u.memoizedProps,u!==T&&Lu(h),Ui(h),lg(h,I,u,T,y)),null;case 27:if(ye(h),y=J.current,I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Lu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Ui(h),null}u=le.current,Xp(h)?t3(h):(u=LP(I,T,y),h.stateNode=u,Lu(h))}return Ui(h),null;case 5:if(ye(h),I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Lu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Ui(h),null}if(z=le.current,Xp(h))t3(h);else{var pe=Z3(J.current);switch(z){case 1:z=pe.createElementNS("http://www.w3.org/2000/svg",I);break;case 2:z=pe.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;default:switch(I){case"svg":z=pe.createElementNS("http://www.w3.org/2000/svg",I);break;case"math":z=pe.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;case"script":z=pe.createElement("div"),z.innerHTML="<script><\/script>",z=z.removeChild(z.firstChild);break;case"select":z=typeof T.is=="string"?pe.createElement("select",{is:T.is}):pe.createElement("select"),T.multiple?z.multiple=!0:T.size&&(z.size=T.size);break;default:z=typeof T.is=="string"?pe.createElement(I,{is:T.is}):pe.createElement(I)}}z[Tt]=h,z[Bt]=T;e:for(pe=h.child;pe!==null;){if(pe.tag===5||pe.tag===6)z.appendChild(pe.stateNode);else if(pe.tag!==4&&pe.tag!==27&&pe.child!==null){pe.child.return=pe,pe=pe.child;continue}if(pe===h)break e;for(;pe.sibling===null;){if(pe.return===null||pe.return===h)break e;pe=pe.return}pe.sibling.return=pe.return,pe=pe.sibling}h.stateNode=z;e:switch(Ha(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&&Lu(h)}}return Ui(h),lg(h,h.type,u===null?null:u.memoizedProps,h.pendingProps,y),null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==T&&Lu(h);else{if(typeof T!="string"&&h.stateNode===null)throw Error(r(166));if(u=J.current,Xp(h)){if(u=h.stateNode,y=h.memoizedProps,T=null,I=js,I!==null)switch(I.tag){case 27:case 5:T=I.memoizedProps}u[Tt]=h,u=!!(u.nodeValue===y||T!==null&&T.suppressHydrationWarning===!0||TP(u.nodeValue,y)),u||Nu(h,!0)}else u=Z3(u).createTextNode(T),u[Tt]=h,h.stateNode=u}return Ui(h),null;case 31:if(y=h.memoizedState,u===null||u.memoizedState!==null){if(T=Xp(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[Tt]=h}else gf(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ui(h),u=!1}else y=Zx(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return h.flags&256?(qs(h),h):(qs(h),null);if((h.flags&128)!==0)throw Error(r(558))}return Ui(h),null;case 13:if(T=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(I=Xp(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[Tt]=h}else gf(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ui(h),I=!1}else I=Zx(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=I),I=!0;if(!I)return h.flags&256?(qs(h),h):(qs(h),null)}return qs(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),Od(h,h.updateQueue),Ui(h),null);case 4:return oe(),u===null&&PE(h.stateNode.containerInfo),Ui(h),null;case 10:return Pu(h.type),Ui(h),null;case 19:if(X(Qr),T=h.memoizedState,T===null)return Ui(h),null;if(I=(h.flags&128)!==0,z=T.rendering,z===null)if(I)ju(T,!1);else{if(Cs!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(z=Rl(u),z!==null){for(h.flags|=128,ju(T,!1),u=z.updateQueue,h.updateQueue=u,Od(h,u),h.subtreeFlags=0,u=y,y=h.child;y!==null;)Vp(y,u),y=y.sibling;return j(Qr,Qr.current&1|2),Zr&&Eu(h,T.treeForkCount),h.child}u=u.sibling}T.tail!==null&&Z()>Ks&&(h.flags|=128,I=!0,ju(T,!1),h.lanes=4194304)}else{if(!I)if(u=Rl(z),u!==null){if(h.flags|=128,I=!0,u=u.updateQueue,h.updateQueue=u,Od(h,u),ju(T,!0),T.tail===null&&T.tailMode==="hidden"&&!z.alternate&&!Zr)return Ui(h),null}else 2*Z()-T.renderingStartTime>Ks&&y!==536870912&&(h.flags|=128,I=!0,ju(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=Z(),u.sibling=null,y=Qr.current,j(Qr,I?y&1|2:y&1),Zr&&Eu(h,T.treeForkCount),u):(Ui(h),null);case 22:case 23:return qs(h),tg(),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&&(Ui(h),h.subtreeFlags&6&&(h.flags|=8192)):Ui(h),y=h.updateQueue,y!==null&&Od(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&&X(yf),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),h.memoizedState.cache!==y&&(h.flags|=2048),Pu(ho),Ui(h),null;case 25:return null;case 30:return null}throw Error(r(156,h.tag))}function mc(u,h){switch(Yx(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return Pu(ho),oe(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return ye(h),null;case 31:if(h.memoizedState!==null){if(qs(h),h.alternate===null)throw Error(r(340));gf()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 13:if(qs(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(r(340));gf()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return X(Qr),null;case 4:return oe(),null;case 10:return Pu(h.type),null;case 22:case 23:return qs(h),tg(),u!==null&&X(yf),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return Pu(ho),null;case 25:return null;default:return null}}function Pl(u,h){switch(Yx(h),h.tag){case 3:Pu(ho),oe();break;case 26:case 27:case 5:ye(h);break;case 4:oe();break;case 31:h.memoizedState!==null&&qs(h);break;case 13:qs(h);break;case 19:X(Qr);break;case 10:Pu(h.type);break;case 22:case 23:qs(h),tg(),u!==null&&X(yf);break;case 24:Pu(ho)}}function gc(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,pe=y.inst;T=z(),pe.destroy=T}y=y.next}while(y!==I)}}catch(Le){ui(h,h.return,Le)}}function ia(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 pe=T.inst,Le=pe.destroy;if(Le!==void 0){pe.destroy=void 0,I=h;var st=y,kt=Le;try{kt()}catch(Gt){ui(I,st,Gt)}}}T=T.next}while(T!==z)}}catch(Gt){ui(h,h.return,Gt)}}function qc(u){var h=u.updateQueue;if(h!==null){var y=u.stateNode;try{o3(h,y)}catch(T){ui(u,u.return,T)}}}function Vo(u,h,y){y.props=Mf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(T){ui(u,h,T)}}function Ld(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){ui(u,h,I)}}function sa(u,h){var y=u.ref,T=u.refCleanup;if(y!==null)if(typeof T=="function")try{T()}catch(I){ui(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){ui(u,h,I)}else y.current=null}function ug(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){ui(u,u.return,I)}}function Co(u,h,y){try{var T=u.stateNode;sQ(T,u.type,y,h),T[Bt]=h}catch(I){ui(u,u.return,I)}}function cs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&p0(u.type)||u.tag===4}function qr(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&&p0(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 zu(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=Ds));else if(T!==4&&(T===27&&p0(u.type)&&(y=u.stateNode,h=null),u=u.child,u!==null))for(zu(u,h,y),u=u.sibling;u!==null;)zu(u,h,y),u=u.sibling}function za(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&&p0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(za(u,h,y),u=u.sibling;u!==null;)za(u,h,y),u=u.sibling}function Cv(u){var h=u.stateNode,y=u.memoizedProps;try{for(var T=u.type,I=h.attributes;I.length;)h.removeAttributeNode(I[0]);Ha(h,T,y),h[Tt]=u,h[Bt]=y}catch(z){ui(u,u.return,z)}}var xc=!1,Yi=!1,Xc=!1,X3=typeof WeakSet=="function"?WeakSet:Set,Go=null;function NE(u,h){if(u=u.containerInfo,OE=i4,u=Ji(u),Os(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 pe=0,Le=-1,st=-1,kt=0,Gt=0,Yt=u,It=null;t:for(;;){for(var Ft;Yt!==y||I!==0&&Yt.nodeType!==3||(Le=pe+I),Yt!==z||T!==0&&Yt.nodeType!==3||(st=pe+T),Yt.nodeType===3&&(pe+=Yt.nodeValue.length),(Ft=Yt.firstChild)!==null;)It=Yt,Yt=Ft;for(;;){if(Yt===u)break t;if(It===y&&++kt===I&&(Le=pe),It===z&&++Gt===T&&(st=pe),(Ft=Yt.nextSibling)!==null)break;Yt=It,It=Yt.parentNode}Yt=Ft}y=Le===-1||st===-1?null:{start:Le,end:st}}else y=null}y=y||{start:0,end:0}}else y=null;for(LE={focusedElem:u,selectionRange:y},i4=!1,Go=h;Go!==null;)if(h=Go,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Go=u;else for(;Go!==null;){switch(h=Go,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 jn=Mf(y.type,I);u=T.getSnapshotBeforeUpdate(jn,z),T.__reactInternalSnapshotBeforeUpdate=u}catch(or){ui(y,y.return,or)}}break;case 3:if((u&1024)!==0){if(u=h.stateNode.containerInfo,y=u.nodeType,y===9)FE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":FE(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,Go=u;break}Go=h.return}}function us(u,h,y){var T=y.flags;switch(y.tag){case 0:case 11:case 15:bc(u,y),T&4&&gc(5,y);break;case 1:if(bc(u,y),T&4)if(u=y.stateNode,h===null)try{u.componentDidMount()}catch(pe){ui(y,y.return,pe)}else{var I=Mf(y.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(I,h,u.__reactInternalSnapshotBeforeUpdate)}catch(pe){ui(y,y.return,pe)}}T&64&&qc(y),T&512&&Ld(y,y.return);break;case 3:if(bc(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{o3(u,h)}catch(pe){ui(y,y.return,pe)}}break;case 27:h===null&&T&4&&Cv(y);case 26:case 5:bc(u,y),h===null&&T&4&&ug(y),T&512&&Ld(y,y.return);break;case 12:bc(u,y);break;case 31:bc(u,y),T&4&&Tf(u,y);break;case 13:bc(u,y),T&4&&s0(u,y),T&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=E.bind(null,y),hQ(u,y))));break;case 22:if(T=y.memoizedState!==null||xc,!T){h=h!==null&&h.memoizedState!==null||Yi,I=xc;var z=Yi;xc=T,(Yi=h)&&!z?Fa(u,y,(y.subtreeFlags&8772)!==0):bc(u,y),xc=I,Yi=z}break;case 30:break;default:bc(u,y)}}function dg(u){var h=u.alternate;h!==null&&(u.alternate=null,dg(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&Zt(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 Ai=null,Sa=!1;function vc(u,h,y){for(y=y.child;y!==null;)Ev(u,h,y),y=y.sibling}function Ev(u,h,y){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount(Fe,y)}catch{}switch(y.tag){case 26:Yi||sa(y,h),vc(u,h,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Yi||sa(y,h);var T=Ai,I=Sa;p0(y.type)&&(Ai=y.stateNode,Sa=!1),vc(u,h,y),Xb(y.stateNode),Ai=T,Sa=I;break;case 5:Yi||sa(y,h);case 6:if(T=Ai,I=Sa,Ai=null,vc(u,h,y),Ai=T,Sa=I,Ai!==null)if(Sa)try{(Ai.nodeType===9?Ai.body:Ai.nodeName==="HTML"?Ai.ownerDocument.body:Ai).removeChild(y.stateNode)}catch(z){ui(y,h,z)}else try{Ai.removeChild(y.stateNode)}catch(z){ui(y,h,z)}break;case 18:Ai!==null&&(Sa?(u=Ai,RP(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),Ov(u)):RP(Ai,y.stateNode));break;case 4:T=Ai,I=Sa,Ai=y.stateNode.containerInfo,Sa=!0,vc(u,h,y),Ai=T,Sa=I;break;case 0:case 11:case 14:case 15:ia(2,y,h),Yi||ia(4,y,h),vc(u,h,y);break;case 1:Yi||(sa(y,h),T=y.stateNode,typeof T.componentWillUnmount=="function"&&Vo(y,h,T)),vc(u,h,y);break;case 21:vc(u,h,y);break;case 22:Yi=(T=Yi)||y.memoizedState!==null,vc(u,h,y),Yi=T;break;default:vc(u,h,y)}}function Tf(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{Ov(u)}catch(y){ui(h,h.return,y)}}}function s0(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Ov(u)}catch(y){ui(h,h.return,y)}}function Hb(u){switch(u.tag){case 31:case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new X3),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new X3),h;default:throw Error(r(435,u.tag))}}function jd(u,h){var y=Hb(u);h.forEach(function(T){if(!y.has(T)){y.add(T);var I=P.bind(null,u,T);T.then(I,I)}})}function Eo(u,h){var y=h.deletions;if(y!==null)for(var T=0;T<y.length;T++){var I=y[T],z=u,pe=h,Le=pe;e:for(;Le!==null;){switch(Le.tag){case 27:if(p0(Le.type)){Ai=Le.stateNode,Sa=!1;break e}break;case 5:Ai=Le.stateNode,Sa=!1;break e;case 3:case 4:Ai=Le.stateNode.containerInfo,Sa=!0;break e}Le=Le.return}if(Ai===null)throw Error(r(160));Ev(z,pe,I),Ai=null,Sa=!1,z=I.alternate,z!==null&&(z.return=null),I.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)Cf(h,u),h=h.sibling}var yc=null;function Cf(u,h){var y=u.alternate,T=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Eo(h,u),Ao(u),T&4&&(ia(3,u,u.return),gc(3,u),ia(5,u,u.return));break;case 1:Eo(h,u),Ao(u),T&512&&(Yi||y===null||sa(y,y.return)),T&64&&xc&&(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=yc;if(Eo(h,u),Ao(u),T&512&&(Yi||y===null||sa(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[wt]||z[Tt]||z.namespaceURI==="http://www.w3.org/2000/svg"||z.hasAttribute("itemprop"))&&(z=I.createElement(T),I.head.insertBefore(z,I.querySelector("head > title"))),Ha(z,T,y),z[Tt]=u,nt(z),T=z;break e;case"link":var pe=HP("link","href",I).get(T+(y.href||""));if(pe){for(var Le=0;Le<pe.length;Le++)if(z=pe[Le],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)){pe.splice(Le,1);break t}}z=I.createElement(T),Ha(z,T,y),I.head.appendChild(z);break;case"meta":if(pe=HP("meta","content",I).get(T+(y.content||""))){for(Le=0;Le<pe.length;Le++)if(z=pe[Le],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)){pe.splice(Le,1);break t}}z=I.createElement(T),Ha(z,T,y),I.head.appendChild(z);break;default:throw Error(r(468,T))}z[Tt]=u,nt(z),T=z}u.stateNode=T}else VP(I,u.type,u.stateNode);else u.stateNode=BP(I,T,u.memoizedProps);else z!==T?(z===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):z.count--,T===null?VP(I,u.type,u.stateNode):BP(I,T,u.memoizedProps)):T===null&&u.stateNode!==null&&Co(u,u.memoizedProps,y.memoizedProps)}break;case 27:Eo(h,u),Ao(u),T&512&&(Yi||y===null||sa(y,y.return)),y!==null&&T&4&&Co(u,u.memoizedProps,y.memoizedProps);break;case 5:if(Eo(h,u),Ao(u),T&512&&(Yi||y===null||sa(y,y.return)),u.flags&32){I=u.stateNode;try{Ps(I,"")}catch(jn){ui(u,u.return,jn)}}T&4&&u.stateNode!=null&&(I=u.memoizedProps,Co(u,I,y!==null?y.memoizedProps:I)),T&1024&&(Xc=!0);break;case 6:if(Eo(h,u),Ao(u),T&4){if(u.stateNode===null)throw Error(r(162));T=u.memoizedProps,y=u.stateNode;try{y.nodeValue=T}catch(jn){ui(u,u.return,jn)}}break;case 3:if(e4=null,I=yc,yc=Q3(h.containerInfo),Eo(h,u),yc=I,Ao(u),T&4&&y!==null&&y.memoizedState.isDehydrated)try{Ov(h.containerInfo)}catch(jn){ui(u,u.return,jn)}Xc&&(Xc=!1,Av(u));break;case 4:T=yc,yc=Q3(u.stateNode.containerInfo),Eo(h,u),Ao(u),yc=T;break;case 12:Eo(h,u),Ao(u);break;case 31:Eo(h,u),Ao(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,jd(u,T)));break;case 13:Eo(h,u),Ao(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(o0=Z()),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,jd(u,T)));break;case 22:I=u.memoizedState!==null;var st=y!==null&&y.memoizedState!==null,kt=xc,Gt=Yi;if(xc=kt||I,Yi=Gt||st,Eo(h,u),Yi=Gt,xc=kt,Ao(u),T&8192)e:for(h=u.stateNode,h._visibility=I?h._visibility&-2:h._visibility|1,I&&(y===null||st||xc||Yi||Fu(u)),y=null,h=u;;){if(h.tag===5||h.tag===26){if(y===null){st=y=h;try{if(z=st.stateNode,I)pe=z.style,typeof pe.setProperty=="function"?pe.setProperty("display","none","important"):pe.display="none";else{Le=st.stateNode;var Yt=st.memoizedProps.style,It=Yt!=null&&Yt.hasOwnProperty("display")?Yt.display:null;Le.style.display=It==null||typeof It=="boolean"?"":(""+It).trim()}}catch(jn){ui(st,st.return,jn)}}}else if(h.tag===6){if(y===null){st=h;try{st.stateNode.nodeValue=I?"":st.memoizedProps}catch(jn){ui(st,st.return,jn)}}}else if(h.tag===18){if(y===null){st=h;try{var Ft=st.stateNode;I?PP(Ft,!0):PP(st.stateNode,!1)}catch(jn){ui(st,st.return,jn)}}}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,jd(u,y))));break;case 19:Eo(h,u),Ao(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,jd(u,T)));break;case 30:break;case 21:break;default:Eo(h,u),Ao(u)}}function Ao(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=qr(u);za(u,z,I);break;case 5:var pe=y.stateNode;y.flags&32&&(Ps(pe,""),y.flags&=-33);var Le=qr(u);za(u,Le,pe);break;case 3:case 4:var st=y.stateNode.containerInfo,kt=qr(u);zu(u,kt,st);break;default:throw Error(r(161))}}catch(Gt){ui(u,u.return,Gt)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function Av(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;Av(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function bc(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)us(u,h.alternate,h),h=h.sibling}function Fu(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:ia(4,h,h.return),Fu(h);break;case 1:sa(h,h.return);var y=h.stateNode;typeof y.componentWillUnmount=="function"&&Vo(h,h.return,y),Fu(h);break;case 27:Xb(h.stateNode);case 26:case 5:sa(h,h.return),Fu(h);break;case 22:h.memoizedState===null&&Fu(h);break;case 30:Fu(h);break;default:Fu(h)}u=u.sibling}}function Fa(u,h,y){for(y=y&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var T=h.alternate,I=u,z=h,pe=z.flags;switch(z.tag){case 0:case 11:case 15:Fa(I,z,y),gc(4,z);break;case 1:if(Fa(I,z,y),T=z,I=T.stateNode,typeof I.componentDidMount=="function")try{I.componentDidMount()}catch(kt){ui(T,T.return,kt)}if(T=z,I=T.updateQueue,I!==null){var Le=T.stateNode;try{var st=I.shared.hiddenCallbacks;if(st!==null)for(I.shared.hiddenCallbacks=null,I=0;I<st.length;I++)Jp(st[I],Le)}catch(kt){ui(T,T.return,kt)}}y&&pe&64&&qc(z),Ld(z,z.return);break;case 27:Cv(z);case 26:case 5:Fa(I,z,y),y&&T===null&&pe&4&&ug(z),Ld(z,z.return);break;case 12:Fa(I,z,y);break;case 31:Fa(I,z,y),y&&pe&4&&Tf(I,z);break;case 13:Fa(I,z,y),y&&pe&4&&s0(I,z);break;case 22:z.memoizedState===null&&Fa(I,z,y),Ld(z,z.return);break;case 30:break;default:Fa(I,z,y)}h=h.sibling}}function Ef(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&&Nh(y))}function Vh(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Nh(u))}function oa(u,h,y,T){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)Vb(u,h,y,T),h=h.sibling}function Vb(u,h,y,T){var I=h.flags;switch(h.tag){case 0:case 11:case 15:oa(u,h,y,T),I&2048&&gc(9,h);break;case 1:oa(u,h,y,T);break;case 3:oa(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&&Nh(u)));break;case 12:if(I&2048){oa(u,h,y,T),u=h.stateNode;try{var z=h.memoizedProps,pe=z.id,Le=z.onPostCommit;typeof Le=="function"&&Le(pe,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(st){ui(h,h.return,st)}}else oa(u,h,y,T);break;case 31:oa(u,h,y,T);break;case 13:oa(u,h,y,T);break;case 23:break;case 22:z=h.stateNode,pe=h.alternate,h.memoizedState!==null?z._visibility&2?oa(u,h,y,T):Uu(u,h):z._visibility&2?oa(u,h,y,T):(z._visibility|=2,aa(u,h,y,T,(h.subtreeFlags&10256)!==0||!1)),I&2048&&Ef(pe,h);break;case 24:oa(u,h,y,T),I&2048&&Vh(h.alternate,h);break;default:oa(u,h,y,T)}}function aa(u,h,y,T,I){for(I=I&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var z=u,pe=h,Le=y,st=T,kt=pe.flags;switch(pe.tag){case 0:case 11:case 15:aa(z,pe,Le,st,I),gc(8,pe);break;case 23:break;case 22:var Gt=pe.stateNode;pe.memoizedState!==null?Gt._visibility&2?aa(z,pe,Le,st,I):Uu(z,pe):(Gt._visibility|=2,aa(z,pe,Le,st,I)),I&&kt&2048&&Ef(pe.alternate,pe);break;case 24:aa(z,pe,Le,st,I),I&&kt&2048&&Vh(pe.alternate,pe);break;default:aa(z,pe,Le,st,I)}h=h.sibling}}function Uu(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:Uu(y,T),I&2048&&Ef(T.alternate,T);break;case 24:Uu(y,T),I&2048&&Vh(T.alternate,T);break;default:Uu(y,T)}h=h.sibling}}var Gh=8192;function Dl(u,h,y){if(u.subtreeFlags&Gh)for(u=u.child;u!==null;)Nv(u,h,y),u=u.sibling}function Nv(u,h,y){switch(u.tag){case 26:Dl(u,h,y),u.flags&Gh&&u.memoizedState!==null&&TQ(y,yc,u.memoizedState,u.memoizedProps);break;case 5:Dl(u,h,y);break;case 3:case 4:var T=yc;yc=Q3(u.stateNode.containerInfo),Dl(u,h,y),yc=T;break;case 22:u.memoizedState===null&&(T=u.alternate,T!==null&&T.memoizedState!==null?(T=Gh,Gh=16777216,Dl(u,h,y),Gh=T):Dl(u,h,y));break;default:Dl(u,h,y)}}function Wh(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 Af(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];Go=T,zs(T,u)}Wh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)ll(u),u=u.sibling}function ll(u){switch(u.tag){case 0:case 11:case 15:Af(u),u.flags&2048&&ia(9,u,u.return);break;case 3:Af(u);break;case 12:Af(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&2&&(u.return===null||u.return.tag!==13)?(h._visibility&=-3,cl(u)):Af(u);break;default:Af(u)}}function cl(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];Go=T,zs(T,u)}Wh(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:ia(8,h,h.return),cl(h);break;case 22:y=h.stateNode,y._visibility&2&&(y._visibility&=-3,cl(h));break;default:cl(h)}u=u.sibling}}function zs(u,h){for(;Go!==null;){var y=Go;switch(y.tag){case 0:case 11:case 15:ia(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:Nh(y.memoizedState.cache)}if(T=y.child,T!==null)T.return=y,Go=T;else e:for(y=u;Go!==null;){T=Go;var I=T.sibling,z=T.return;if(dg(T),T===y){Go=null;break e}if(I!==null){I.return=z,Go=I;break e}Go=z}}}var zd={getCacheForType:function(u){var h=cr(ho),y=h.data.get(u);return y===void 0&&(y=u(),h.data.set(u,y)),y},cacheSignal:function(){return cr(ho).controller.signal}},Mr=typeof WeakMap=="function"?WeakMap:Map,Vn=0,pr=null,Dr=null,Nr=0,ei=0,wa=null,_c=!1,Yc=!1,Gb=!1,Il=0,Cs=0,Bu=0,Nf=0,fg=0,Ua=0,es=0,$h=null,Fs=null,Us=!1,o0=0,Wb=0,Ks=1/0,Es=null,Zs=null,Ni=0,Ol=null,a0=null,Sc=0,l0=0,c0=null,hg=null,kf=0,qh=null;function Ll(){return(Vn&2)!==0&&Nr!==0?Nr&-Nr:$.T!==null?jt():Ut()}function Br(){if(Ua===0)if((Nr&536870912)===0||Zr){var u=ct;ct<<=1,(ct&3932160)===0&&(ct=262144),Ua=u}else Ua=536870912;return u=il.current,u!==null&&(u.flags|=32),Ua}function Ir(u,h,y){(u===pr&&(ei===2||ei===9)||u.cancelPendingCommit!==null)&&(Pf(u,0),mo(u,Nr,Ua,!1)),rt(u,y),((Vn&2)===0||u!==pr)&&(u===pr&&((Vn&2)===0&&(Nf|=y),Cs===4&&mo(u,Nr,Ua,!1)),on(u))}function Hr(u,h,y){if((Vn&6)!==0)throw Error(r(327));var T=!y&&(h&127)===0&&(h&u.expiredLanes)===0||Ee(u,h),I=T?pg(u,h):Ba(u,h,!0),z=T;do{if(I===0){Yc&&!T&&mo(u,h,0,!1);break}else{if(y=u.current.alternate,z&&!ki(y)){I=Ba(u,h,!1),z=!1;continue}if(I===2){if(z=h,u.errorRecoveryDisabledLanes&z)var pe=0;else pe=u.pendingLanes&-536870913,pe=pe!==0?pe:pe&536870912?536870912:0;if(pe!==0){h=pe;e:{var Le=u;I=$h;var st=Le.current.memoizedState.isDehydrated;if(st&&(Pf(Le,pe).flags|=256),pe=Ba(Le,pe,!1),pe!==2){if(Gb&&!st){Le.errorRecoveryDisabledLanes|=z,Nf|=z,I=4;break e}z=Fs,Fs=I,z!==null&&(Fs===null?Fs=z:Fs.push.apply(Fs,z))}I=pe}if(z=!1,I!==2)continue}}if(I===1){Pf(u,0),mo(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:mo(T,h,Ua,!_c);break e;case 2:Fs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((h&62914560)===h&&(I=o0+300-Z(),10<I)){if(mo(T,h,Ua,!_c),Je(T,0,!0)!==0)break e;Sc=h,T.timeoutHandle=NP(Xr.bind(null,T,y,Fs,Es,Us,h,Ua,Nf,es,_c,z,"Throttled",-0,0),I);break e}Xr(T,y,Fs,Es,Us,h,Ua,Nf,es,_c,z,null,-0,0)}}break}while(!0);on(u)}function Xr(u,h,y,T,I,z,pe,Le,st,kt,Gt,Yt,It,Ft){if(u.timeoutHandle=-1,Yt=h.subtreeFlags,Yt&8192||(Yt&16785408)===16785408){Yt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ds},Nv(h,z,Yt);var jn=(z&62914560)===z?o0-Z():(z&4194048)===z?Wb-Z():0;if(jn=CQ(Yt,jn),jn!==null){Sc=z,u.cancelPendingCommit=jn(Ud.bind(null,u,h,z,y,T,I,pe,Le,st,Gt,Yt,null,It,Ft)),mo(u,z,pe,!kt);return}}Ud(u,h,z,y,T,I,pe,Le,st)}function ki(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(!lr(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 mo(u,h,y,T){h&=~fg,h&=~Nf,u.suspendedLanes|=h,u.pingedLanes&=~h,T&&(u.warmLanes|=h),T=u.expirationTimes;for(var I=h;0<I;){var z=31-Te(I),pe=1<<z;T[z]=-1,I&=~pe}y!==0&&Dt(u,y,h)}function Kc(){return(Vn&6)===0?(kn(0),!1):!0}function Rf(){if(Dr!==null){if(ei===0)var u=Dr.return;else u=Dr,Ru=xf=null,pb(u),Ih=null,Oh=0,u=Dr;for(;u!==null;)Pl(u.alternate,u),u=u.return;Dr=null}}function Pf(u,h){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,lQ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),Sc=0,Rf(),pr=u,Dr=y=tl(u.current,null),Nr=h,ei=0,wa=null,_c=!1,Yc=Ee(u,h),Gb=!1,es=Ua=fg=Nf=Bu=Cs=0,Fs=$h=null,Us=!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-Te(T),z=1<<I;h|=u[I],T&=~z}return Il=h,qm(),y}function Hu(u,h){wr=null,$.H=r0,h===kh||h===Pr?(h=Ph(),ei=3):h===Zm?(h=Ph(),ei=4):ei=h===xv?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,wa=h,Dr===null&&(Cs=1,gv(u,Al(h,u.current)))}function As(){var u=il.current;return u===null?!0:(Nr&4194048)===Nr?ja===null:(Nr&62914560)===Nr||(Nr&536870912)!==0?u===ja:!1}function Fd(){var u=$.H;return $.H=r0,u===null?r0:u}function Df(){var u=$.A;return $.A=zd,u}function u0(){Cs=4,_c||(Nr&4194048)!==Nr&&il.current!==null||(Yc=!0),(Bu&134217727)===0&&(Nf&134217727)===0||pr===null||mo(pr,Nr,Ua,!1)}function Ba(u,h,y){var T=Vn;Vn|=2;var I=Fd(),z=Df();(pr!==u||Nr!==h)&&(Es=null,Pf(u,h)),h=!1;var pe=Cs;e:do try{if(ei!==0&&Dr!==null){var Le=Dr,st=wa;switch(ei){case 8:Rf(),pe=6;break e;case 3:case 2:case 9:case 6:il.current===null&&(h=!0);var kt=ei;if(ei=0,wa=null,Xh(u,Le,st,kt),y&&Yc){pe=0;break e}break;default:kt=ei,ei=0,wa=null,Xh(u,Le,st,kt)}}d0(),pe=Cs;break}catch(Gt){Hu(u,Gt)}while(!0);return h&&u.shellSuspendCounter++,Ru=xf=null,Vn=T,$.H=I,$.A=z,Dr===null&&(pr=null,Nr=0,qm()),pe}function d0(){for(;Dr!==null;)kv(Dr)}function pg(u,h){var y=Vn;Vn|=2;var T=Fd(),I=Df();pr!==u||Nr!==h?(Es=null,Ks=Z()+500,Pf(u,h)):Yc=Ee(u,h);e:do try{if(ei!==0&&Dr!==null){h=Dr;var z=wa;t:switch(ei){case 1:ei=0,wa=null,Xh(u,h,z,1);break;case 2:case 9:if(rl(z)){ei=0,wa=null,mg(h);break}h=function(){ei!==2&&ei!==9||pr!==u||(ei=7),on(u)},z.then(h,h);break e;case 3:ei=7;break e;case 4:ei=5;break e;case 7:rl(z)?(ei=0,wa=null,mg(h)):(ei=0,wa=null,Xh(u,h,z,7));break;case 5:var pe=null;switch(Dr.tag){case 26:pe=Dr.memoizedState;case 5:case 27:var Le=Dr;if(pe?GP(pe):Le.stateNode.complete){ei=0,wa=null;var st=Le.sibling;if(st!==null)Dr=st;else{var kt=Le.return;kt!==null?(Dr=kt,If(kt)):Dr=null}break t}}ei=0,wa=null,Xh(u,h,z,5);break;case 6:ei=0,wa=null,Xh(u,h,z,6);break;case 8:Rf(),Cs=6;break e;default:throw Error(r(462))}}ul();break}catch(Gt){Hu(u,Gt)}while(!0);return Ru=xf=null,$.H=T,$.A=I,Vn=y,Dr!==null?0:(pr=null,Nr=0,qm(),Cs)}function ul(){for(;Dr!==null&&!We();)kv(Dr)}function kv(u){var h=Tv(u.alternate,u,Il);u.memoizedProps=u.pendingProps,h===null?If(u):Dr=h}function mg(u){var h=u,y=h.alternate;switch(h.tag){case 15:case 0:h=og(y,h,h.pendingProps,h.type,void 0,Nr);break;case 11:h=og(y,h,h.pendingProps,h.type.render,h.ref,Nr);break;case 5:pb(h);default:Pl(y,h),h=Dr=Vp(h,Il),h=Tv(y,h,Il)}u.memoizedProps=u.pendingProps,h===null?If(u):Dr=h}function Xh(u,h,y,T){Ru=xf=null,pb(h),Ih=null,Oh=0;var I=h.return;try{if(To(u,I,h,y,Nr)){Cs=1,gv(u,Al(y,u.current)),Dr=null;return}}catch(z){if(I!==null)throw Dr=I,z;Cs=1,gv(u,Al(y,u.current)),Dr=null;return}h.flags&32768?(Zr||T===1?u=!0:Yc||(Nr&536870912)!==0?u=!1:(_c=u=!0,(T===2||T===9||T===3||T===6)&&(T=il.current,T!==null&&T.tag===13&&(T.flags|=16384))),gg(h,u)):If(h)}function If(u){var h=u;do{if((h.flags&32768)!==0){gg(h,_c);return}u=h.return;var y=cg(h.alternate,h,Il);if(y!==null){Dr=y;return}if(h=h.sibling,h!==null){Dr=h;return}Dr=h=u}while(h!==null);Cs===0&&(Cs=5)}function gg(u,h){do{var y=mc(u.alternate,u);if(y!==null){y.flags&=32767,Dr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!h&&(u=u.sibling,u!==null)){Dr=u;return}Dr=u=y}while(u!==null);Cs=6,Dr=null}function Ud(u,h,y,T,I,z,pe,Le,st){u.cancelPendingCommit=null;do f0();while(Ni!==0);if((Vn&6)!==0)throw Error(r(327));if(h!==null){if(h===u.current)throw Error(r(177));if(z=h.lanes|h.childLanes,z|=Uo,ut(u,y,z,pe,Le,st),u===pr&&(Dr=pr=null,Nr=0),a0=h,Ol=u,Sc=y,l0=z,c0=I,hg=T,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,W(ve,function(){return Rv(),null})):(u.callbackNode=null,u.callbackPriority=0),T=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||T){T=$.T,$.T=null,I=Q.p,Q.p=2,pe=Vn,Vn|=4;try{NE(u,h,y)}finally{Vn=pe,Q.p=I,$.T=T}}Ni=1,go(),Bd(),Yh()}}function go(){if(Ni===1){Ni=0;var u=Ol,h=a0,y=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||y){y=$.T,$.T=null;var T=Q.p;Q.p=2;var I=Vn;Vn|=4;try{Cf(h,u);var z=LE,pe=Ji(u.containerInfo),Le=z.focusedElem,st=z.selectionRange;if(pe!==Le&&Le&&Le.ownerDocument&&Zn(Le.ownerDocument.documentElement,Le)){if(st!==null&&Os(Le)){var kt=st.start,Gt=st.end;if(Gt===void 0&&(Gt=kt),"selectionStart"in Le)Le.selectionStart=kt,Le.selectionEnd=Math.min(Gt,Le.value.length);else{var Yt=Le.ownerDocument||document,It=Yt&&Yt.defaultView||window;if(It.getSelection){var Ft=It.getSelection(),jn=Le.textContent.length,or=Math.min(st.start,jn),Zi=st.end===void 0?or:Math.min(st.end,jn);!Ft.extend&&or>Zi&&(pe=Zi,Zi=or,or=pe);var _t=On(Le,or),pt=On(Le,Zi);if(_t&&pt&&(Ft.rangeCount!==1||Ft.anchorNode!==_t.node||Ft.anchorOffset!==_t.offset||Ft.focusNode!==pt.node||Ft.focusOffset!==pt.offset)){var Nt=Yt.createRange();Nt.setStart(_t.node,_t.offset),Ft.removeAllRanges(),or>Zi?(Ft.addRange(Nt),Ft.extend(pt.node,pt.offset)):(Nt.setEnd(pt.node,pt.offset),Ft.addRange(Nt))}}}}for(Yt=[],Ft=Le;Ft=Ft.parentNode;)Ft.nodeType===1&&Yt.push({element:Ft,left:Ft.scrollLeft,top:Ft.scrollTop});for(typeof Le.focus=="function"&&Le.focus(),Le=0;Le<Yt.length;Le++){var Xt=Yt[Le];Xt.element.scrollLeft=Xt.left,Xt.element.scrollTop=Xt.top}}i4=!!OE,LE=OE=null}finally{Vn=I,Q.p=T,$.T=y}}u.current=h,Ni=2}}function Bd(){if(Ni===2){Ni=0;var u=Ol,h=a0,y=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||y){y=$.T,$.T=null;var T=Q.p;Q.p=2;var I=Vn;Vn|=4;try{us(u,h.alternate,h)}finally{Vn=I,Q.p=T,$.T=y}}Ni=3}}function Yh(){if(Ni===4||Ni===3){Ni=0,ae();var u=Ol,h=a0,y=Sc,T=hg;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ni=5:(Ni=0,a0=Ol=null,Vu(u,u.pendingLanes));var I=u.pendingLanes;if(I===0&&(Zs=null),en(y),h=h.stateNode,Ke&&typeof Ke.onCommitFiberRoot=="function")try{Ke.onCommitFiberRoot(Fe,h,void 0,(h.current.flags&128)===128)}catch{}if(T!==null){h=$.T,I=Q.p,Q.p=2,$.T=null;try{for(var z=u.onRecoverableError,pe=0;pe<T.length;pe++){var Le=T[pe];z(Le.value,{componentStack:Le.stack})}}finally{$.T=h,Q.p=I}}(Sc&3)!==0&&f0(),on(u),I=u.pendingLanes,(y&261930)!==0&&(I&42)!==0?u===qh?kf++:(kf=0,qh=u):kf=0,kn(0)}}function Vu(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,Nh(h)))}function f0(){return go(),Bd(),Yh(),Rv()}function Rv(){if(Ni!==5)return!1;var u=Ol,h=l0;l0=0;var y=en(Sc),T=$.T,I=Q.p;try{Q.p=32>y?32:y,$.T=null,y=c0,c0=null;var z=Ol,pe=Sc;if(Ni=0,a0=Ol=null,Sc=0,(Vn&6)!==0)throw Error(r(331));var Le=Vn;if(Vn|=4,ll(z.current),Vb(z,z.current,pe,y),Vn=Le,kn(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot(Fe,z)}catch{}return!0}finally{Q.p=I,$.T=T,Vu(u,h)}}function $b(u,h,y){h=Al(y,h),h=Lb(u.stateNode,h,2),u=bf(u,h,2),u!==null&&(rt(u,2),on(u))}function ui(u,h,y){if(u.tag===3)$b(u,u,y);else for(;h!==null;){if(h.tag===3){$b(h,u,y);break}else if(h.tag===1){var T=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof T.componentDidCatch=="function"&&(Zs===null||!Zs.has(T))){u=Al(y,u),y=jb(2),T=bf(h,y,2),T!==null&&(V3(y,T,h,u),rt(T,2),on(T));break}}h=h.return}}function xg(u,h,y){var T=u.pingCache;if(T===null){T=u.pingCache=new Mr;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)||(Gb=!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,pr===u&&(Nr&y)===y&&(Cs===4||Cs===3&&(Nr&62914560)===Nr&&300>Z()-o0?(Vn&2)===0&&Pf(u,0):fg|=y,es===Nr&&(es=0)),on(u)}function v(u,h){h===0&&(h=Ie()),u=Oa(u,h),u!==null&&(rt(u,h),on(u))}function E(u){var h=u.memoizedState,y=0;h!==null&&(y=h.retryLane),v(u,y)}function P(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 W(u,h){return Be(u,h)}var ne=null,De=null,at=!1,zt=!1,nn=!1,xn=0;function on(u){u!==De&&u.next===null&&(De===null?ne=De=u:De=De.next=u),zt=!0,at||(at=!0,Mt())}function kn(u,h){if(!nn&&zt){nn=!0;do for(var y=!1,T=ne;T!==null;){if(u!==0){var I=T.pendingLanes;if(I===0)var z=0;else{var pe=T.suspendedLanes,Le=T.pingedLanes;z=(1<<31-Te(42|u)+1)-1,z&=I&~(pe&~Le),z=z&201326741?z&201326741|1:z?z|2:0}z!==0&&(y=!0,Pt(T,z))}else z=Nr,z=Je(T,T===pr?z:0,T.cancelPendingCommit!==null||T.timeoutHandle!==-1),(z&3)===0||Ee(T,z)||(y=!0,Pt(T,z));T=T.next}while(y);nn=!1}}function vr(){Qs()}function Qs(){zt=at=!1;var u=0;xn!==0&&aQ()&&(u=xn);for(var h=Z(),y=null,T=ne;T!==null;){var I=T.next,z=h0(T,h);z===0?(T.next=null,y===null?ne=I:y.next=I,I===null&&(De=y)):(y=T,(u!==0||(z&3)!==0)&&(zt=!0)),T=I}Ni!==0&&Ni!==5||kn(u),xn!==0&&(xn=0)}function h0(u,h){for(var y=u.suspendedLanes,T=u.pingedLanes,I=u.expirationTimes,z=u.pendingLanes&-62914561;0<z;){var pe=31-Te(z),Le=1<<pe,st=I[pe];st===-1?((Le&y)===0||(Le&T)!==0)&&(I[pe]=Ze(Le,h)):st<=h&&(u.expiredLanes|=Le),z&=~Le}if(h=pr,y=Nr,y=Je(u,u===h?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),T=u.callbackNode,y===0||u===h&&(ei===2||ei===9)||u.cancelPendingCommit!==null)return T!==null&&T!==null&&Ge(T),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Ee(u,y)){if(h=y&-y,h===u.callbackPriority)return h;switch(T!==null&&Ge(T),en(y)){case 2:case 8:y=we;break;case 32:y=ve;break;case 268435456:y=Ae;break;default:y=ve}return T=Of.bind(null,u),y=Be(y,T),u.callbackPriority=h,u.callbackNode=y,h}return T!==null&&T!==null&&Ge(T),u.callbackPriority=2,u.callbackNode=null,2}function Of(u,h){if(Ni!==0&&Ni!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(f0()&&u.callbackNode!==y)return null;var T=Nr;return T=Je(u,u===pr?T:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),T===0?null:(Hr(u,T,h),h0(u,Z()),u.callbackNode!=null&&u.callbackNode===y?Of.bind(null,u):null)}function Pt(u,h){if(f0())return null;Hr(u,h,!0)}function Mt(){cQ(function(){(Vn&6)!==0?Be(be,vr):Qs()})}function jt(){if(xn===0){var u=kd;u===0&&(u=et,et<<=1,(et&261888)===0&&(et=256)),xn=u}return xn}function mn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:ya(""+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 Ns(u,h,y,T,I){if(h==="submit"&&y&&y.stateNode===I){var z=mn((I[Bt]||null).action),pe=T.submitter;pe&&(h=(h=pe[Bt]||null)?mn(h.formAction):pe.getAttribute("formAction"),h!==null&&(z=h,pe=null));var Le=new zi("action","action",null,T,I);u.push({event:Le,listeners:[{instance:null,listener:function(){if(T.defaultPrevented){if(xn!==0){var st=pe?Qn(I,pe):new FormData(I);Ab(y,{pending:!0,data:st,method:I.method,action:z},null,st)}}else typeof z=="function"&&(Le.preventDefault(),st=pe?Qn(I,pe):new FormData(I),Ab(y,{pending:!0,data:st,method:I.method,action:z},z,st))},currentTarget:I}]})}}for(var tr=0;tr<Wm.length;tr++){var si=Wm[tr],Wo=si.toLowerCase(),mi=si[0].toUpperCase()+si.slice(1);lc(Wo,"on"+mi)}lc(fo,"onAnimationEnd"),lc(wo,"onAnimationIteration"),lc(Wc,"onAnimationStart"),lc("dblclick","onDoubleClick"),lc("focusin","onFocus"),lc("focusout","onBlur"),lc(Fo,"onTransitionRun"),lc(Gx,"onTransitionStart"),lc(Jw,"onTransitionCancel"),lc(Jy,"onTransitionEnd"),qt("onMouseEnter",["mouseout","mouseover"]),qt("onMouseLeave",["mouseout","mouseover"]),qt("onPointerEnter",["pointerout","pointerover"]),qt("onPointerLeave",["pointerout","pointerover"]),vt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vt("onBeforeInput",["compositionend","keypress","textInput","paste"]),vt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wc="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(" "),kE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wc));function _P(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 pe=T.length-1;0<=pe;pe--){var Le=T[pe],st=Le.instance,kt=Le.currentTarget;if(Le=Le.listener,st!==z&&I.isPropagationStopped())break e;z=Le,I.currentTarget=kt;try{z(I)}catch(Gt){$m(Gt)}I.currentTarget=null,z=st}else for(pe=0;pe<T.length;pe++){if(Le=T[pe],st=Le.instance,kt=Le.currentTarget,Le=Le.listener,st!==z&&I.isPropagationStopped())break e;z=Le,I.currentTarget=kt;try{z(I)}catch(Gt){$m(Gt)}I.currentTarget=null,z=st}}}}function ti(u,h){var y=h[At];y===void 0&&(y=h[At]=new Set);var T=u+"__bubble";y.has(T)||(SP(h,u,2,!1),y.add(T))}function RE(u,h,y){var T=0;h&&(T|=4),SP(y,u,T,h)}var Y3="_reactListening"+Math.random().toString(36).slice(2);function PE(u){if(!u[Y3]){u[Y3]=!0,mt.forEach(function(y){y!=="selectionchange"&&(kE.has(y)||RE(y,!1,u),RE(y,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Y3]||(h[Y3]=!0,RE("selectionchange",!1,h))}}function SP(u,h,y,T){switch(ZP(h)){case 2:var I=NQ;break;case 8:I=kQ;break;default:I=qE}y=I.bind(null,h,y,u),I=void 0,!Lo||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 DE(u,h,y,T,I){var z=T;if((h&1)===0&&(h&2)===0&&T!==null)e:for(;;){if(T===null)return;var pe=T.tag;if(pe===3||pe===4){var Le=T.stateNode.containerInfo;if(Le===I)break;if(pe===4)for(pe=T.return;pe!==null;){var st=pe.tag;if((st===3||st===4)&&pe.stateNode.containerInfo===I)return;pe=pe.return}for(;Le!==null;){if(pe=Jt(Le),pe===null)return;if(st=pe.tag,st===5||st===6||st===26||st===27){T=z=pe;continue e}Le=Le.parentNode}}T=T.return}nc(function(){var kt=z,Gt=Qa(y),Yt=[];e:{var It=ac.get(u);if(It!==void 0){var Ft=zi,jn=u;switch(u){case"keypress":if(ii(y)===0)break e;case"keydown":case"keyup":Ft=_d;break;case"focusin":jn="focus",Ft=ba;break;case"focusout":jn="blur",Ft=ba;break;case"beforeblur":case"afterblur":Ft=ba;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=Ch;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ft=yd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ft=zm;break;case fo:case wo:case Wc:Ft=Gs;break;case Jy:Ft=Fm;break;case"scroll":case"scrollend":Ft=Da;break;case"wheel":Ft=Um;break;case"copy":case"cut":case"paste":Ft=El;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ft=sc;break;case"toggle":case"beforetoggle":Ft=Hm}var or=(h&4)!==0,Zi=!or&&(u==="scroll"||u==="scrollend"),_t=or?It!==null?It+"Capture":null:It;or=[];for(var pt=kt,Nt;pt!==null;){var Xt=pt;if(Nt=Xt.stateNode,Xt=Xt.tag,Xt!==5&&Xt!==26&&Xt!==27||Nt===null||_t===null||(Xt=ta(pt,_t),Xt!=null&&or.push(qb(pt,Xt,Nt))),Zi)break;pt=pt.return}0<or.length&&(It=new Ft(It,jn,null,y,Gt),Yt.push({event:It,listeners:or}))}}if((h&7)===0){e:{if(It=u==="mouseover"||u==="pointerover",Ft=u==="mouseout"||u==="pointerout",It&&y!==tc&&(jn=y.relatedTarget||y.fromElement)&&(Jt(jn)||jn[Ct]))break e;if((Ft||It)&&(It=Gt.window===Gt?Gt:(It=Gt.ownerDocument)?It.defaultView||It.parentWindow:window,Ft?(jn=y.relatedTarget||y.toElement,Ft=kt,jn=jn?Jt(jn):null,jn!==null&&(Zi=s(jn),or=jn.tag,jn!==Zi||or!==5&&or!==27&&or!==6)&&(jn=null)):(Ft=null,jn=kt),Ft!==jn)){if(or=Ch,Xt="onMouseLeave",_t="onMouseEnter",pt="mouse",(u==="pointerout"||u==="pointerover")&&(or=sc,Xt="onPointerLeave",_t="onPointerEnter",pt="pointer"),Zi=Ft==null?It:Fn(Ft),Nt=jn==null?It:Fn(jn),It=new or(Xt,pt+"leave",Ft,y,Gt),It.target=Zi,It.relatedTarget=Nt,Xt=null,Jt(Gt)===kt&&(or=new or(_t,pt+"enter",jn,y,Gt),or.target=Nt,or.relatedTarget=Zi,Xt=or),Zi=Xt,Ft&&jn)t:{for(or=nQ,_t=Ft,pt=jn,Nt=0,Xt=_t;Xt;Xt=or(Xt))Nt++;Xt=0;for(var Kn=pt;Kn;Kn=or(Kn))Xt++;for(;0<Nt-Xt;)_t=or(_t),Nt--;for(;0<Xt-Nt;)pt=or(pt),Xt--;for(;Nt--;){if(_t===pt||pt!==null&&_t===pt.alternate){or=_t;break t}_t=or(_t),pt=or(pt)}or=null}else or=null;Ft!==null&&wP(Yt,It,Ft,or,!1),jn!==null&&Zi!==null&&wP(Yt,Zi,jn,or,!0)}}e:{if(It=kt?Fn(kt):window,Ft=It.nodeName&&It.nodeName.toLowerCase(),Ft==="select"||Ft==="input"&&It.type==="file")var wi=Ye;else if(Td(It))if(Qe)wi=ar;else{wi=Cn;var Hn=Mn}else Ft=It.nodeName,!Ft||Ft.toLowerCase()!=="input"||It.type!=="checkbox"&&It.type!=="radio"?kt&&ka(kt.elementType)&&(wi=Ye):wi=Pn;if(wi&&(wi=wi(u,kt))){Hp(Yt,wi,y,Gt);break e}Hn&&Hn(u,It,kt),u==="focusout"&&kt&&It.type==="number"&&kt.memoizedProps.value!=null&&Li(It,"number",It.value)}switch(Hn=kt?Fn(kt):window,u){case"focusin":(Td(Hn)||Hn.contentEditable==="true")&&(ci=Hn,os=kt,Ls=null);break;case"focusout":Ls=os=ci=null;break;case"mousedown":ra=!0;break;case"contextmenu":case"mouseup":case"dragend":ra=!1,jo(Yt,y,Gt);break;case"selectionchange":if(xi)break;case"keydown":case"keyup":jo(Yt,y,Gt)}var zr;if(wu)e:{switch(u){case"compositionstart":var oi="onCompositionStart";break e;case"compositionend":oi="onCompositionEnd";break e;case"compositionupdate":oi="onCompositionUpdate";break e}oi=void 0}else Mu?Md(u,y)&&(oi="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(oi="onCompositionStart");oi&&(Up&&y.locale!=="ko"&&(Mu||oi!=="onCompositionStart"?oi==="onCompositionEnd"&&Mu&&(zr=Vc()):(bs=Gt,Ja="value"in bs?bs.value:bs.textContent,Mu=!0)),Hn=K3(kt,oi),0<Hn.length&&(oi=new Op(oi,u,null,y,Gt),Yt.push({event:oi,listeners:Hn}),zr?oi.data=zr:(zr=Is(y),zr!==null&&(oi.data=zr)))),(zr=Fp?Ss(u,y):Bp(u,y))&&(oi=K3(kt,"onBeforeInput"),0<oi.length&&(Hn=new Op("onBeforeInput","beforeinput",null,y,Gt),Yt.push({event:Hn,listeners:oi}),Hn.data=zr)),Ns(Yt,u,kt,y,Gt)}_P(Yt,h)})}function qb(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=ta(u,y),I!=null&&T.unshift(qb(u,I,z)),I=ta(u,h),I!=null&&T.push(qb(u,I,z))),u.tag===3)return T;u=u.return}return[]}function nQ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function wP(u,h,y,T,I){for(var z=h._reactName,pe=[];y!==null&&y!==T;){var Le=y,st=Le.alternate,kt=Le.stateNode;if(Le=Le.tag,st!==null&&st===T)break;Le!==5&&Le!==26&&Le!==27||kt===null||(st=kt,I?(kt=ta(y,z),kt!=null&&pe.unshift(qb(y,kt,st))):I||(kt=ta(y,z),kt!=null&&pe.push(qb(y,kt,st)))),y=y.return}pe.length!==0&&u.push({event:h,listeners:pe})}var rQ=/\r\n?/g,iQ=/\u0000|\uFFFD/g;function MP(u){return(typeof u=="string"?u:""+u).replace(rQ,`
`).replace(iQ,"")}function TP(u,h){return h=MP(h),MP(u)===h}function Ki(u,h,y,T,I,z){switch(y){case"children":typeof T=="string"?h==="body"||h==="textarea"&&T===""||Ps(u,T):(typeof T=="number"||typeof T=="bigint")&&h!=="body"&&Ps(u,""+T);break;case"className":An(u,"class",T);break;case"tabIndex":An(u,"tabindex",T);break;case"dir":case"role":case"viewBox":case"width":case"height":An(u,y,T);break;case"style":va(u,T,z);break;case"data":if(h!=="object"){An(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=ya(""+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=ya(""+T),u.setAttribute(y,T);break;case"onClick":T!=null&&(u.onclick=Ds);break;case"onScroll":T!=null&&ti("scroll",u);break;case"onScrollEnd":T!=null&&ti("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=ya(""+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":ti("beforetoggle",u),ti("toggle",u),_n(u,"popover",T);break;case"xlinkActuate":rn(u,"http://www.w3.org/1999/xlink","xlink:actuate",T);break;case"xlinkArcrole":rn(u,"http://www.w3.org/1999/xlink","xlink:arcrole",T);break;case"xlinkRole":rn(u,"http://www.w3.org/1999/xlink","xlink:role",T);break;case"xlinkShow":rn(u,"http://www.w3.org/1999/xlink","xlink:show",T);break;case"xlinkTitle":rn(u,"http://www.w3.org/1999/xlink","xlink:title",T);break;case"xlinkType":rn(u,"http://www.w3.org/1999/xlink","xlink:type",T);break;case"xmlBase":rn(u,"http://www.w3.org/XML/1998/namespace","xml:base",T);break;case"xmlLang":rn(u,"http://www.w3.org/XML/1998/namespace","xml:lang",T);break;case"xmlSpace":rn(u,"http://www.w3.org/XML/1998/namespace","xml:space",T);break;case"is":_n(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=ec.get(y)||y,_n(u,y,T))}}function IE(u,h,y,T,I,z){switch(y){case"style":va(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"?Ps(u,T):(typeof T=="number"||typeof T=="bigint")&&Ps(u,""+T);break;case"onScroll":T!=null&&ti("scroll",u);break;case"onScrollEnd":T!=null&&ti("scrollend",u);break;case"onClick":T!=null&&(u.onclick=Ds);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xt.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[Bt]||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,""):_n(u,y,T)}}}function Ha(u,h,y){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ti("error",u),ti("load",u);var T=!1,I=!1,z;for(z in y)if(y.hasOwnProperty(z)){var pe=y[z];if(pe!=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,pe,y,null)}}I&&Ki(u,h,"srcSet",y.srcSet,y,null),T&&Ki(u,h,"src",y.src,y,null);return;case"input":ti("invalid",u);var Le=z=pe=I=null,st=null,kt=null;for(T in y)if(y.hasOwnProperty(T)){var Gt=y[T];if(Gt!=null)switch(T){case"name":I=Gt;break;case"type":pe=Gt;break;case"checked":st=Gt;break;case"defaultChecked":kt=Gt;break;case"value":z=Gt;break;case"defaultValue":Le=Gt;break;case"children":case"dangerouslySetInnerHTML":if(Gt!=null)throw Error(r(137,h));break;default:Ki(u,h,T,Gt,y,null)}}Rs(u,z,Le,st,kt,pe,I,!1);return;case"select":ti("invalid",u),T=pe=z=null;for(I in y)if(y.hasOwnProperty(I)&&(Le=y[I],Le!=null))switch(I){case"value":z=Le;break;case"defaultValue":pe=Le;break;case"multiple":T=Le;default:Ki(u,h,I,Le,y,null)}h=z,y=pe,u.multiple=!!T,h!=null?ys(u,!!T,h,!1):y!=null&&ys(u,!!T,y,!0);return;case"textarea":ti("invalid",u),z=I=T=null;for(pe in y)if(y.hasOwnProperty(pe)&&(Le=y[pe],Le!=null))switch(pe){case"value":T=Le;break;case"defaultValue":I=Le;break;case"children":z=Le;break;case"dangerouslySetInnerHTML":if(Le!=null)throw Error(r(91));break;default:Ki(u,h,pe,Le,y,null)}pi(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":ti("beforetoggle",u),ti("toggle",u),ti("cancel",u),ti("close",u);break;case"iframe":case"object":ti("load",u);break;case"video":case"audio":for(T=0;T<wc.length;T++)ti(wc[T],u);break;case"image":ti("error",u),ti("load",u);break;case"details":ti("toggle",u);break;case"embed":case"source":case"link":ti("error",u),ti("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(kt in y)if(y.hasOwnProperty(kt)&&(T=y[kt],T!=null))switch(kt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,h));default:Ki(u,h,kt,T,y,null)}return;default:if(ka(h)){for(Gt in y)y.hasOwnProperty(Gt)&&(T=y[Gt],T!==void 0&&IE(u,h,Gt,T,y,void 0));return}}for(Le in y)y.hasOwnProperty(Le)&&(T=y[Le],T!=null&&Ki(u,h,Le,T,y,null))}function sQ(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,pe=null,Le=null,st=null,kt=null,Gt=null;for(Ft in y){var Yt=y[Ft];if(y.hasOwnProperty(Ft)&&Yt!=null)switch(Ft){case"checked":break;case"value":break;case"defaultValue":st=Yt;default:T.hasOwnProperty(Ft)||Ki(u,h,Ft,null,T,Yt)}}for(var It in T){var Ft=T[It];if(Yt=y[It],T.hasOwnProperty(It)&&(Ft!=null||Yt!=null))switch(It){case"type":z=Ft;break;case"name":I=Ft;break;case"checked":kt=Ft;break;case"defaultChecked":Gt=Ft;break;case"value":pe=Ft;break;case"defaultValue":Le=Ft;break;case"children":case"dangerouslySetInnerHTML":if(Ft!=null)throw Error(r(137,h));break;default:Ft!==Yt&&Ki(u,h,It,Ft,T,Yt)}}vs(u,pe,Le,st,kt,Gt,z,I);return;case"select":Ft=pe=Le=It=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":It=z;break;case"defaultValue":Le=z;break;case"multiple":pe=z;default:z!==st&&Ki(u,h,I,z,T,st)}h=Le,y=pe,T=Ft,It!=null?ys(u,!!y,It,!1):!!T!=!!y&&(h!=null?ys(u,!!y,h,!0):ys(u,!!y,y?[]:"",!1));return;case"textarea":Ft=It=null;for(Le in y)if(I=y[Le],y.hasOwnProperty(Le)&&I!=null&&!T.hasOwnProperty(Le))switch(Le){case"value":break;case"children":break;default:Ki(u,h,Le,null,T,I)}for(pe in T)if(I=T[pe],z=y[pe],T.hasOwnProperty(pe)&&(I!=null||z!=null))switch(pe){case"value":It=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,pe,I,T,z)}_r(u,It,Ft);return;case"option":for(var jn in y)if(It=y[jn],y.hasOwnProperty(jn)&&It!=null&&!T.hasOwnProperty(jn))switch(jn){case"selected":u.selected=!1;break;default:Ki(u,h,jn,null,T,It)}for(st in T)if(It=T[st],Ft=y[st],T.hasOwnProperty(st)&&It!==Ft&&(It!=null||Ft!=null))switch(st){case"selected":u.selected=It&&typeof It!="function"&&typeof It!="symbol";break;default:Ki(u,h,st,It,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 or in y)It=y[or],y.hasOwnProperty(or)&&It!=null&&!T.hasOwnProperty(or)&&Ki(u,h,or,null,T,It);for(kt in T)if(It=T[kt],Ft=y[kt],T.hasOwnProperty(kt)&&It!==Ft&&(It!=null||Ft!=null))switch(kt){case"children":case"dangerouslySetInnerHTML":if(It!=null)throw Error(r(137,h));break;default:Ki(u,h,kt,It,T,Ft)}return;default:if(ka(h)){for(var Zi in y)It=y[Zi],y.hasOwnProperty(Zi)&&It!==void 0&&!T.hasOwnProperty(Zi)&&IE(u,h,Zi,void 0,T,It);for(Gt in T)It=T[Gt],Ft=y[Gt],!T.hasOwnProperty(Gt)||It===Ft||It===void 0&&Ft===void 0||IE(u,h,Gt,It,T,Ft);return}}for(var _t in y)It=y[_t],y.hasOwnProperty(_t)&&It!=null&&!T.hasOwnProperty(_t)&&Ki(u,h,_t,null,T,It);for(Yt in T)It=T[Yt],Ft=y[Yt],!T.hasOwnProperty(Yt)||It===Ft||It==null&&Ft==null||Ki(u,h,Yt,It,T,Ft)}function CP(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oQ(){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,pe=I.initiatorType,Le=I.duration;if(z&&Le&&CP(pe)){for(pe=0,Le=I.responseEnd,T+=1;T<y.length;T++){var st=y[T],kt=st.startTime;if(kt>Le)break;var Gt=st.transferSize,Yt=st.initiatorType;Gt&&CP(Yt)&&(st=st.responseEnd,pe+=Gt*(st<Le?1:(Le-kt)/(st-kt)))}if(--T,h+=8*(z+pe)/(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 OE=null,LE=null;function Z3(u){return u.nodeType===9?u:u.ownerDocument}function EP(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 AP(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 jE(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 zE=null;function aQ(){var u=window.event;return u&&u.type==="popstate"?u===zE?!1:(zE=u,!0):(zE=null,!1)}var NP=typeof setTimeout=="function"?setTimeout:void 0,lQ=typeof clearTimeout=="function"?clearTimeout:void 0,kP=typeof Promise=="function"?Promise:void 0,cQ=typeof queueMicrotask=="function"?queueMicrotask:typeof kP<"u"?function(u){return kP.resolve(null).then(u).catch(uQ)}:NP;function uQ(u){setTimeout(function(){throw u})}function p0(u){return u==="head"}function RP(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),Ov(h);return}T--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")T++;else if(y==="html")Xb(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,Xb(y);for(var z=y.firstChild;z;){var pe=z.nextSibling,Le=z.nodeName;z[wt]||Le==="SCRIPT"||Le==="STYLE"||Le==="LINK"&&z.rel.toLowerCase()==="stylesheet"||y.removeChild(z),z=pe}}else y==="body"&&Xb(u.ownerDocument.body);y=I}while(y);Ov(h)}function PP(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 FE(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":FE(y),Zt(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function dQ(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[wt])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=Gu(u.nextSibling),u===null)break}return null}function fQ(u,h,y){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=Gu(u.nextSibling),u===null))return null;return u}function DP(u,h){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!h||(u=Gu(u.nextSibling),u===null))return null;return u}function UE(u){return u.data==="$?"||u.data==="$~"}function BE(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function hQ(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 Gu(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 HE=null;function IP(u){u=u.nextSibling;for(var h=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(h===0)return Gu(u.nextSibling);h--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||h++}u=u.nextSibling}return null}function OP(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 LP(u,h,y){switch(h=Z3(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 Xb(u){for(var h=u.attributes;h.length;)u.removeAttributeNode(h[0]);Zt(u)}var Wu=new Map,jP=new Set;function Q3(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Kh=Q.d;Q.d={f:pQ,r:mQ,D:gQ,C:xQ,L:vQ,m:yQ,X:_Q,S:bQ,M:SQ};function pQ(){var u=Kh.f(),h=Kc();return u||h}function mQ(u){var h=vn(u);h!==null&&h.tag===5&&h.type==="form"?I3(h):Kh.r(u)}var Pv=typeof document>"u"?null:document;function zP(u,h,y){var T=Pv;if(T&&typeof h=="string"&&h){var I=Ln(h);I='link[rel="'+u+'"][href="'+I+'"]',typeof y=="string"&&(I+='[crossorigin="'+y+'"]'),jP.has(I)||(jP.add(I),u={rel:u,crossOrigin:y,href:h},T.querySelector(I)===null&&(h=T.createElement("link"),Ha(h,"link",u),nt(h),T.head.appendChild(h)))}}function gQ(u){Kh.D(u),zP("dns-prefetch",u,null)}function xQ(u,h){Kh.C(u,h),zP("preconnect",u,h)}function vQ(u,h,y){Kh.L(u,h,y);var T=Pv;if(T&&u&&h){var I='link[rel="preload"][as="'+Ln(h)+'"]';h==="image"&&y&&y.imageSrcSet?(I+='[imagesrcset="'+Ln(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(I+='[imagesizes="'+Ln(y.imageSizes)+'"]')):I+='[href="'+Ln(u)+'"]';var z=I;switch(h){case"style":z=Dv(u);break;case"script":z=Iv(u)}Wu.has(z)||(u=p({rel:"preload",href:h==="image"&&y&&y.imageSrcSet?void 0:u,as:h},y),Wu.set(z,u),T.querySelector(I)!==null||h==="style"&&T.querySelector(Yb(z))||h==="script"&&T.querySelector(Kb(z))||(h=T.createElement("link"),Ha(h,"link",u),nt(h),T.head.appendChild(h)))}}function yQ(u,h){Kh.m(u,h);var y=Pv;if(y&&u){var T=h&&typeof h.as=="string"?h.as:"script",I='link[rel="modulepreload"][as="'+Ln(T)+'"][href="'+Ln(u)+'"]',z=I;switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":z=Iv(u)}if(!Wu.has(z)&&(u=p({rel:"modulepreload",href:u},h),Wu.set(z,u),y.querySelector(I)===null)){switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Kb(z)))return}T=y.createElement("link"),Ha(T,"link",u),nt(T),y.head.appendChild(T)}}}function bQ(u,h,y){Kh.S(u,h,y);var T=Pv;if(T&&u){var I=_e(T).hoistableStyles,z=Dv(u);h=h||"default";var pe=I.get(z);if(!pe){var Le={loading:0,preload:null};if(pe=T.querySelector(Yb(z)))Le.loading=5;else{u=p({rel:"stylesheet",href:u,"data-precedence":h},y),(y=Wu.get(z))&&VE(u,y);var st=pe=T.createElement("link");nt(st),Ha(st,"link",u),st._p=new Promise(function(kt,Gt){st.onload=kt,st.onerror=Gt}),st.addEventListener("load",function(){Le.loading|=1}),st.addEventListener("error",function(){Le.loading|=2}),Le.loading|=4,J3(pe,h,T)}pe={type:"stylesheet",instance:pe,count:1,state:Le},I.set(z,pe)}}}function _Q(u,h){Kh.X(u,h);var y=Pv;if(y&&u){var T=_e(y).hoistableScripts,I=Iv(u),z=T.get(I);z||(z=y.querySelector(Kb(I)),z||(u=p({src:u,async:!0},h),(h=Wu.get(I))&&GE(u,h),z=y.createElement("script"),nt(z),Ha(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},T.set(I,z))}}function SQ(u,h){Kh.M(u,h);var y=Pv;if(y&&u){var T=_e(y).hoistableScripts,I=Iv(u),z=T.get(I);z||(z=y.querySelector(Kb(I)),z||(u=p({src:u,async:!0,type:"module"},h),(h=Wu.get(I))&&GE(u,h),z=y.createElement("script"),nt(z),Ha(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},T.set(I,z))}}function FP(u,h,y,T){var I=(I=J.current)?Q3(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=Dv(y.href),y=_e(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=Dv(y.href);var z=_e(I).hoistableStyles,pe=z.get(u);if(pe||(I=I.ownerDocument||I,pe={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},z.set(u,pe),(z=I.querySelector(Yb(u)))&&!z._p&&(pe.instance=z,pe.state.loading=5),Wu.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},Wu.set(u,y),z||wQ(I,u,y,pe.state))),h&&T===null)throw Error(r(528,""));return pe}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=Iv(y),y=_e(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 Dv(u){return'href="'+Ln(u)+'"'}function Yb(u){return'link[rel="stylesheet"]['+u+"]"}function UP(u){return p({},u,{"data-precedence":u.precedence,precedence:null})}function wQ(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}),Ha(h,"link",y),nt(h),u.head.appendChild(h))}function Iv(u){return'[src="'+Ln(u)+'"]'}function Kb(u){return"script[async]"+u}function BP(u,h,y){if(h.count++,h.instance===null)switch(h.type){case"style":var T=u.querySelector('style[data-href~="'+Ln(y.href)+'"]');if(T)return h.instance=T,nt(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"),nt(T),Ha(T,"style",I),J3(T,y.precedence,u),h.instance=T;case"stylesheet":I=Dv(y.href);var z=u.querySelector(Yb(I));if(z)return h.state.loading|=4,h.instance=z,nt(z),z;T=UP(y),(I=Wu.get(I))&&VE(T,I),z=(u.ownerDocument||u).createElement("link"),nt(z);var pe=z;return pe._p=new Promise(function(Le,st){pe.onload=Le,pe.onerror=st}),Ha(z,"link",T),h.state.loading|=4,J3(z,y.precedence,u),h.instance=z;case"script":return z=Iv(y.src),(I=u.querySelector(Kb(z)))?(h.instance=I,nt(I),I):(T=y,(I=Wu.get(z))&&(T=p({},y),GE(T,I)),u=u.ownerDocument||u,I=u.createElement("script"),nt(I),Ha(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,J3(T,y.precedence,u));return h.instance}function J3(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,pe=0;pe<T.length;pe++){var Le=T[pe];if(Le.dataset.precedence===h)z=Le;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 VE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function GE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var e4=null;function HP(u,h,y){if(e4===null){var T=new Map,I=e4=new Map;I.set(y,T)}else I=e4,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[wt]||z[Tt]||u==="link"&&z.getAttribute("rel")==="stylesheet")&&z.namespaceURI!=="http://www.w3.org/2000/svg"){var pe=z.getAttribute(h)||"";pe=u+pe;var Le=T.get(pe);Le?Le.push(z):T.set(pe,[z])}}return T}function VP(u,h,y){u=u.ownerDocument||u,u.head.insertBefore(y,h==="title"?u.querySelector("head > title"):null)}function MQ(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 GP(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function TQ(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=Dv(T.href),z=h.querySelector(Yb(I));if(z){h=z._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(u.count++,u=t4.bind(u),h.then(u,u)),y.state.loading|=4,y.instance=z,nt(z);return}z=h.ownerDocument||h,T=UP(T),(I=Wu.get(I))&&VE(T,I),z=z.createElement("link"),nt(z);var pe=z;pe._p=new Promise(function(Le,st){pe.onload=Le,pe.onerror=st}),Ha(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=t4.bind(u),h.addEventListener("load",y),h.addEventListener("error",y))}}var WE=0;function CQ(u,h){return u.stylesheets&&u.count===0&&r4(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var T=setTimeout(function(){if(u.stylesheets&&r4(u,u.stylesheets),u.unsuspend){var z=u.unsuspend;u.unsuspend=null,z()}},6e4+h);0<u.imgBytes&&WE===0&&(WE=62500*oQ());var I=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&r4(u,u.stylesheets),u.unsuspend)){var z=u.unsuspend;u.unsuspend=null,z()}},(u.imgBytes>WE?50:800)+h);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(T),clearTimeout(I)}}:null}function t4(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)r4(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var n4=null;function r4(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,n4=new Map,h.forEach(EQ,u),n4=null,t4.call(u))}function EQ(u,h){if(!(h.state.loading&4)){var y=n4.get(u);if(y)var T=y.get(null);else{y=new Map,n4.set(u,y);for(var I=u.querySelectorAll("link[data-precedence],style[data-precedence]"),z=0;z<I.length;z++){var pe=I[z];(pe.nodeName==="LINK"||pe.getAttribute("media")!=="not all")&&(y.set(pe.dataset.precedence,pe),T=pe)}T&&y.set(null,T)}I=h.instance,pe=I.getAttribute("data-precedence"),z=y.get(pe)||T,z===T&&y.set(null,I),y.set(pe,I),this.count++,T=t4.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 Zb={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function AQ(u,h,y,T,I,z,pe,Le,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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=T,this.onUncaughtError=I,this.onCaughtError=z,this.onRecoverableError=pe,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=st,this.incompleteTransitions=new Map}function WP(u,h,y,T,I,z,pe,Le,st,kt,Gt,Yt){return u=new AQ(u,h,y,pe,st,kt,Gt,Yt,Le),h=1,z===!0&&(h|=24),z=ws(3,null,null,h),u.current=z,z.stateNode=u,h=tb(),h.refCount++,u.pooledCache=h,h.refCount++,z.memoizedState={element:T,isDehydrated:y,cache:h},Jm(z),u}function $P(u){return u?(u=ff,u):ff}function qP(u,h,y,T,I,z){I=$P(I),T.context===null?T.context=I:T.pendingContext=I,T=Pd(h),T.payload={element:y},z=z===void 0?null:z,z!==null&&(T.callback=z),y=bf(u,T,h),y!==null&&(Ir(y,u,h),_f(y,u,h))}function XP(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<h?y:h}}function $E(u,h){XP(u,h),(u=u.alternate)&&XP(u,h)}function YP(u){if(u.tag===13||u.tag===31){var h=Oa(u,67108864);h!==null&&Ir(h,u,67108864),$E(u,67108864)}}function KP(u){if(u.tag===13||u.tag===31){var h=Ll();h=Ht(h);var y=Oa(u,h);y!==null&&Ir(y,u,h),$E(u,h)}}var i4=!0;function NQ(u,h,y,T){var I=$.T;$.T=null;var z=Q.p;try{Q.p=2,qE(u,h,y,T)}finally{Q.p=z,$.T=I}}function kQ(u,h,y,T){var I=$.T;$.T=null;var z=Q.p;try{Q.p=8,qE(u,h,y,T)}finally{Q.p=z,$.T=I}}function qE(u,h,y,T){if(i4){var I=XE(T);if(I===null)DE(u,h,T,s4,y),QP(u,T);else if(PQ(I,u,h,y,T))T.stopPropagation();else if(QP(u,T),h&4&&-1<RQ.indexOf(u)){for(;I!==null;){var z=vn(I);if(z!==null)switch(z.tag){case 3:if(z=z.stateNode,z.current.memoizedState.isDehydrated){var pe=lt(z.pendingLanes);if(pe!==0){var Le=z;for(Le.pendingLanes|=2,Le.entangledLanes|=2;pe;){var st=1<<31-Te(pe);Le.entanglements[1]|=st,pe&=~st}on(z),(Vn&6)===0&&(Ks=Z()+500,kn(0))}}break;case 31:case 13:Le=Oa(z,2),Le!==null&&Ir(Le,z,2),Kc(),$E(z,2)}if(z=XE(T),z===null&&DE(u,h,T,s4,y),z===I)break;I=z}I!==null&&T.stopPropagation()}else DE(u,h,T,null,y)}}function XE(u){return u=Qa(u),YE(u)}var s4=null;function YE(u){if(s4=null,u=Jt(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 s4=u,null}function ZP(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(he()){case be:return 2;case we:return 8;case ve:case Re:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var KE=!1,m0=null,g0=null,x0=null,Qb=new Map,Jb=new Map,v0=[],RQ="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 QP(u,h){switch(u){case"focusin":case"focusout":m0=null;break;case"dragenter":case"dragleave":g0=null;break;case"mouseover":case"mouseout":x0=null;break;case"pointerover":case"pointerout":Qb.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":Jb.delete(h.pointerId)}}function e_(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=vn(h),h!==null&&YP(h)),u):(u.eventSystemFlags|=T,h=u.targetContainers,I!==null&&h.indexOf(I)===-1&&h.push(I),u)}function PQ(u,h,y,T,I){switch(h){case"focusin":return m0=e_(m0,u,h,y,T,I),!0;case"dragenter":return g0=e_(g0,u,h,y,T,I),!0;case"mouseover":return x0=e_(x0,u,h,y,T,I),!0;case"pointerover":var z=I.pointerId;return Qb.set(z,e_(Qb.get(z)||null,u,h,y,T,I)),!0;case"gotpointercapture":return z=I.pointerId,Jb.set(z,e_(Jb.get(z)||null,u,h,y,T,I)),!0}return!1}function JP(u){var h=Jt(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,$e(u.priority,function(){KP(y)});return}}else if(h===31){if(h=a(y),h!==null){u.blockedOn=h,$e(u.priority,function(){KP(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 o4(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var y=XE(u.nativeEvent);if(y===null){y=u.nativeEvent;var T=new y.constructor(y.type,y);tc=T,y.target.dispatchEvent(T),tc=null}else return h=vn(y),h!==null&&YP(h),u.blockedOn=y,!1;h.shift()}return!0}function eD(u,h,y){o4(u)&&y.delete(h)}function DQ(){KE=!1,m0!==null&&o4(m0)&&(m0=null),g0!==null&&o4(g0)&&(g0=null),x0!==null&&o4(x0)&&(x0=null),Qb.forEach(eD),Jb.forEach(eD)}function a4(u,h){u.blockedOn===h&&(u.blockedOn=null,KE||(KE=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,DQ)))}var l4=null;function tD(u){l4!==u&&(l4=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){l4===u&&(l4=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(YE(T||y)===null)continue;break}var z=vn(y);z!==null&&(u.splice(h,3),h-=3,Ab(z,{pending:!0,data:I,method:y.method,action:T},T,I))}}))}function Ov(u){function h(st){return a4(st,u)}m0!==null&&a4(m0,u),g0!==null&&a4(g0,u),x0!==null&&a4(x0,u),Qb.forEach(h),Jb.forEach(h);for(var y=0;y<v0.length;y++){var T=v0[y];T.blockedOn===u&&(T.blockedOn=null)}for(;0<v0.length&&(y=v0[0],y.blockedOn===null);)JP(y),y.blockedOn===null&&v0.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],pe=I[Bt]||null;if(typeof z=="function")pe||tD(y);else if(pe){var Le=null;if(z&&z.hasAttribute("formAction")){if(I=z,pe=z[Bt]||null)Le=pe.formAction;else if(YE(I)!==null)continue}else Le=pe.action;typeof Le=="function"?y[T+1]=Le:(y.splice(T,3),T-=3),tD(y)}}}function nD(){function u(z){z.canIntercept&&z.info==="react-transition"&&z.intercept({handler:function(){return new Promise(function(pe){return I=pe})},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 ZE(u){this._internalRoot=u}c4.prototype.render=ZE.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(r(409));var y=h.current,T=Ll();qP(y,T,u,h,null,null)},c4.prototype.unmount=ZE.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;qP(u.current,2,null,u,null,null),Kc(),h[Ct]=null}};function c4(u){this._internalRoot=u}c4.prototype.unstable_scheduleHydration=function(u){if(u){var h=Ut();u={blockedOn:null,target:u,priority:h};for(var y=0;y<v0.length&&h!==0&&h<v0[y].priority;y++);v0.splice(y,0,u),y===0&&JP(u)}};var rD=e.version;if(rD!=="19.2.1")throw Error(r(527,rD,"19.2.1"));Q.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 IQ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var u4=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!u4.isDisabled&&u4.supportsFiber)try{Fe=u4.inject(IQ),Ke=u4}catch{}}return n_.createRoot=function(u,h){if(!i(u))throw Error(r(299));var y=!1,T="",I=B3,z=Ib,pe=Ob;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&&(pe=h.onRecoverableError)),h=WP(u,1,!1,null,null,y,T,null,I,z,pe,nD),u[Ct]=h.current,PE(u),new ZE(h)},n_.hydrateRoot=function(u,h,y){if(!i(u))throw Error(r(299));var T=!1,I="",z=B3,pe=Ib,Le=Ob,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&&(pe=y.onCaughtError),y.onRecoverableError!==void 0&&(Le=y.onRecoverableError),y.formState!==void 0&&(st=y.formState)),h=WP(u,1,!0,h,y??null,T,I,st,z,pe,Le,nD),h.context=$P(null),y=h.current,T=Ll(),T=Ht(T),I=Pd(T),I.callback=null,bf(y,I,T),y=T,h.current.lanes=y,rt(h,y),on(h),u[Ct]=h.current,PE(u),new c4(h)},n_.version="19.2.1",n_}var pD;function VQ(){if(pD)return tA.exports;pD=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(),tA.exports=HQ(),tA.exports}var dU=VQ();/**
 * 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 mD="popstate";function gD(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function GQ(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 jN("",{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:pS(i)}return $Q(e,n,null,t)}function io(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function nf(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function WQ(){return Math.random().toString(36).substring(2,10)}function xD(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 jN(t,e,n=null,r,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Ny(e):e,state:n,key:e&&e.key||r||WQ(),unstable_mask:i}}function pS({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 Ny(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 $Q(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(),M=S==null?null:S-c;c=S,l&&l({action:a,location:_.location,delta:M})}function m(S,M){a="PUSH";let C=gD(S)?S:jN(_.location,S,M);c=d()+1;let A=xD(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,M){a="REPLACE";let C=gD(S)?S:jN(_.location,S,M);c=d();let A=xD(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 qQ(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(mD,p),l=S,()=>{i.removeEventListener(mD,p),l=null}},createHref(S){return e(i,S)},createURL:b,encodeLocation(S){let M=b(S);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:m,replace:x,go(S){return o.go(S)}};return _}function qQ(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),io(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:pS(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function fU(t,e,n="/"){return XQ(t,e,n,!1)}function XQ(t,e,n,r){let i=typeof e=="string"?Ny(e):e,s=yp(i.pathname||"/",n);if(s==null)return null;let o=hU(t);YQ(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=oJ(s);a=iJ(o[l],c,r)}return a}function hU(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;io(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=sh([r,d.relativePath]),m=n.concat(d);o.children&&o.children.length>0&&(io(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),hU(o.children,e,m,p,l)),!(o.path==null&&!o.index)&&e.push({path:p,score:nJ(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 pU(o.path))s(o,a,!0,c)}),e}function pU(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=pU(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 YQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:rJ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var KQ=/^:[\w-]+$/,ZQ=3,QQ=2,JQ=1,eJ=10,tJ=-2,vD=t=>t==="*";function nJ(t,e){let n=t.split("/"),r=n.length;return n.some(vD)&&(r+=tJ),e&&(r+=QQ),n.filter(i=>!vD(i)).reduce((i,s)=>i+(KQ.test(s)?ZQ:s===""?JQ:eJ),r)}function rJ(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 iJ(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=x2({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),m=l.route;if(!p&&c&&n&&!r[r.length-1].route.index&&(p=x2({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:sh([s,p.pathname]),pathnameBase:uJ(sh([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=sh([s,p.pathnameBase]))}return o}function x2(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=sJ(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 sJ(t,e=!1,n=!0){nf(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 oJ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return nf(!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 yp(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 aJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function lJ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Ny(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=yD(n.substring(1),"/"):s=yD(n,e)):s=e,{pathname:s,search:dJ(r),hash:fJ(i)}}function yD(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 sA(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 cJ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function mU(t){let e=cJ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function n7(t,e,n,r=!1){let i;typeof t=="string"?i=Ny(t):(i={...t},io(!i.pathname||!i.pathname.includes("?"),sA("?","pathname","search",i)),io(!i.pathname||!i.pathname.includes("#"),sA("#","pathname","hash",i)),io(!i.search||!i.search.includes("#"),sA("#","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=lJ(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var sh=t=>t.join("/").replace(/\/\/+/g,"/"),uJ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),dJ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,fJ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,hJ=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 pJ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function mJ(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gU=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xU(t,e){let n=t;if(typeof n!="string"||!aJ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(gU)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=yp(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{nf(!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 vU=["POST","PUT","PATCH","DELETE"];new Set(vU);var gJ=["GET",...vU];new Set(gJ);var ky=w.createContext(null);ky.displayName="DataRouter";var uT=w.createContext(null);uT.displayName="DataRouterState";var xJ=w.createContext(!1),yU=w.createContext({isTransitioning:!1});yU.displayName="ViewTransition";var vJ=w.createContext(new Map);vJ.displayName="Fetchers";var yJ=w.createContext(null);yJ.displayName="Await";var pd=w.createContext(null);pd.displayName="Navigation";var mw=w.createContext(null);mw.displayName="Location";var Ap=w.createContext({outlet:null,matches:[],isDataRoute:!1});Ap.displayName="Route";var r7=w.createContext(null);r7.displayName="RouteError";var bU="REACT_ROUTER_ERROR",bJ="REDIRECT",_J="ROUTE_ERROR_RESPONSE";function SJ(t){if(t.startsWith(`${bU}:${bJ}:{`))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 wJ(t){if(t.startsWith(`${bU}:${_J}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new hJ(e.status,e.statusText,e.data)}catch{}}function MJ(t,{relative:e}={}){io(gw(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(pd),{hash:i,pathname:s,search:o}=xw(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:sh([n,s])),r.createHref({pathname:a,search:o,hash:i})}function gw(){return w.useContext(mw)!=null}function xh(){return io(gw(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(mw).location}var _U="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function SU(t){w.useContext(pd).static||w.useLayoutEffect(t)}function dT(){let{isDataRoute:t}=w.useContext(Ap);return t?jJ():TJ()}function TJ(){io(gw(),"useNavigate() may be used only in the context of a <Router> component.");let t=w.useContext(ky),{basename:e,navigator:n}=w.useContext(pd),{matches:r}=w.useContext(Ap),{pathname:i}=xh(),s=JSON.stringify(mU(r)),o=w.useRef(!1);return SU(()=>{o.current=!0}),w.useCallback((l,c={})=>{if(nf(o.current,_U),!o.current)return;if(typeof l=="number"){n.go(l);return}let d=n7(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:sh([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}w.createContext(null);function xw(t,{relative:e}={}){let{matches:n}=w.useContext(Ap),{pathname:r}=xh(),i=JSON.stringify(mU(n));return w.useMemo(()=>n7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function CJ(t,e){return wU(t,e)}function wU(t,e,n){var S;io(gw(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(pd),{matches:i}=w.useContext(Ap),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let M=c&&c.path||"";TU(a,!c||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${M}">) 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="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let d=xh(),p;if(e){let M=typeof e=="string"?Ny(e):e;io(l==="/"||((S=M.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 "${M.pathname}" was given in the \`location\` prop.`),p=M}else p=d;let m=p.pathname||"/",x=m;if(l!=="/"){let M=l.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(M.length).join("/")}let b=fU(t,{pathname:x});nf(c||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),nf(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 _=RJ(b&&b.map(M=>Object.assign({},M,{params:Object.assign({},o,M.params),pathname:sh([l,r.encodeLocation?r.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?l:sh([l,r.encodeLocation?r.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),i,n);return e&&_?w.createElement(mw.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},_):_}function EJ(){let t=LJ(),e=pJ(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=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:s},"ErrorBoundary")," or"," ",w.createElement("code",{style:s},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:i},n):null,o)}var AJ=w.createElement(EJ,null),MU=class extends w.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=wJ(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(Ap.Provider,{value:this.props.routeContext},w.createElement(r7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(NJ,{error:t},e):e}};MU.contextType=xJ;var oA=new WeakMap;function NJ({children:t,error:e}){let{basename:n}=w.useContext(pd);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=SJ(e.digest);if(r){let i=oA.get(e);if(i)throw i;let s=xU(r.location,n);if(gU&&!oA.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 oA.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function kJ({routeContext:t,match:e,children:n}){let r=w.useContext(ky);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(Ap.Provider,{value:t},n)}function RJ(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);io(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:mJ(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||AJ,o&&(a<0&&m===0?(TU("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 M=e.concat(i.slice(0,m+1)),C=()=>{let A;return x?A=_:b?A=S:p.route.Component?A=w.createElement(p.route.Component,null):p.route.element?A=p.route.element:A=d,w.createElement(kJ,{match:p,routeContext:{outlet:d,matches:M,isDataRoute:r!=null},children:A})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?w.createElement(MU,{location:r.location,revalidation:r.revalidation,component:_,error:x,children:C(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:c}):C()},null)}function i7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function PJ(t){let e=w.useContext(ky);return io(e,i7(t)),e}function DJ(t){let e=w.useContext(uT);return io(e,i7(t)),e}function IJ(t){let e=w.useContext(Ap);return io(e,i7(t)),e}function s7(t){let e=IJ(t),n=e.matches[e.matches.length-1];return io(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function OJ(){return s7("useRouteId")}function LJ(){var r;let t=w.useContext(r7),e=DJ("useRouteError"),n=s7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function jJ(){let{router:t}=PJ("useNavigate"),e=s7("useNavigate"),n=w.useRef(!1);return SU(()=>{n.current=!0}),w.useCallback(async(i,s={})=>{nf(n.current,_U),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var bD={};function TU(t,e,n){!e&&!bD[t]&&(bD[t]=!0,nf(!1,n))}w.memo(zJ);function zJ({routes:t,future:e,state:n,isStatic:r,onError:i}){return wU(t,void 0,{state:n,isStatic:r,onError:i})}function Gf(t){io(!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 FJ({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){io(!gw(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=w.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=Ny(n));let{pathname:c="/",search:d="",hash:p="",state:m=null,key:x="default",unstable_mask:b}=n,_=w.useMemo(()=>{let S=yp(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 nf(_!=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:w.createElement(pd.Provider,{value:l},w.createElement(mw.Provider,{children:e,value:_}))}function UJ({children:t,location:e}){return CJ(zN(t),e)}function zN(t,e=[]){let n=[];return w.Children.forEach(t,(r,i)=>{if(!w.isValidElement(r))return;let s=[...e,i];if(r.type===w.Fragment){n.push.apply(n,zN(r.props.children,s));return}io(r.type===Gf,`[${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>`),io(!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=zN(r.props.children,s)),n.push(o)}),n}var QM="get",JM="application/x-www-form-urlencoded";function fT(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function BJ(t){return fT(t)&&t.tagName.toLowerCase()==="button"}function HJ(t){return fT(t)&&t.tagName.toLowerCase()==="form"}function VJ(t){return fT(t)&&t.tagName.toLowerCase()==="input"}function GJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function WJ(t,e){return t.button===0&&(!e||e==="_self")&&!GJ(t)}function FN(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 $J(t,e){let n=FN(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var f4=null;function qJ(){if(f4===null)try{new FormData(document.createElement("form"),0),f4=!1}catch{f4=!0}return f4}var XJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function aA(t){return t!=null&&!XJ.has(t)?(nf(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${JM}"`),null):t}function YJ(t,e){let n,r,i,s,o;if(HJ(t)){let a=t.getAttribute("action");r=a?yp(a,e):null,n=t.getAttribute("method")||QM,i=aA(t.getAttribute("enctype"))||JM,s=new FormData(t)}else if(BJ(t)||VJ(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?yp(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||QM,i=aA(t.getAttribute("formenctype"))||aA(a.getAttribute("enctype"))||JM,s=new FormData(a,t),!qJ()){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(fT(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=QM,r=null,i=JM,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 o7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function KJ(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&&yp(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function ZJ(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 QJ(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 JJ(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await ZJ(s,n);return o.links?o.links():[]}return[]}));return ree(r.flat(1).filter(QJ).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function _D(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 eee(t,e,{includeHydrateFallback:n}={}){return tee(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 tee(t){return[...new Set(t)]}function nee(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function ree(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(nee(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function CU(){let t=w.useContext(ky);return o7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function iee(){let t=w.useContext(uT);return o7(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var a7=w.createContext(void 0);a7.displayName="FrameworkContext";function EU(){let t=w.useContext(a7);return o7(t,"You must render this element inside a <HydratedRouter> element"),t}function see(t,e){let n=w.useContext(a7),[r,i]=w.useState(!1),[s,o]=w.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:p}=e,m=w.useRef(null);w.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let _=M=>{M.forEach(C=>{o(C.isIntersecting)})},S=new IntersectionObserver(_,{threshold:.5});return m.current&&S.observe(m.current),()=>{S.disconnect()}}},[t]),w.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:r_(a,x),onBlur:r_(l,b),onMouseEnter:r_(c,x),onMouseLeave:r_(d,b),onTouchStart:r_(p,x)}]:[!1,m,{}]}function r_(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function oee({page:t,...e}){let{router:n}=CU(),r=w.useMemo(()=>fU(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?w.createElement(lee,{page:t,matches:r,...e}):null}function aee(t){let{manifest:e,routeModules:n}=EU(),[r,i]=w.useState([]);return w.useEffect(()=>{let s=!1;return JJ(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function lee({page:t,matches:e,...n}){let r=xh(),{future:i,manifest:s,routeModules:o}=EU(),{basename:a}=CU(),{loaderData:l,matches:c}=iee(),d=w.useMemo(()=>_D(t,e,c,s,r,"data"),[t,e,c,s,r]),p=w.useMemo(()=>_D(t,e,c,s,r,"assets"),[t,e,c,s,r]),m=w.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 M=KJ(t,a,i.unstable_trailingSlashAwareDataRequests,"data");return S&&_.size>0&&M.searchParams.set("_routes",e.filter(C=>_.has(C.route.id)).map(C=>C.route.id).join(",")),[M.pathname+M.search]},[a,i.unstable_trailingSlashAwareDataRequests,l,r,s,d,e,t,o]),x=w.useMemo(()=>eee(p,s),[p,s]),b=aee(p);return w.createElement(w.Fragment,null,m.map(_=>w.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),x.map(_=>w.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:S})=>w.createElement("link",{key:_,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function cee(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var uee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{uee&&(window.__reactRouterVersion="7.13.1")}catch{}function dee({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=w.useRef();i.current==null&&(i.current=GQ({window:r,v5Compat:!0}));let s=i.current,[o,a]=w.useState({action:s.action,location:s.location}),l=w.useCallback(c=>{n===!1?a(c):w.startTransition(()=>a(c))},[n]);return w.useLayoutEffect(()=>s.listen(l),[s,l]),w.createElement(FJ,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var AU=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,v2=w.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:M,unstable_useTransitions:C}=w.useContext(pd),A=typeof d=="string"&&AU.test(d),N=xU(d,S);d=N.to;let D=MJ(d,{relative:i}),R=xh(),L=null;if(a){let G=n7(a,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);S!=="/"&&(G.pathname=G.pathname==="/"?S:sh([S,G.pathname])),L=M.createHref(G)}let[k,O,F]=see(r,b),B=mee(d,{replace:o,unstable_mask:a,state:l,target:c,preventScrollReset:p,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:x,unstable_useTransitions:C});function Y(G){e&&e(G),G.defaultPrevented||B(G)}let V=!(N.isExternal||s),q=w.createElement("a",{...b,...F,href:(V?L:void 0)||N.absoluteURL||D,onClick:V?Y:e,ref:cee(_,O),target:c,"data-discover":!A&&n==="render"?"true":void 0});return k&&!A?w.createElement(w.Fragment,null,q,w.createElement(oee,{page:D})):q});v2.displayName="Link";var fee=w.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=xw(o,{relative:c.relative}),m=xh(),x=w.useContext(uT),{navigator:b,basename:_}=w.useContext(pd),S=x!=null&&bee(p)&&a===!0,M=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,M=M.toLowerCase()),A&&_&&(A=yp(A,_)||A);const N=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let D=C===M||!i&&C.startsWith(M)&&C.charAt(N)==="/",R=A!=null&&(A===M||!i&&A.startsWith(M)&&A.charAt(M.length)==="/"),L={isActive:D,isPending:R,isTransitioning:S},k=D?e:void 0,O;typeof r=="function"?O=r(L):O=[r,D?"active":null,R?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let F=typeof s=="function"?s(L):s;return w.createElement(v2,{...c,"aria-current":k,className:O,ref:d,style:F,to:o,viewTransition:a},typeof l=="function"?l(L):l)});fee.displayName="NavLink";var hee=w.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=QM,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m,...x},b)=>{let{unstable_useTransitions:_}=w.useContext(pd),S=vee(),M=yee(a,{relative:c}),C=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&AU.test(a),N=D=>{if(l&&l(D),D.defaultPrevented)return;D.preventDefault();let R=D.nativeEvent.submitter,L=(R==null?void 0:R.getAttribute("formmethod"))||o,k=()=>S(R||D.currentTarget,{fetcherKey:e,method:L,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m});_&&n!==!1?w.startTransition(()=>k()):k()};return w.createElement("form",{ref:b,method:C,action:M,onSubmit:r?l:N,...x,"data-discover":!A&&t==="render"?"true":void 0})});hee.displayName="Form";function pee(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function NU(t){let e=w.useContext(ky);return io(e,pee(t)),e}function mee(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=dT(),p=xh(),m=xw(t,{relative:o});return w.useCallback(x=>{if(WJ(x,e)){x.preventDefault();let b=n!==void 0?n:pS(p)===pS(m),_=()=>d(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l});c?w.startTransition(()=>_()):_()}},[p,d,m,n,r,i,e,t,s,o,a,l,c])}function l7(t){nf(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=w.useRef(FN(t)),n=w.useRef(!1),r=xh(),i=w.useMemo(()=>$J(r.search,n.current?null:e.current),[r.search]),s=dT(),o=w.useCallback((a,l)=>{const c=FN(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var gee=0,xee=()=>`__${String(++gee)}__`;function vee(){let{router:t}=NU("useSubmit"),{basename:e}=w.useContext(pd),n=OJ(),r=t.fetch,i=t.navigate;return w.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:p}=YJ(s,e);if(o.navigate===!1){let m=o.fetcherKey||xee();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 yee(t,{relative:e}={}){let{basename:n}=w.useContext(pd),r=w.useContext(Ap);io(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...xw(t||".",{relative:e})},o=xh();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:sh([n,s.pathname])),pS(s)}function bee(t,{relative:e}={}){let n=w.useContext(yU);io(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=NU("useViewTransitionState"),i=xw(t,{relative:e});if(!n.isTransitioning)return!1;let s=yp(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=yp(n.nextLocation.pathname,r)||n.nextLocation.pathname;return x2(i.pathname,o)!=null||x2(i.pathname,s)!=null}var $l=uU();const _ee=Ay($l);var Ry=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(){}},See={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},U0,t7,ZF,wee=(ZF=class{constructor(){Bn(this,U0,See);Bn(this,t7,!1)}setTimeoutProvider(t){yn(this,U0,t)}setTimeout(t,e){return ot(this,U0).setTimeout(t,e)}clearTimeout(t){ot(this,U0).clearTimeout(t)}setInterval(t,e){return ot(this,U0).setInterval(t,e)}clearInterval(t){ot(this,U0).clearInterval(t)}},U0=new WeakMap,t7=new WeakMap,ZF),qg=new wee;function Mee(t){setTimeout(t,0)}var px=typeof window>"u"||"Deno"in globalThis;function Hl(){}function Tee(t,e){return typeof t=="function"?t(e):t}function UN(t){return typeof t=="number"&&t>=0&&t!==1/0}function kU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function em(t,e){return typeof t=="function"?t(e):t}function Zu(t,e){return typeof t=="function"?t(e):t}function SD(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==c7(o,e.options))return!1}else if(!gS(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 wD(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(mS(e.options.mutationKey)!==mS(s))return!1}else if(!gS(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function c7(t,e){return((e==null?void 0:e.queryKeyHashFn)||mS)(t)}function mS(t){return JSON.stringify(t,(e,n)=>BN(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function gS(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>gS(t[n],e[n])):!1}var Cee=Object.prototype.hasOwnProperty;function u7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=MD(t)&&MD(e);if(!r&&!(BN(t)&&BN(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:Cee.call(t,p))&&c++;continue}if(m===null||x===null||typeof m!="object"||typeof x!="object"){l[p]=x;continue}const b=u7(m,x,n+1);l[p]=b,b===m&&c++}return s===a&&c===s?t:l}function y2(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 MD(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function BN(t){if(!TD(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!TD(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function TD(t){return Object.prototype.toString.call(t)==="[object Object]"}function Eee(t){return new Promise(e=>{qg.setTimeout(e,t)})}function HN(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?u7(t,e):e}function Lc(t){return t}function Aee(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function Nee(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var d7=Symbol();function RU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===d7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function PU(t,e){return typeof t=="function"?t(...e):!!t}function kee(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 Jg,B0,z1,QF,Ree=(QF=class extends Ry{constructor(){super();Bn(this,Jg);Bn(this,B0);Bn(this,z1);yn(this,z1,e=>{if(!px&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ot(this,B0)||this.setEventListener(ot(this,z1))}onUnsubscribe(){var e;this.hasListeners()||((e=ot(this,B0))==null||e.call(this),yn(this,B0,void 0))}setEventListener(e){var n;yn(this,z1,e),(n=ot(this,B0))==null||n.call(this),yn(this,B0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ot(this,Jg)!==e&&(yn(this,Jg,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ot(this,Jg)=="boolean"?ot(this,Jg):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Jg=new WeakMap,B0=new WeakMap,z1=new WeakMap,QF),f7=new Ree;function VN(){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 Pee=Mee;function Dee(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=Pee;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 Yo=Dee(),F1,H0,U1,JF,Iee=(JF=class extends Ry{constructor(){super();Bn(this,F1,!0);Bn(this,H0);Bn(this,U1);yn(this,U1,e=>{if(!px&&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,H0)||this.setEventListener(ot(this,U1))}onUnsubscribe(){var e;this.hasListeners()||((e=ot(this,H0))==null||e.call(this),yn(this,H0,void 0))}setEventListener(e){var n;yn(this,U1,e),(n=ot(this,H0))==null||n.call(this),yn(this,H0,e(this.setOnline.bind(this)))}setOnline(e){ot(this,F1)!==e&&(yn(this,F1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ot(this,F1)}},F1=new WeakMap,H0=new WeakMap,U1=new WeakMap,JF),b2=new Iee;function Oee(t){return Math.min(1e3*2**t,3e4)}function DU(t){return(t??"online")==="online"?b2.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 IU(t){let e=!1,n=0,r;const i=VN(),s=()=>i.status!=="pending",o=_=>{var S;if(!s()){const M=new GN(_);m(M),(S=t.onCancel)==null||S.call(t,M)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>f7.isFocused()&&(t.networkMode==="always"||b2.isOnline())&&t.canRun(),d=()=>DU(t.networkMode)&&t.canRun(),p=_=>{s()||(r==null||r(),i.resolve(_))},m=_=>{s()||(r==null||r(),i.reject(_))},x=()=>new Promise(_=>{var S;r=M=>{(s()||c())&&_(M)},(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(M){_=Promise.reject(M)}Promise.resolve(_).then(p).catch(M=>{var R;if(s())return;const C=t.retry??(px?0:3),A=t.retryDelay??Oee,N=typeof A=="function"?A(n,M):A,D=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,M);if(e||!D){m(M);return}n++,(R=t.onFail)==null||R.call(t,n,M),Eee(N).then(()=>c()?void 0:x()).then(()=>{e?m(M):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 ex,eU,OU=(eU=class{constructor(){Bn(this,ex)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UN(this.gcTime)&&yn(this,ex,qg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(px?1/0:300*1e3))}clearGcTimeout(){ot(this,ex)&&(qg.clearTimeout(ot(this,ex)),yn(this,ex,void 0))}},ex=new WeakMap,eU),tx,B1,Yu,nx,Ca,sw,rx,Xd,sp,tU,Lee=(tU=class extends OU{constructor(e){super();Bn(this,Xd);Bn(this,tx);Bn(this,B1);Bn(this,Yu);Bn(this,nx);Bn(this,Ca);Bn(this,sw);Bn(this,rx);yn(this,rx,!1),yn(this,sw,e.defaultOptions),this.setOptions(e.options),this.observers=[],yn(this,nx,e.client),yn(this,Yu,ot(this,nx).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,yn(this,tx,ED(this.options)),this.state=e.state??ot(this,tx),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ot(this,Ca))==null?void 0:e.promise}setOptions(e){if(this.options={...ot(this,sw),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ED(this.options);n.data!==void 0&&(this.setState(CD(n.data,n.dataUpdatedAt)),yn(this,tx,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ot(this,Yu).remove(this)}setData(e,n){const r=HN(this.state.data,e,this.options);return yr(this,Xd,sp).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){yr(this,Xd,sp).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ot(this,Ca))==null?void 0:r.promise;return(i=ot(this,Ca))==null||i.cancel(e),n?n.then(Hl).catch(Hl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ot(this,tx))}isActive(){return this.observers.some(e=>Zu(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===d7||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>em(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:!kU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ot(this,Ca))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ot(this,Ca))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ot(this,Yu).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,Ca)&&(ot(this,rx)?ot(this,Ca).cancel({revert:!0}):ot(this,Ca).cancelRetry()),this.scheduleGc()),ot(this,Yu).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yr(this,Xd,sp).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,d,p,m,x,b,_,S,M,C,A;if(this.state.fetchStatus!=="idle"&&((l=ot(this,Ca))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ot(this,Ca))return ot(this,Ca).continueRetry(),ot(this,Ca).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:()=>(yn(this,rx,!0),r.signal)})},s=()=>{const N=RU(this.options,n),R=(()=>{const L={client:ot(this,nx),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return yn(this,rx,!1),this.options.persister?this.options.persister(N,R,this):N(R)},a=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ot(this,nx),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(a,this),yn(this,B1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&yr(this,Xd,sp).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta}),yn(this,Ca,IU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:N=>{N instanceof GN&&N.revert&&this.setState({...ot(this,B1),fetchStatus:"idle"}),r.abort()},onFail:(N,D)=>{yr(this,Xd,sp).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{yr(this,Xd,sp).call(this,{type:"pause"})},onContinue:()=>{yr(this,Xd,sp).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const N=await ot(this,Ca).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(x=(m=ot(this,Yu).config).onSuccess)==null||x.call(m,N,this),(_=(b=ot(this,Yu).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof GN){if(N.silent)return ot(this,Ca).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw yr(this,Xd,sp).call(this,{type:"error",error:N}),(M=(S=ot(this,Yu).config).onError)==null||M.call(S,N,this),(A=(C=ot(this,Yu).config).onSettled)==null||A.call(C,this.state.data,N,this),N}finally{this.scheduleGc()}}},tx=new WeakMap,B1=new WeakMap,Yu=new WeakMap,nx=new WeakMap,Ca=new WeakMap,sw=new WeakMap,rx=new WeakMap,Xd=new WeakSet,sp=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,...LU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...CD(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return yn(this,B1,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),Yo.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ot(this,Yu).notify({query:this,type:"updated",action:e})})},tU);function LU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:DU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function CD(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ED(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 Ec,di,ow,Bl,ix,H1,cp,V0,aw,V1,G1,sx,ox,G0,W1,Gi,A_,WN,$N,qN,XN,YN,KN,ZN,jU,nU,h7=(nU=class extends Ry{constructor(e,n){super();Bn(this,Gi);Bn(this,Ec);Bn(this,di);Bn(this,ow);Bn(this,Bl);Bn(this,ix);Bn(this,H1);Bn(this,cp);Bn(this,V0);Bn(this,aw);Bn(this,V1);Bn(this,G1);Bn(this,sx);Bn(this,ox);Bn(this,G0);Bn(this,W1,new Set);this.options=n,yn(this,Ec,e),yn(this,V0,null),yn(this,cp,VN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ot(this,di).addObserver(this),AD(ot(this,di),this.options)?yr(this,Gi,A_).call(this):this.updateResult(),yr(this,Gi,XN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return QN(ot(this,di),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return QN(ot(this,di),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yr(this,Gi,YN).call(this),yr(this,Gi,KN).call(this),ot(this,di).removeObserver(this)}setOptions(e){const n=this.options,r=ot(this,di);if(this.options=ot(this,Ec).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zu(this.options.enabled,ot(this,di))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yr(this,Gi,ZN).call(this),ot(this,di).setOptions(this.options),n._defaulted&&!y2(this.options,n)&&ot(this,Ec).getQueryCache().notify({type:"observerOptionsUpdated",query:ot(this,di),observer:this});const i=this.hasListeners();i&&ND(ot(this,di),r,this.options,n)&&yr(this,Gi,A_).call(this),this.updateResult(),i&&(ot(this,di)!==r||Zu(this.options.enabled,ot(this,di))!==Zu(n.enabled,ot(this,di))||em(this.options.staleTime,ot(this,di))!==em(n.staleTime,ot(this,di)))&&yr(this,Gi,WN).call(this);const s=yr(this,Gi,$N).call(this);i&&(ot(this,di)!==r||Zu(this.options.enabled,ot(this,di))!==Zu(n.enabled,ot(this,di))||s!==ot(this,G0))&&yr(this,Gi,qN).call(this,s)}getOptimisticResult(e){const n=ot(this,Ec).getQueryCache().build(ot(this,Ec),e),r=this.createResult(n,e);return zee(this,r)&&(yn(this,Bl,r),yn(this,H1,this.options),yn(this,ix,ot(this,di).state)),r}getCurrentResult(){return ot(this,Bl)}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,cp).status==="pending"&&ot(this,cp).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ot(this,W1).add(e)}getCurrentQuery(){return ot(this,di)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ot(this,Ec).defaultQueryOptions(e),r=ot(this,Ec).getQueryCache().build(ot(this,Ec),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return yr(this,Gi,A_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ot(this,Bl)))}createResult(e,n){var O;const r=ot(this,di),i=this.options,s=ot(this,Bl),o=ot(this,ix),a=ot(this,H1),c=e!==r?e.state:ot(this,ow),{state:d}=e;let p={...d},m=!1,x;if(n._optimisticResults){const F=this.hasListeners(),B=!F&&AD(e,n),Y=F&&ND(e,r,n,i);(B||Y)&&(p={...p,...LU(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:_,status:S}=p;x=p.data;let M=!1;if(n.placeholderData!==void 0&&x===void 0&&S==="pending"){let F;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(F=s.data,M=!0):F=typeof n.placeholderData=="function"?n.placeholderData((O=ot(this,G1))==null?void 0:O.state.data,ot(this,G1)):n.placeholderData,F!==void 0&&(S="success",x=HN(s==null?void 0:s.data,F,n),m=!0)}if(n.select&&x!==void 0&&!M)if(s&&x===(o==null?void 0:o.data)&&n.select===ot(this,aw))x=ot(this,V1);else try{yn(this,aw,n.select),x=n.select(x),x=HN(s==null?void 0:s.data,x,n),yn(this,V1,x),yn(this,V0,null)}catch(F){yn(this,V0,F)}ot(this,V0)&&(b=ot(this,V0),x=ot(this,V1),_=Date.now(),S="error");const C=p.fetchStatus==="fetching",A=S==="pending",N=S==="error",D=A&&C,R=x!==void 0,k={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&&!R,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&R,isStale:p7(e,n),refetch:this.refetch,promise:ot(this,cp),isEnabled:Zu(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const F=k.data!==void 0,B=k.status==="error"&&!F,Y=G=>{B?G.reject(k.error):F&&G.resolve(k.data)},V=()=>{const G=yn(this,cp,k.promise=VN());Y(G)},q=ot(this,cp);switch(q.status){case"pending":e.queryHash===r.queryHash&&Y(q);break;case"fulfilled":(B||k.data!==q.value)&&V();break;case"rejected":(!B||k.error!==q.reason)&&V();break}}return k}updateResult(){const e=ot(this,Bl),n=this.createResult(ot(this,di),this.options);if(yn(this,ix,ot(this,di).state),yn(this,H1,this.options),ot(this,ix).data!==void 0&&yn(this,G1,ot(this,di)),y2(n,e))return;yn(this,Bl,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ot(this,W1).size)return!0;const o=new Set(s??ot(this,W1));return this.options.throwOnError&&o.add("error"),Object.keys(ot(this,Bl)).some(a=>{const l=a;return ot(this,Bl)[l]!==e[l]&&o.has(l)})};yr(this,Gi,jU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yr(this,Gi,XN).call(this)}},Ec=new WeakMap,di=new WeakMap,ow=new WeakMap,Bl=new WeakMap,ix=new WeakMap,H1=new WeakMap,cp=new WeakMap,V0=new WeakMap,aw=new WeakMap,V1=new WeakMap,G1=new WeakMap,sx=new WeakMap,ox=new WeakMap,G0=new WeakMap,W1=new WeakMap,Gi=new WeakSet,A_=function(e){yr(this,Gi,ZN).call(this);let n=ot(this,di).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Hl)),n},WN=function(){yr(this,Gi,YN).call(this);const e=em(this.options.staleTime,ot(this,di));if(px||ot(this,Bl).isStale||!UN(e))return;const r=kU(ot(this,Bl).dataUpdatedAt,e)+1;yn(this,sx,qg.setTimeout(()=>{ot(this,Bl).isStale||this.updateResult()},r))},$N=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ot(this,di)):this.options.refetchInterval)??!1},qN=function(e){yr(this,Gi,KN).call(this),yn(this,G0,e),!(px||Zu(this.options.enabled,ot(this,di))===!1||!UN(ot(this,G0))||ot(this,G0)===0)&&yn(this,ox,qg.setInterval(()=>{(this.options.refetchIntervalInBackground||f7.isFocused())&&yr(this,Gi,A_).call(this)},ot(this,G0)))},XN=function(){yr(this,Gi,WN).call(this),yr(this,Gi,qN).call(this,yr(this,Gi,$N).call(this))},YN=function(){ot(this,sx)&&(qg.clearTimeout(ot(this,sx)),yn(this,sx,void 0))},KN=function(){ot(this,ox)&&(qg.clearInterval(ot(this,ox)),yn(this,ox,void 0))},ZN=function(){const e=ot(this,Ec).getQueryCache().build(ot(this,Ec),this.options);if(e===ot(this,di))return;const n=ot(this,di);yn(this,di,e),yn(this,ow,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},jU=function(e){Yo.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ot(this,Bl))}),ot(this,Ec).getQueryCache().notify({query:ot(this,di),type:"observerResultsUpdated"})})},nU);function jee(t,e){return Zu(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function AD(t,e){return jee(t,e)||t.state.data!==void 0&&QN(t,e,e.refetchOnMount)}function QN(t,e,n){if(Zu(e.enabled,t)!==!1&&em(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&p7(t,e)}return!1}function ND(t,e,n,r){return(t!==e||Zu(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&p7(t,n)}function p7(t,e){return Zu(e.enabled,t)!==!1&&t.isStaleByTime(em(e.staleTime,t))}function zee(t,e){return!y2(t.getCurrentResult(),e)}function kD(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=>{kee(A,()=>e.signal,()=>_=!0)},M=RU(e.options,e.fetchOptions),C=async(A,N,D)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const L=(()=>{const B={client:e.client,queryKey:e.queryKey,pageParam:N,direction:D?"backward":"forward",meta:e.options.meta};return S(B),B})(),k=await M(L),{maxPages:O}=e.options,F=D?Nee:Aee;return{pages:F(A.pages,k,O),pageParams:F(A.pageParams,N,O)}};if(i&&s.length){const A=i==="backward",N=A?Fee:RD,D={pages:s,pageParams:o},R=N(r,D);a=await C(D,R,A)}else{const A=t??s.length;do{const N=l===0?o[0]??r.initialPageParam:RD(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 RD(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 Fee(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 lw,qf,ml,ax,Xf,D0,rU,Uee=(rU=class extends OU{constructor(e){super();Bn(this,Xf);Bn(this,lw);Bn(this,qf);Bn(this,ml);Bn(this,ax);yn(this,lw,e.client),this.mutationId=e.mutationId,yn(this,ml,e.mutationCache),yn(this,qf,[]),this.state=e.state||Bee(),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,qf).includes(e)||(ot(this,qf).push(e),this.clearGcTimeout(),ot(this,ml).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){yn(this,qf,ot(this,qf).filter(n=>n!==e)),this.scheduleGc(),ot(this,ml).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ot(this,qf).length||(this.state.status==="pending"?this.scheduleGc():ot(this,ml).remove(this))}continue(){var e;return((e=ot(this,ax))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,p,m,x,b,_,S,M,C,A,N,D,R,L;const n=()=>{yr(this,Xf,D0).call(this,{type:"continue"})},r={client:ot(this,lw),meta:this.options.meta,mutationKey:this.options.mutationKey};yn(this,ax,IU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(k,O)=>{yr(this,Xf,D0).call(this,{type:"failed",failureCount:k,error:O})},onPause:()=>{yr(this,Xf,D0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ot(this,ml).canRun(this)}));const i=this.state.status==="pending",s=!ot(this,ax).canStart();try{if(i)n();else{yr(this,Xf,D0).call(this,{type:"pending",variables:e,isPaused:s}),ot(this,ml).config.onMutate&&await ot(this,ml).config.onMutate(e,this,r);const O=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));O!==this.state.context&&yr(this,Xf,D0).call(this,{type:"pending",context:O,variables:e,isPaused:s})}const k=await ot(this,ax).start();return await((c=(l=ot(this,ml).config).onSuccess)==null?void 0:c.call(l,k,e,this.state.context,this,r)),await((p=(d=this.options).onSuccess)==null?void 0:p.call(d,k,e,this.state.context,r)),await((x=(m=ot(this,ml).config).onSettled)==null?void 0:x.call(m,k,null,this.state.variables,this.state.context,this,r)),await((_=(b=this.options).onSettled)==null?void 0:_.call(b,k,null,e,this.state.context,r)),yr(this,Xf,D0).call(this,{type:"success",data:k}),k}catch(k){try{await((M=(S=ot(this,ml).config).onError)==null?void 0:M.call(S,k,e,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((A=(C=this.options).onError)==null?void 0:A.call(C,k,e,this.state.context,r))}catch(O){Promise.reject(O)}try{await((D=(N=ot(this,ml).config).onSettled)==null?void 0:D.call(N,void 0,k,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((L=(R=this.options).onSettled)==null?void 0:L.call(R,void 0,k,e,this.state.context,r))}catch(O){Promise.reject(O)}throw yr(this,Xf,D0).call(this,{type:"error",error:k}),k}finally{ot(this,ml).runNext(this)}}},lw=new WeakMap,qf=new WeakMap,ml=new WeakMap,ax=new WeakMap,Xf=new WeakSet,D0=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),Yo.batch(()=>{ot(this,qf).forEach(r=>{r.onMutationUpdate(e)}),ot(this,ml).notify({mutation:this,type:"updated",action:e})})},rU);function Bee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var up,Yd,cw,iU,Hee=(iU=class extends Ry{constructor(e={}){super();Bn(this,up);Bn(this,Yd);Bn(this,cw);this.config=e,yn(this,up,new Set),yn(this,Yd,new Map),yn(this,cw,0)}build(e,n,r){const i=new Uee({client:e,mutationCache:this,mutationId:++d4(this,cw)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ot(this,up).add(e);const n=h4(e);if(typeof n=="string"){const r=ot(this,Yd).get(n);r?r.push(e):ot(this,Yd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ot(this,up).delete(e)){const n=h4(e);if(typeof n=="string"){const r=ot(this,Yd).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,Yd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=h4(e);if(typeof n=="string"){const r=ot(this,Yd).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=h4(e);if(typeof n=="string"){const i=(r=ot(this,Yd).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(){Yo.batch(()=>{ot(this,up).forEach(e=>{this.notify({type:"removed",mutation:e})}),ot(this,up).clear(),ot(this,Yd).clear()})}getAll(){return Array.from(ot(this,up))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>wD(n,r))}findAll(e={}){return this.getAll().filter(n=>wD(e,n))}notify(e){Yo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Yo.batch(()=>Promise.all(e.map(n=>n.continue().catch(Hl))))}},up=new WeakMap,Yd=new WeakMap,cw=new WeakMap,iU);function h4(t){var e;return(e=t.options.scope)==null?void 0:e.id}function PD(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function Vee(t,e,n){const r=t.slice(0);return r[e]=n,r}var $1,tu,q1,X1,Ku,W0,uw,dw,fw,hw,Ka,JN,ek,tk,nk,rk,sU,Gee=(sU=class extends Ry{constructor(e,n,r){super();Bn(this,Ka);Bn(this,$1);Bn(this,tu);Bn(this,q1);Bn(this,X1);Bn(this,Ku);Bn(this,W0);Bn(this,uw);Bn(this,dw);Bn(this,fw);Bn(this,hw,[]);yn(this,$1,e),yn(this,X1,r),yn(this,q1,[]),yn(this,Ku,[]),yn(this,tu,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&ot(this,Ku).forEach(e=>{e.subscribe(n=>{yr(this,Ka,nk).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,ot(this,Ku).forEach(e=>{e.destroy()})}setQueries(e,n){yn(this,q1,e),yn(this,X1,n),Yo.batch(()=>{const r=ot(this,Ku),i=yr(this,Ka,tk).call(this,ot(this,q1));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,tu)[m];return!x||!y2(p,x)});!c&&!d||(c&&(yn(this,hw,i),yn(this,Ku,s)),yn(this,tu,o),this.hasListeners()&&(c&&(PD(r,s).forEach(p=>{p.destroy()}),PD(s,r).forEach(p=>{p.subscribe(m=>{yr(this,Ka,nk).call(this,p,m)})})),yr(this,Ka,rk).call(this)))})}getCurrentResult(){return ot(this,tu)}getQueries(){return ot(this,Ku).map(e=>e.getCurrentQuery())}getObservers(){return ot(this,Ku)}getOptimisticResult(e,n){const r=yr(this,Ka,tk).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>yr(this,Ka,ek).call(this,o??i,n,s),()=>yr(this,Ka,JN).call(this,i,r)]}},$1=new WeakMap,tu=new WeakMap,q1=new WeakMap,X1=new WeakMap,Ku=new WeakMap,W0=new WeakMap,uw=new WeakMap,dw=new WeakMap,fw=new WeakMap,hw=new WeakMap,Ka=new WeakSet,JN=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)})})})},ek=function(e,n,r){if(n){const i=ot(this,fw),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!ot(this,W0)||ot(this,tu)!==ot(this,dw)||s||n!==ot(this,uw))&&(yn(this,uw,n),yn(this,dw,ot(this,tu)),r!==void 0&&yn(this,fw,r),yn(this,W0,u7(ot(this,W0),n(e)))),ot(this,W0)}return e},tk=function(e){const n=new Map;ot(this,Ku).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,$1).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new h7(ot(this,$1),s);r.push({defaultedQueryOptions:s,observer:a})}),r},nk=function(e,n){const r=ot(this,Ku).indexOf(e);r!==-1&&(yn(this,tu,Vee(ot(this,tu),r,n)),yr(this,Ka,rk).call(this))},rk=function(){var e;if(this.hasListeners()){const n=ot(this,W0),r=yr(this,Ka,JN).call(this,ot(this,tu),ot(this,hw)),i=yr(this,Ka,ek).call(this,r,(e=ot(this,X1))==null?void 0:e.combine);n!==i&&Yo.batch(()=>{this.listeners.forEach(s=>{s(ot(this,tu))})})}},sU),Yf,oU,Wee=(oU=class extends Ry{constructor(e={}){super();Bn(this,Yf);this.config=e,yn(this,Yf,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??c7(i,n);let o=this.get(s);return o||(o=new Lee({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ot(this,Yf).has(e.queryHash)||(ot(this,Yf).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ot(this,Yf).get(e.queryHash);n&&(e.destroy(),n===e&&ot(this,Yf).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Yo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ot(this,Yf).get(e)}getAll(){return[...ot(this,Yf).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>SD(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>SD(e,r)):n}notify(e){Yo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Yo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Yo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yf=new WeakMap,oU),yo,$0,q0,Y1,K1,X0,Z1,Q1,aU,$ee=(aU=class{constructor(t={}){Bn(this,yo);Bn(this,$0);Bn(this,q0);Bn(this,Y1);Bn(this,K1);Bn(this,X0);Bn(this,Z1);Bn(this,Q1);yn(this,yo,t.queryCache||new Wee),yn(this,$0,t.mutationCache||new Hee),yn(this,q0,t.defaultOptions||{}),yn(this,Y1,new Map),yn(this,K1,new Map),yn(this,X0,0)}mount(){d4(this,X0)._++,ot(this,X0)===1&&(yn(this,Z1,f7.subscribe(async t=>{t&&(await this.resumePausedMutations(),ot(this,yo).onFocus())})),yn(this,Q1,b2.subscribe(async t=>{t&&(await this.resumePausedMutations(),ot(this,yo).onOnline())})))}unmount(){var t,e;d4(this,X0)._--,ot(this,X0)===0&&((t=ot(this,Z1))==null||t.call(this),yn(this,Z1,void 0),(e=ot(this,Q1))==null||e.call(this),yn(this,Q1,void 0))}isFetching(t){return ot(this,yo).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ot(this,$0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ot(this,yo).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ot(this,yo).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(em(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ot(this,yo).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,yo).get(r.queryHash),s=i==null?void 0:i.state.data,o=Tee(e,s);if(o!==void 0)return ot(this,yo).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Yo.batch(()=>ot(this,yo).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,yo).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ot(this,yo);Yo.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ot(this,yo);return Yo.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Yo.batch(()=>ot(this,yo).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Hl).catch(Hl)}invalidateQueries(t,e={}){return Yo.batch(()=>(ot(this,yo).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=Yo.batch(()=>ot(this,yo).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Hl)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Hl)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ot(this,yo).build(this,e);return n.isStaleByTime(em(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Hl).catch(Hl)}fetchInfiniteQuery(t){return t.behavior=kD(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Hl).catch(Hl)}ensureInfiniteQueryData(t){return t.behavior=kD(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return b2.isOnline()?ot(this,$0).resumePausedMutations():Promise.resolve()}getQueryCache(){return ot(this,yo)}getMutationCache(){return ot(this,$0)}getDefaultOptions(){return ot(this,q0)}setDefaultOptions(t){yn(this,q0,t)}setQueryDefaults(t,e){ot(this,Y1).set(mS(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ot(this,Y1).values()],n={};return e.forEach(r=>{gS(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ot(this,K1).set(mS(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ot(this,K1).values()],n={};return e.forEach(r=>{gS(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ot(this,q0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=c7(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===d7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ot(this,q0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ot(this,yo).clear(),ot(this,$0).clear()}},yo=new WeakMap,$0=new WeakMap,q0=new WeakMap,Y1=new WeakMap,K1=new WeakMap,X0=new WeakMap,Z1=new WeakMap,Q1=new WeakMap,aU),zU=w.createContext(void 0),Cx=t=>{const e=w.useContext(zU);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},qee=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),f.jsx(zU.Provider,{value:t,children:e})),FU=w.createContext(!1),UU=()=>w.useContext(FU);FU.Provider;function Xee(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Yee=w.createContext(Xee()),BU=()=>w.useContext(Yee),HU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?PU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},VU=t=>{w.useEffect(()=>{t.clearReset()},[t])},GU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||PU(n,[t.error,r])),WU=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))}},Kee=(t,e)=>t.isLoading&&t.isFetching&&!e,ik=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sk=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function Zee({queries:t,...e},n){const r=Cx(),i=UU(),s=BU(),o=w.useMemo(()=>t.map(_=>{const S=r.defaultQueryOptions(_);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,r,i]);o.forEach(_=>{WU(_);const S=r.getQueryCache().get(_.queryHash);HU(_,s,S)}),VU(s);const[a]=w.useState(()=>new Gee(r,o,e)),[l,c,d]=a.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;w.useSyncExternalStore(w.useCallback(_=>p?a.subscribe(Yo.batchCalls(_)):Hl,[a,p]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(o,e)},[o,e,a]);const x=l.some((_,S)=>ik(o[S],_))?l.flatMap((_,S)=>{const M=o[S];if(M&&ik(M,_)){const C=new h7(r,M);return sk(M,C,s)}return[]}):[];if(x.length>0)throw Promise.all(x);const b=l.find((_,S)=>{const M=o[S];return M&&GU({result:_,errorResetBoundary:s,throwOnError:M.throwOnError,query:r.getQueryCache().get(M.queryHash),suspense:M.suspense})});if(b!=null&&b.error)throw b.error;return c(d())}function Qee(t,e,n){var m,x,b,_;const r=UU(),i=BU(),s=Cx(),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",WU(o),HU(o,i,a),VU(i);const l=!s.getQueryCache().get(o.queryHash),[c]=w.useState(()=>new e(s,o)),d=c.getOptimisticResult(o),p=!r&&t.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(S=>{const M=p?c.subscribe(Yo.batchCalls(S)):Hl;return c.updateResult(),M},[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),ik(o,d))throw sk(o,c,i);if(GU({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&&!px&&Kee(d,r)){const S=l?sk(o,c,i):a==null?void 0:a.promise;S==null||S.catch(Hl).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function Ei(t,e){return Qee(t,h7)}const Zf={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function $U(t){return"init"in t}function ok(t){return!!t.write}function DD(t){return"v"in t||"e"in t}function _2(t){if("e"in t)throw t.e;if((Zf?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function S2(t){return typeof(t==null?void 0:t.then)=="function"}function qU(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function XU(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 Jee=(t,e,...n)=>e.read(...n),ete=(t,e,...n)=>e.write(...n),tte=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},nte=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},rte=(t,e)=>{var n;const r=ha(t),i=r[0],s=r[6],o=r[9];if((Zf?"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},ite=t=>{const e=ha(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)},ste=t=>{const e=ha(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((Zf?"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 XU(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)}},ak=new WeakSet,ote=(t,e)=>{var n,r;const i=ha(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],M=i[26],C=d(t,e);if(DD(C)){if(s.has(e)&&o.get(e)!==C.n)return C;let V=!1;for(const[q,G]of C.d)if(x(t,q).n!==G){V=!0;break}if(!V)return C}let A=!0;const N=new Set(C.d.keys()),D=new Map,R=()=>{for(const V of N)D.has(V)||C.d.delete(V)},L=()=>{if(s.has(e)){const V=!a.size;_(t,e),V&&(m(t),p(t))}},k=V=>{var q;if(V===e){const $=d(t,V);if(!DD($))if($U(V))S(t,V,V.init);else throw new Error("no atom init");return _2($)}const G=x(t,V);try{return _2(G)}finally{D.set(V,G.n),C.d.set(V,G.n),S2(C.v)&&qU(e,C.v,G),s.has(e)&&((q=s.get(V))==null||q.t.add(e)),A||L()}};let O,F;const B={get signal(){return O||(O=new AbortController),O.signal},get setSelf(){return(Zf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Zf?"production":void 0)!=="production"&&!ok(e)&&console.warn("setSelf function cannot be used with read-only atom"),!F&&ok(e)&&(F=(...V)=>{if((Zf?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...V)}finally{m(t),p(t)}}),F}},Y=C.n;try{(Zf?"production":void 0)!=="production"&&ak.delete(t);const V=c(t,e,k,B);if((Zf?"production":void 0)!=="production"&&ak.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),S(t,e,V),S2(V)){M(t,V,()=>O==null?void 0:O.abort());const q=()=>{R(),L()};V.then(q,q)}else R();return(n=l.r)==null||n.call(l,e),C}catch(V){return delete C.v,C.e=V,++C.n,C}finally{A=!1,Y!==C.n&&o.get(e)===Y&&(o.set(e,C.n),a.add(e),(r=l.c)==null||r.call(l,e))}},ate=(t,e)=>{const n=ha(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 XU(a,l,r)){const d=s(t,c);i.get(c)!==d.n&&(i.set(c,d.n),o.push(c))}}},lte=(t,e,...n)=>{const r=ha(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=>_2(d(t,C)),M=(C,...A)=>{var N;const D=a(t,C);try{if(C===e){if(!$U(C))throw new Error("atom not writable");(Zf?"production":void 0)!=="production"&&ak.add(t);const R=D.n,L=A[0];b(t,C,L),x(t,C),R!==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,M,...n)}finally{_=!1}},cte=(t,e)=>{var n;const r=ha(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)}}},ute=(t,e)=>{var n;const r=ha(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,_),ok(e)){const S=()=>{let M=!0;const C=(...A)=>{try{return m(t,e,...A)}finally{M||(d(t),c(t))}};try{const A=a(t,e,C);A&&(_.u=()=>{M=!0;try{A()}finally{M=!1}})}finally{M=!1}};s.add(S)}(n=o.m)==null||n.call(o,e)}return _},dte=(t,e)=>{var n,r;const i=ha(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},fte=(t,e,n)=>{const r=ha(t),i=r[11],s=r[27],o=i(t,e),a="v"in o,l=o.v;if(S2(n))for(const c of o.d.keys())qU(e,n,i(t,c));o.v=n,delete o.e,(!a||!Object.is(l,o.v))&&(++o.n,S2(l)&&s(t,l))},hte=(t,e)=>{const n=ha(t)[14];return _2(n(t,e))},pte=(t,e,...n)=>{const r=ha(t),i=r[12],s=r[13],o=r[16];try{return o(t,e,...n)}finally{s(t),i(t)}},mte=(t,e,n)=>{const r=ha(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)}},gte=(t,e,n)=>{const i=ha(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)},xte=(t,e)=>{const i=ha(t)[25].get(e);i==null||i.forEach(s=>s())},YU=new WeakMap,ha=t=>{const e=YU.get(t);if((Zf?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function vte(t){const e=ha(t),n=e[24];return n?n(e):e}function yte(...t){const e={get(r){const i=ha(e)[21];return i(e,r)},set(r,...i){const s=ha(e)[22];return s(e,r,...i)},sub(r,i){const s=ha(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Jee,ete,tte,nte,rte,ite,ste,ote,ate,lte,cte,ute,dte,fte,hte,pte,mte,void 0,new WeakMap,gte,xte].map((r,i)=>t[i]||r);return YU.set(e,Object.freeze(n)),e}const KU={};let bte=0;function Rr(t,e){const n=`atom${++bte}`,r={toString(){return(KU?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=_te,r.write=Ste),e&&(r.write=e),r}function _te(t){return t(this)}function Ste(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function ZU(){return yte()}let i_;function wte(){return i_||(i_=ZU(),(KU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=i_),globalThis.__JOTAI_DEFAULT_STORE__!==i_&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),i_}const Mte={},lk=w.createContext(void 0);function QU(t){return w.useContext(lk)||wte()}function Tte({children:t,store:e}){const n=w.useRef(null);return e?w.createElement(lk.Provider,{value:e},t):(n.current===null&&(n.current=ZU()),w.createElement(lk.Provider,{value:n.current},t))}const ck=t=>typeof(t==null?void 0:t.then)=="function",uk=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},Cte=ni.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(uk(t),t)}),lA=new WeakMap,ID=(t,e,n)=>{const i=vte(t)[26];let s=lA.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();ck(m)?(lA.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)}),lA.set(e,s)),s};function qn(t,e){const{delay:n,unstable_promiseStatus:r=!ni.use}={},i=QU(),[[s,o,a],l]=w.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)),w.useEffect(()=>{const d=i.sub(t,()=>{if(r)try{const p=i.get(t);ck(p)&&uk(ID(i,p,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[i,t,n,r]),w.useDebugValue(c),ck(c)){const d=ID(i,c,()=>i.get(t));return r&&uk(d),Cte(d)}return c}function td(t,e){const n=QU();return w.useCallback((...i)=>{if((Mte?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function hn(t,e){return[qn(t),td(t)]}function OD(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function hT(...t){return e=>{let n=!1;const r=t.map(i=>{const s=OD(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():OD(t[i],null)}}}}function Gr(...t){return w.useCallback(hT(...t),t)}function rm(t){const e=Ete(t),n=w.forwardRef((r,i)=>{const{children:s,...o}=r,a=w.Children.toArray(s),l=a.find(Ate);if(l){const c=l.props.children,d=a.map(p=>p===l?w.Children.count(c)>1?w.Children.only(null):w.isValidElement(c)?c.props.children:null:p);return f.jsx(e,{...o,ref:i,children:w.isValidElement(c)?w.cloneElement(c,void 0,d):null})}return f.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var JU=rm("Slot");function Ete(t){const e=w.forwardRef((n,r)=>{const{children:i,...s}=n;if(w.isValidElement(i)){const o=kte(i),a=Nte(s,i.props);return i.type!==w.Fragment&&(a.ref=r?hT(r,o):o),w.cloneElement(i,a)}return w.Children.count(i)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var eB=Symbol("radix.slottable");function tB(t){const e=({children:n})=>f.jsx(f.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=eB,e}function Ate(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===eB}function Nte(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 kte(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 Rte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hr=Rte.reduce((t,e)=>{const n=rm(`Primitive.${e}`),r=w.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 nB(t,e){t&&$l.flushSync(()=>t.dispatchEvent(e))}var rB=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"}),Pte="VisuallyHidden",iB=w.forwardRef((t,e)=>f.jsx(hr.span,{...t,ref:e,style:{...rB,...t.style}}));iB.displayName=Pte;var Dte=iB;function Ite(t,e){const n=w.createContext(e),r=s=>{const{children:o,...a}=s,l=w.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=w.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 yu(t,e=[]){let n=[];function r(s,o){const a=w.createContext(o),l=n.length;n=[...n,o];const c=p=>{var M;const{scope:m,children:x,...b}=p,_=((M=m==null?void 0:m[t])==null?void 0:M[l])||a,S=w.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=w.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=>w.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return w.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,Ote(i,...e)]}function Ote(...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 w.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function m7(t){const e=t+"CollectionProvider",[n,r]=yu(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:S,children:M}=_,C=ni.useRef(null),A=ni.useRef(new Map).current;return f.jsx(i,{scope:S,itemMap:A,collectionRef:C,children:M})};o.displayName=e;const a=t+"CollectionSlot",l=rm(a),c=ni.forwardRef((_,S)=>{const{scope:M,children:C}=_,A=s(a,M),N=Gr(S,A.collectionRef);return f.jsx(l,{ref:N,children:C})});c.displayName=a;const d=t+"CollectionItemSlot",p="data-radix-collection-item",m=rm(d),x=ni.forwardRef((_,S)=>{const{scope:M,children:C,...A}=_,N=ni.useRef(null),D=Gr(S,N),R=s(d,M);return ni.useEffect(()=>(R.itemMap.set(N,{ref:N,...A}),()=>void R.itemMap.delete(N))),f.jsx(m,{[p]:"",ref:D,children:C})});x.displayName=d;function b(_){const S=s(t+"CollectionConsumer",_);return ni.useCallback(()=>{const C=S.collectionRef.current;if(!C)return[];const A=Array.from(C.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((R,L)=>A.indexOf(R.ref.current)-A.indexOf(L.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:c,ItemSlot:x},b,r]}function Tn(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 Na=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Lte=lU[" useInsertionEffect ".trim().toString()]||Na;function cd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=jte({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=w.useRef(t!==void 0);w.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=w.useCallback(d=>{var p;if(a){const m=zte(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 jte({defaultProp:t,onChange:e}){const[n,r]=w.useState(t),i=w.useRef(n),s=w.useRef(e);return Lte(()=>{s.current=e},[e]),w.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function zte(t){return typeof t=="function"}function Fte(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var Za=t=>{const{present:e,children:n}=t,r=Ute(e),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),s=Gr(r.ref,Bte(i));return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:s}):null};Za.displayName="Presence";function Ute(t){const[e,n]=w.useState(),r=w.useRef(null),i=w.useRef(t),s=w.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Fte(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=p4(r.current);s.current=a==="mounted"?c:"none"},[a]),Na(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,x=p4(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]),Na(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,p=x=>{const _=p4(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=p4(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:w.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function p4(t){return(t==null?void 0:t.animationName)||"none"}function Bte(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 Hte=lU[" useId ".trim().toString()]||(()=>{}),Vte=0;function Ic(t){const[e,n]=w.useState(Hte());return Na(()=>{n(r=>r??String(Vte++))},[t]),t||(e?`radix-${e}`:"")}var pT="Collapsible",[Gte]=yu(pT),[Wte,g7]=Gte(pT),sB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=cd({prop:r,defaultProp:i??!1,onChange:o,caller:pT});return f.jsx(Wte,{scope:n,disabled:s,contentId:Ic(),open:l,onOpenToggle:w.useCallback(()=>c(d=>!d),[c]),children:f.jsx(hr.div,{"data-state":v7(l),"data-disabled":s?"":void 0,...a,ref:e})})});sB.displayName=pT;var oB="CollapsibleTrigger",aB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=g7(oB,n);return f.jsx(hr.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":v7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Tn(t.onClick,i.onOpenToggle)})});aB.displayName=oB;var x7="CollapsibleContent",lB=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=g7(x7,t.__scopeCollapsible);return f.jsx(Za,{present:n||i.open,children:({present:s})=>f.jsx($te,{...r,ref:e,present:s})})});lB.displayName=x7;var $te=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=g7(x7,n),[a,l]=w.useState(r),c=w.useRef(null),d=Gr(e,c),p=w.useRef(0),m=p.current,x=w.useRef(0),b=x.current,_=o.open||a,S=w.useRef(_),M=w.useRef(void 0);return w.useEffect(()=>{const C=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(C)},[]),Na(()=>{const C=c.current;if(C){M.current=M.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=M.current.transitionDuration,C.style.animationName=M.current.animationName),l(r)}},[o.open,r]),f.jsx(hr.div,{"data-state":v7(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 v7(t){return t?"open":"closed"}var qte=sB,Xte=aB,Yte=lB,Kte=w.createContext(void 0);function vw(t){const e=w.useContext(Kte);return t||e||"ltr"}function Aa(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Zte(t,e=globalThis==null?void 0:globalThis.document){const n=Aa(t);w.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 Qte="DismissableLayer",dk="dismissableLayer.update",Jte="dismissableLayer.pointerDownOutside",ene="dismissableLayer.focusOutside",LD,cB=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Py=w.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=w.useContext(cB),[d,p]=w.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=w.useState({}),b=Gr(e,L=>p(L)),_=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),M=_.indexOf(S),C=d?_.indexOf(d):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=C>=M,D=rne(L=>{const k=L.target,O=[...c.branches].some(F=>F.contains(k));!N||O||(i==null||i(L),o==null||o(L),L.defaultPrevented||a==null||a())},m),R=ine(L=>{const k=L.target;[...c.branches].some(F=>F.contains(k))||(s==null||s(L),o==null||o(L),L.defaultPrevented||a==null||a())},m);return Zte(L=>{C===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},m),w.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(LD=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),jD(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=LD)}},[d,m,n,c]),w.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),jD())},[d,c]),w.useEffect(()=>{const L=()=>x({});return document.addEventListener(dk,L),()=>document.removeEventListener(dk,L)},[]),f.jsx(hr.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:Tn(t.onFocusCapture,R.onFocusCapture),onBlurCapture:Tn(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Tn(t.onPointerDownCapture,D.onPointerDownCapture)})});Py.displayName=Qte;var tne="DismissableLayerBranch",nne=w.forwardRef((t,e)=>{const n=w.useContext(cB),r=w.useRef(null),i=Gr(e,r);return w.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),f.jsx(hr.div,{...t,ref:i})});nne.displayName=tne;function rne(t,e=globalThis==null?void 0:globalThis.document){const n=Aa(t),r=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){uB(Jte,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 ine(t,e=globalThis==null?void 0:globalThis.document){const n=Aa(t),r=w.useRef(!1);return w.useEffect(()=>{const i=s=>{s.target&&!r.current&&uB(ene,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 jD(){const t=new CustomEvent(dk);document.dispatchEvent(t)}function uB(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?nB(i,s):i.dispatchEvent(s)}var cA="focusScope.autoFocusOnMount",uA="focusScope.autoFocusOnUnmount",zD={bubbles:!1,cancelable:!0},sne="FocusScope",yw=w.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=w.useState(null),c=Aa(i),d=Aa(s),p=w.useRef(null),m=Gr(e,_=>l(_)),x=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let _=function(A){if(x.paused||!a)return;const N=A.target;a.contains(N)?p.current=N:I0(p.current,{select:!0})},S=function(A){if(x.paused||!a)return;const N=A.relatedTarget;N!==null&&(a.contains(N)||I0(p.current,{select:!0}))},M=function(A){if(document.activeElement===document.body)for(const D of A)D.removedNodes.length>0&&I0(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",S);const C=new MutationObserver(M);return a&&C.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),C.disconnect()}}},[r,a,x.paused]),w.useEffect(()=>{if(a){UD.add(x);const _=document.activeElement;if(!a.contains(_)){const M=new CustomEvent(cA,zD);a.addEventListener(cA,c),a.dispatchEvent(M),M.defaultPrevented||(one(dne(dB(a)),{select:!0}),document.activeElement===_&&I0(a))}return()=>{a.removeEventListener(cA,c),setTimeout(()=>{const M=new CustomEvent(uA,zD);a.addEventListener(uA,d),a.dispatchEvent(M),M.defaultPrevented||I0(_??document.body,{select:!0}),a.removeEventListener(uA,d),UD.remove(x)},0)}}},[a,c,d,x]);const b=w.useCallback(_=>{if(!n&&!r||x.paused)return;const S=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,M=document.activeElement;if(S&&M){const C=_.currentTarget,[A,N]=ane(C);A&&N?!_.shiftKey&&M===N?(_.preventDefault(),n&&I0(A,{select:!0})):_.shiftKey&&M===A&&(_.preventDefault(),n&&I0(N,{select:!0})):M===C&&_.preventDefault()}},[n,r,x.paused]);return f.jsx(hr.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});yw.displayName=sne;function one(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(I0(r,{select:e}),document.activeElement!==n)return}function ane(t){const e=dB(t),n=FD(e,t),r=FD(e.reverse(),t);return[n,r]}function dB(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 FD(t,e){for(const n of t)if(!lne(n,{upTo:e}))return n}function lne(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 cne(t){return t instanceof HTMLInputElement&&"select"in t}function I0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&cne(t)&&e&&t.select()}}var UD=une();function une(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=BD(t,e),t.unshift(e)},remove(e){var n;t=BD(t,e),(n=t[0])==null||n.resume()}}}function BD(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function dne(t){return t.filter(e=>e.tagName!=="A")}var fne="Portal",Dy=w.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=w.useState(!1);Na(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?_ee.createPortal(f.jsx(hr.div,{...r,ref:e}),o):null});Dy.displayName=fne;var dA=0;function mT(){w.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??HD()),document.body.insertAdjacentElement("beforeend",t[1]??HD()),dA++,()=>{dA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),dA--}},[])}function HD(){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 fB(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 hne(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 e2="right-scroll-bar-position",t2="width-before-scroll-bar",pne="with-scroll-bars-hidden",mne="--removed-body-scroll-bar-size";function fA(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function gne(t,e){var n=w.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 xne=typeof window<"u"?w.useLayoutEffect:w.useEffect,VD=new WeakMap;function vne(t,e){var n=gne(null,function(r){return t.forEach(function(i){return fA(i,r)})});return xne(function(){var r=VD.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||fA(a,null)}),s.forEach(function(a){i.has(a)||fA(a,o)})}VD.set(n,t)},[t]),n}function yne(t){return t}function bne(t,e){e===void 0&&(e=yne);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 _ne(t){t===void 0&&(t={});var e=bne(null);return e.options=Qf({async:!0,ssr:!1},t),e}var hB=function(t){var e=t.sideCar,n=fB(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 w.createElement(r,Qf({},n))};hB.isSideCarExport=!0;function Sne(t,e){return t.useMedium(e),hB}var pB=_ne(),hA=function(){},gT=w.forwardRef(function(t,e){var n=w.useRef(null),r=w.useState({onScrollCapture:hA,onWheelCapture:hA,onTouchMoveCapture:hA}),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,M=t.as,C=M===void 0?"div":M,A=t.gapMode,N=fB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=m,R=vne([n,e]),L=Qf(Qf({},N),i);return w.createElement(w.Fragment,null,d&&w.createElement(D,{sideCar:pB,removeScrollBar:c,shards:p,noRelative:x,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!S,lockRef:n,gapMode:A}),o?w.cloneElement(w.Children.only(a),Qf(Qf({},L),{ref:R})):w.createElement(C,Qf({},L,{className:l,ref:R}),a))});gT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gT.classNames={fullWidth:t2,zeroRight:e2};var wne=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mne(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wne();return e&&t.setAttribute("nonce",e),t}function Tne(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Cne(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Ene=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Mne())&&(Tne(e,n),Cne(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Ane=function(){var t=Ene();return function(e,n){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},mB=function(){var t=Ane(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},Nne={left:0,top:0,right:0,gap:0},pA=function(t){return parseInt(t||"",10)||0},kne=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[pA(n),pA(r),pA(i)]},Rne=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Nne;var e=kne(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])}},Pne=mB(),w1="data-scroll-locked",Dne=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(pne,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(w1,`] {
    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(e2,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(t2,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(e2," .").concat(e2,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(t2," .").concat(t2,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(w1,`] {
    `).concat(mne,": ").concat(a,`px;
  }
`)},GD=function(){var t=parseInt(document.body.getAttribute(w1)||"0",10);return isFinite(t)?t:0},Ine=function(){w.useEffect(function(){return document.body.setAttribute(w1,(GD()+1).toString()),function(){var t=GD()-1;t<=0?document.body.removeAttribute(w1):document.body.setAttribute(w1,t.toString())}},[])},One=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;Ine();var s=w.useMemo(function(){return Rne(i)},[i]);return w.createElement(Pne,{styles:Dne(s,!e,i,n?"":"!important")})},fk=!1;if(typeof window<"u")try{var m4=Object.defineProperty({},"passive",{get:function(){return fk=!0,!0}});window.addEventListener("test",m4,m4),window.removeEventListener("test",m4,m4)}catch{fk=!1}var Lv=fk?{passive:!1}:!1,Lne=function(t){return t.tagName==="TEXTAREA"},gB=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Lne(t)&&n[e]==="visible")},jne=function(t){return gB(t,"overflowY")},zne=function(t){return gB(t,"overflowX")},WD=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=xB(t,r);if(i){var s=vB(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fne=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Une=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},xB=function(t,e){return t==="v"?jne(e):zne(e)},vB=function(t,e){return t==="v"?Fne(e):Une(e)},Bne=function(t,e){return t==="h"&&e==="rtl"?-1:1},Hne=function(t,e,n,r,i){var s=Bne(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=vB(t,a),b=x[0],_=x[1],S=x[2],M=_-S-s*b;(b||M)&&xB(t,a)&&(p+=M,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},g4=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},$D=function(t){return[t.deltaX,t.deltaY]},qD=function(t){return t&&"current"in t?t.current:t},Vne=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Gne=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Wne=0,jv=[];function $ne(t){var e=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(Wne++)[0],s=w.useState(mB)[0],o=w.useRef(t);w.useEffect(function(){o.current=t},[t]),w.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=hne([t.lockRef.current],(t.shards||[]).map(qD),!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=w.useCallback(function(_,S){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var M=g4(_),C=n.current,A="deltaX"in _?_.deltaX:C[0]-M[0],N="deltaY"in _?_.deltaY:C[1]-M[1],D,R=_.target,L=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&L==="h"&&R.type==="range")return!1;var k=window.getSelection(),O=k&&k.anchorNode,F=O?O===R||O.contains(R):!1;if(F)return!1;var B=WD(L,R);if(!B)return!0;if(B?D=L:(D=L==="v"?"h":"v",B=WD(L,R)),!B)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=D),!D)return!0;var Y=r.current||D;return Hne(Y,S,_,Y==="h"?A:N)},[]),l=w.useCallback(function(_){var S=_;if(!(!jv.length||jv[jv.length-1]!==s)){var M="deltaY"in S?$D(S):g4(S),C=e.current.filter(function(D){return D.name===S.type&&(D.target===S.target||S.target===D.shadowParent)&&Vne(D.delta,M)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var A=(o.current.shards||[]).map(qD).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=w.useCallback(function(_,S,M,C){var A={name:_,delta:S,target:M,should:C,shadowParent:qne(M)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),d=w.useCallback(function(_){n.current=g4(_),r.current=void 0},[]),p=w.useCallback(function(_){c(_.type,$D(_),_.target,a(_,t.lockRef.current))},[]),m=w.useCallback(function(_){c(_.type,g4(_),_.target,a(_,t.lockRef.current))},[]);w.useEffect(function(){return jv.push(s),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Lv),document.addEventListener("touchmove",l,Lv),document.addEventListener("touchstart",d,Lv),function(){jv=jv.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,Lv),document.removeEventListener("touchmove",l,Lv),document.removeEventListener("touchstart",d,Lv)}},[]);var x=t.removeScrollBar,b=t.inert;return w.createElement(w.Fragment,null,b?w.createElement(s,{styles:Gne(i)}):null,x?w.createElement(One,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function qne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Xne=Sne(pB,$ne);var bw=w.forwardRef(function(t,e){return w.createElement(gT,Qf({},t,{ref:e,sideCar:Xne}))});bw.classNames=gT.classNames;var Yne=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},zv=new WeakMap,x4=new WeakMap,v4={},mA=0,yB=function(t){return t&&(t.host||yB(t.parentNode))},Kne=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=yB(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})},Zne=function(t,e,n,r){var i=Kne(e,Array.isArray(t)?t:[t]);v4[n]||(v4[n]=new WeakMap);var s=v4[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",_=(zv.get(m)||0)+1,S=(s.get(m)||0)+1;zv.set(m,_),s.set(m,S),o.push(m),_===1&&b&&x4.set(m,!0),S===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(M){console.error("aria-hidden: cannot operate on ",m,M)}})};return d(e),a.clear(),mA++,function(){o.forEach(function(p){var m=zv.get(p)-1,x=s.get(p)-1;zv.set(p,m),s.set(p,x),m||(x4.has(p)||p.removeAttribute(r),x4.delete(p)),x||p.removeAttribute(n)}),mA--,mA||(zv=new WeakMap,zv=new WeakMap,x4=new WeakMap,v4={})}},xT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Yne(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Zne(r,i,n,"aria-hidden")):function(){return null}},vT="Dialog",[bB,_B]=yu(vT),[Qne,af]=bB(vT),SB=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=w.useRef(null),l=w.useRef(null),[c,d]=cd({prop:r,defaultProp:i??!1,onChange:s,caller:vT});return f.jsx(Qne,{scope:e,triggerRef:a,contentRef:l,contentId:Ic(),titleId:Ic(),descriptionId:Ic(),open:c,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(p=>!p),[d]),modal:o,children:n})};SB.displayName=vT;var wB="DialogTrigger",MB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=af(wB,n),s=Gr(e,i.triggerRef);return f.jsx(hr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":_7(i.open),...r,ref:s,onClick:Tn(t.onClick,i.onOpenToggle)})});MB.displayName=wB;var y7="DialogPortal",[Jne,TB]=bB(y7,{forceMount:void 0}),CB=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=af(y7,e);return f.jsx(Jne,{scope:e,forceMount:n,children:w.Children.map(r,o=>f.jsx(Za,{present:n||s.open,children:f.jsx(Dy,{asChild:!0,container:i,children:o})}))})};CB.displayName=y7;var w2="DialogOverlay",EB=w.forwardRef((t,e)=>{const n=TB(w2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=af(w2,t.__scopeDialog);return s.modal?f.jsx(Za,{present:r||s.open,children:f.jsx(tre,{...i,ref:e})}):null});EB.displayName=w2;var ere=rm("DialogOverlay.RemoveScroll"),tre=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=af(w2,n);return f.jsx(bw,{as:ere,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(hr.div,{"data-state":_7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),mx="DialogContent",AB=w.forwardRef((t,e)=>{const n=TB(mx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=af(mx,t.__scopeDialog);return f.jsx(Za,{present:r||s.open,children:s.modal?f.jsx(nre,{...i,ref:e}):f.jsx(rre,{...i,ref:e})})});AB.displayName=mx;var nre=w.forwardRef((t,e)=>{const n=af(mx,t.__scopeDialog),r=w.useRef(null),i=Gr(e,n.contentRef,r);return w.useEffect(()=>{const s=r.current;if(s)return xT(s)},[]),f.jsx(NB,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tn(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Tn(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Tn(t.onFocusOutside,s=>s.preventDefault())})}),rre=w.forwardRef((t,e)=>{const n=af(mx,t.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return f.jsx(NB,{...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()}})}),NB=w.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=af(mx,n),l=w.useRef(null),c=Gr(e,l);return mT(),f.jsxs(f.Fragment,{children:[f.jsx(yw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:f.jsx(Py,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":_7(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(sre,{titleId:a.titleId}),f.jsx(are,{contentRef:l,descriptionId:a.descriptionId})]})]})}),b7="DialogTitle",kB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=af(b7,n);return f.jsx(hr.h2,{id:i.titleId,...r,ref:e})});kB.displayName=b7;var RB="DialogDescription",PB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=af(RB,n);return f.jsx(hr.p,{id:i.descriptionId,...r,ref:e})});PB.displayName=RB;var DB="DialogClose",IB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=af(DB,n);return f.jsx(hr.button,{type:"button",...r,ref:e,onClick:Tn(t.onClick,()=>i.onOpenChange(!1))})});IB.displayName=DB;function _7(t){return t?"open":"closed"}var OB="DialogTitleWarning",[ire,LB]=Ite(OB,{contentName:mx,titleName:b7,docsSlug:"dialog"}),sre=({titleId:t})=>{const e=LB(OB),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 w.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ore="DialogDescriptionWarning",are=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${LB(ore).contentName}}.`;return w.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},jB=SB,zB=MB,FB=CB,UB=EB,BB=AB,HB=kB,VB=PB,S7=IB,GB="AlertDialog",[lre]=yu(GB,[_B]),Np=_B(),WB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Np(e);return f.jsx(jB,{...r,...n,modal:!0})};WB.displayName=GB;var cre="AlertDialogTrigger",ure=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Np(n);return f.jsx(zB,{...i,...r,ref:e})});ure.displayName=cre;var dre="AlertDialogPortal",$B=t=>{const{__scopeAlertDialog:e,...n}=t,r=Np(e);return f.jsx(FB,{...r,...n})};$B.displayName=dre;var fre="AlertDialogOverlay",qB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Np(n);return f.jsx(UB,{...i,...r,ref:e})});qB.displayName=fre;var M1="AlertDialogContent",[hre,pre]=lre(M1),mre=tB("AlertDialogContent"),XB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=Np(n),o=w.useRef(null),a=Gr(e,o),l=w.useRef(null);return f.jsx(ire,{contentName:M1,titleName:YB,docsSlug:"alert-dialog",children:f.jsx(hre,{scope:n,cancelRef:l,children:f.jsxs(BB,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:Tn(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(mre,{children:r}),f.jsx(xre,{contentRef:o})]})})})});XB.displayName=M1;var YB="AlertDialogTitle",KB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Np(n);return f.jsx(HB,{...i,...r,ref:e})});KB.displayName=YB;var ZB="AlertDialogDescription",QB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Np(n);return f.jsx(VB,{...i,...r,ref:e})});QB.displayName=ZB;var gre="AlertDialogAction",JB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Np(n);return f.jsx(S7,{...i,...r,ref:e})});JB.displayName=gre;var eH="AlertDialogCancel",tH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=pre(eH,n),s=Np(n),o=Gr(e,i);return f.jsx(S7,{...s,...r,ref:o})});tH.displayName=eH;var xre=({contentRef:t})=>{const e=`\`${M1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${M1}\` by passing a \`${ZB}\` 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 \`${M1}\`. 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 w.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},vre=WB,yre=$B,bre=qB,_re=XB,Sre=JB,wre=tH,Mre=KB,Tre=QB,gA={exports:{}},xA={};/**
 * @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 XD;function Cre(){if(XD)return xA;XD=1;var t=pw();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 xA.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,xA}var YD;function Ere(){return YD||(YD=1,gA.exports=Cre()),gA.exports}function Are(t){const e=w.useRef({value:t,previous:t});return w.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Nre(t){const[e,n]=w.useState(void 0);return Na(()=>{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 kre=["top","right","bottom","left"],im=Math.min,nu=Math.max,M2=Math.round,y4=Math.floor,oh=t=>({x:t,y:t}),Rre={left:"right",right:"left",bottom:"top",top:"bottom"},Pre={start:"end",end:"start"};function hk(t,e,n){return nu(t,im(e,n))}function bp(t,e){return typeof t=="function"?t(e):t}function _p(t){return t.split("-")[0]}function Iy(t){return t.split("-")[1]}function w7(t){return t==="x"?"y":"x"}function M7(t){return t==="y"?"height":"width"}const Dre=new Set(["top","bottom"]);function th(t){return Dre.has(_p(t))?"y":"x"}function T7(t){return w7(th(t))}function Ire(t,e,n){n===void 0&&(n=!1);const r=Iy(t),i=T7(t),s=M7(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=T2(o)),[o,T2(o)]}function Ore(t){const e=T2(t);return[pk(t),e,pk(e)]}function pk(t){return t.replace(/start|end/g,e=>Pre[e])}const KD=["left","right"],ZD=["right","left"],Lre=["top","bottom"],jre=["bottom","top"];function zre(t,e,n){switch(t){case"top":case"bottom":return n?e?ZD:KD:e?KD:ZD;case"left":case"right":return e?Lre:jre;default:return[]}}function Fre(t,e,n,r){const i=Iy(t);let s=zre(_p(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(pk)))),s}function T2(t){return t.replace(/left|right|bottom|top/g,e=>Rre[e])}function Ure(t){return{top:0,right:0,bottom:0,left:0,...t}}function nH(t){return typeof t!="number"?Ure(t):{top:t,right:t,bottom:t,left:t}}function C2(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 QD(t,e,n){let{reference:r,floating:i}=t;const s=th(e),o=T7(e),a=M7(o),l=_p(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(Iy(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 Bre(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}=bp(e,t),b=nH(x),S=a[m?p==="floating"?"reference":"floating":p],M=C2(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=C2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:A,strategy:l}):C);return{top:(M.top-D.top+b.top)/N.y,bottom:(D.bottom-M.bottom+b.bottom)/N.y,left:(M.left-D.left+b.left)/N.x,right:(D.right-M.right+b.right)/N.x}}const Hre=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}=QD(c,r,l),m=r,x={},b=0;for(let S=0;S<a.length;S++){var _;const{name:M,fn:C}=a[S],{x:A,y:N,data:D,reset:R}=await C({x:d,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:x,rects:c,platform:{...o,detectOverflow:(_=o.detectOverflow)!=null?_:Bre},elements:{reference:t,floating:e}});d=A??d,p=N??p,x={...x,[M]:{...x[M],...D}},R&&b<=50&&(b++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(c=R.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):R.rects),{x:d,y:p}=QD(c,m,l)),S=-1)}return{x:d,y:p,placement:m,strategy:i,middlewareData:x}},Vre=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}=bp(t,e)||{};if(c==null)return{};const p=nH(d),m={x:n,y:r},x=T7(i),b=M7(x),_=await o.getDimensions(c),S=x==="y",M=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],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let L=R?R[A]:0;(!L||!await(o.isElement==null?void 0:o.isElement(R)))&&(L=a.floating[A]||s.floating[b]);const k=N/2-D/2,O=L/2-_[b]/2-1,F=im(p[M],O),B=im(p[C],O),Y=F,V=L-_[b]-B,q=L/2-_[b]/2+k,G=hk(Y,q,V),$=!l.arrow&&Iy(i)!=null&&q!==G&&s.reference[b]/2-(q<Y?F:B)-_[b]/2<0,Q=$?q<Y?q-Y:q-V:0;return{[x]:m[x]+Q,data:{[x]:G,centerOffset:q-G-Q,...$&&{alignmentOffset:Q}},reset:$}}}),Gre=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}=bp(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const M=_p(i),C=th(a),A=_p(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=m||(A||!_?[T2(a)]:Ore(a)),R=b!=="none";!m&&R&&D.push(...Fre(a,_,b,N));const L=[a,...D],k=await l.detectOverflow(e,S),O=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(k[M]),p){const q=Ire(i,o,N);O.push(k[q[0]],k[q[1]])}if(F=[...F,{placement:i,overflows:O}],!O.every(q=>q<=0)){var B,Y;const q=(((B=s.flip)==null?void 0:B.index)||0)+1,G=L[q];if(G&&(!(p==="alignment"?C!==th(G):!1)||F.every(K=>th(K.placement)===C?K.overflows[0]>0:!0)))return{data:{index:q,overflows:F},reset:{placement:G}};let $=(Y=F.filter(Q=>Q.overflows[0]<=0).sort((Q,K)=>Q.overflows[1]-K.overflows[1])[0])==null?void 0:Y.placement;if(!$)switch(x){case"bestFit":{var V;const Q=(V=F.filter(K=>{if(R){const re=th(K.placement);return re===C||re==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(re=>re>0).reduce((re,U)=>re+U,0)]).sort((K,re)=>K[1]-re[1])[0])==null?void 0:V[0];Q&&($=Q);break}case"initialPlacement":$=a;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function JD(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function eI(t){return kre.some(e=>t[e]>=0)}const Wre=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=bp(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=JD(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:eI(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=JD(o,n.floating);return{data:{escapedOffsets:a,escaped:eI(a)}}}default:return{}}}}},rH=new Set(["left","top"]);async function $re(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_p(n),a=Iy(n),l=th(n)==="y",c=rH.has(o)?-1:1,d=s&&l?-1:1,p=bp(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 qre=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 $re(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}}}}},Xre=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:M=>{let{x:C,y:A}=M;return{x:C,y:A}}},...c}=bp(t,e),d={x:n,y:r},p=await s.detectOverflow(e,c),m=th(_p(i)),x=w7(m);let b=d[x],_=d[m];if(o){const M=x==="y"?"top":"left",C=x==="y"?"bottom":"right",A=b+p[M],N=b-p[C];b=hk(A,b,N)}if(a){const M=m==="y"?"top":"left",C=m==="y"?"bottom":"right",A=_+p[M],N=_-p[C];_=hk(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}}}}}},Yre=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}=bp(t,e),d={x:n,y:r},p=th(i),m=w7(p);let x=d[m],b=d[p];const _=bp(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 M,C;const A=m==="y"?"width":"height",N=rH.has(_p(i)),D=s.reference[p]-s.floating[A]+(N&&((M=o.offset)==null?void 0:M[p])||0)+(N?0:S.crossAxis),R=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>R&&(b=R)}return{[m]:x,[p]:b}}}},Kre=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}=bp(t,e),d=await o.detectOverflow(e,c),p=_p(i),m=Iy(i),x=th(i)==="y",{width:b,height:_}=s.floating;let S,M;p==="top"||p==="bottom"?(S=p,M=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(M=p,S=m==="end"?"top":"bottom");const C=_-d.top-d.bottom,A=b-d.left-d.right,N=im(_-d[S],C),D=im(b-d[M],A),R=!e.middlewareData.shift;let L=N,k=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=C),R&&!m){const F=nu(d.left,0),B=nu(d.right,0),Y=nu(d.top,0),V=nu(d.bottom,0);x?k=b-2*(F!==0||B!==0?F+B:nu(d.left,d.right)):L=_-2*(Y!==0||V!==0?Y+V:nu(d.top,d.bottom))}await l({...e,availableWidth:k,availableHeight:L});const O=await o.getDimensions(a.floating);return b!==O.width||_!==O.height?{reset:{rects:!0}}:{}}}};function yT(){return typeof window<"u"}function Oy(t){return iH(t)?(t.nodeName||"").toLowerCase():"#document"}function uu(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function vh(t){var e;return(e=(iH(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function iH(t){return yT()?t instanceof Node||t instanceof uu(t).Node:!1}function rf(t){return yT()?t instanceof Element||t instanceof uu(t).Element:!1}function uh(t){return yT()?t instanceof HTMLElement||t instanceof uu(t).HTMLElement:!1}function tI(t){return!yT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof uu(t).ShadowRoot}const Zre=new Set(["inline","contents"]);function _w(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=sf(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Zre.has(i)}const Qre=new Set(["table","td","th"]);function Jre(t){return Qre.has(Oy(t))}const eie=[":popover-open",":modal"];function bT(t){return eie.some(e=>{try{return t.matches(e)}catch{return!1}})}const tie=["transform","translate","scale","rotate","perspective"],nie=["transform","translate","scale","rotate","perspective","filter"],rie=["paint","layout","strict","content"];function C7(t){const e=E7(),n=rf(t)?sf(t):t;return tie.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)||nie.some(r=>(n.willChange||"").includes(r))||rie.some(r=>(n.contain||"").includes(r))}function iie(t){let e=sm(t);for(;uh(e)&&!J1(e);){if(C7(e))return e;if(bT(e))return null;e=sm(e)}return null}function E7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sie=new Set(["html","body","#document"]);function J1(t){return sie.has(Oy(t))}function sf(t){return uu(t).getComputedStyle(t)}function _T(t){return rf(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function sm(t){if(Oy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tI(t)&&t.host||vh(t);return tI(e)?e.host:e}function sH(t){const e=sm(t);return J1(e)?t.ownerDocument?t.ownerDocument.body:t.body:uh(e)&&_w(e)?e:sH(e)}function xS(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=sH(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=uu(i);if(s){const a=mk(o);return e.concat(o,o.visualViewport||[],_w(i)?i:[],a&&n?xS(a):[])}return e.concat(i,xS(i,[],n))}function mk(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function oH(t){const e=sf(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=uh(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=M2(n)!==s||M2(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function A7(t){return rf(t)?t:t.contextElement}function T1(t){const e=A7(t);if(!uh(e))return oh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=oH(e);let o=(s?M2(n.width):n.width)/r,a=(s?M2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const oie=oh(0);function aH(t){const e=uu(t);return!E7()||!e.visualViewport?oie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function aie(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==uu(t)?!1:e}function gx(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=A7(t);let o=oh(1);e&&(r?rf(r)&&(o=T1(r)):o=T1(t));const a=aie(s,n,r)?aH(s):oh(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=uu(s),x=r&&rf(r)?uu(r):r;let b=m,_=mk(b);for(;_&&r&&x!==b;){const S=T1(_),M=_.getBoundingClientRect(),C=sf(_),A=M.left+(_.clientLeft+parseFloat(C.paddingLeft))*S.x,N=M.top+(_.clientTop+parseFloat(C.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,p*=S.y,l+=A,c+=N,b=uu(_),_=mk(b)}}return C2({width:d,height:p,x:l,y:c})}function ST(t,e){const n=_T(t).scrollLeft;return e?e.left+n:gx(vh(t)).left+n}function lH(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 lie(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=vh(r),a=e?bT(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=oh(1);const d=oh(0),p=uh(r);if((p||!p&&!s)&&((Oy(r)!=="body"||_w(o))&&(l=_T(r)),uh(r))){const x=gx(r);c=T1(r),d.x=x.x+r.clientLeft,d.y=x.y+r.clientTop}const m=o&&!p&&!s?lH(o,l):oh(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 cie(t){return Array.from(t.getClientRects())}function uie(t){const e=vh(t),n=_T(t),r=t.ownerDocument.body,i=nu(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=nu(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ST(t);const a=-n.scrollTop;return sf(r).direction==="rtl"&&(o+=nu(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const nI=25;function die(t,e){const n=uu(t),r=vh(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=E7();(!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<=nI&&(s-=b)}else c<=nI&&(s+=c);return{width:s,height:o,x:a,y:l}}const fie=new Set(["absolute","fixed"]);function hie(t,e){const n=gx(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=uh(t)?T1(t):oh(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 rI(t,e,n){let r;if(e==="viewport")r=die(t,n);else if(e==="document")r=uie(vh(t));else if(rf(e))r=hie(e,n);else{const i=aH(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return C2(r)}function cH(t,e){const n=sm(t);return n===e||!rf(n)||J1(n)?!1:sf(n).position==="fixed"||cH(n,e)}function pie(t,e){const n=e.get(t);if(n)return n;let r=xS(t,[],!1).filter(a=>rf(a)&&Oy(a)!=="body"),i=null;const s=sf(t).position==="fixed";let o=s?sm(t):t;for(;rf(o)&&!J1(o);){const a=sf(o),l=C7(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&fie.has(i.position)||_w(o)&&!l&&cH(t,o))?r=r.filter(d=>d!==o):i=a,o=sm(o)}return e.set(t,r),r}function mie(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?bT(e)?[]:pie(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,d)=>{const p=rI(e,d,i);return c.top=nu(p.top,c.top),c.right=im(p.right,c.right),c.bottom=im(p.bottom,c.bottom),c.left=nu(p.left,c.left),c},rI(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function gie(t){const{width:e,height:n}=oH(t);return{width:e,height:n}}function xie(t,e,n){const r=uh(e),i=vh(e),s=n==="fixed",o=gx(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=oh(0);function c(){l.x=ST(i)}if(r||!r&&!s)if((Oy(e)!=="body"||_w(i))&&(a=_T(e)),r){const x=gx(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?lH(i,a):oh(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 vA(t){return sf(t).position==="static"}function iI(t,e){if(!uh(t)||sf(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return vh(t)===n&&(n=n.ownerDocument.body),n}function uH(t,e){const n=uu(t);if(bT(t))return n;if(!uh(t)){let i=sm(t);for(;i&&!J1(i);){if(rf(i)&&!vA(i))return i;i=sm(i)}return n}let r=iI(t,e);for(;r&&Jre(r)&&vA(r);)r=iI(r,e);return r&&J1(r)&&vA(r)&&!C7(r)?n:r||iie(t)||n}const vie=async function(t){const e=this.getOffsetParent||uH,n=this.getDimensions,r=await n(t.floating);return{reference:xie(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yie(t){return sf(t).direction==="rtl"}const bie={convertOffsetParentRelativeRectToViewportRelativeRect:lie,getDocumentElement:vh,getClippingRect:mie,getOffsetParent:uH,getElementRects:vie,getClientRects:cie,getDimensions:gie,getScale:T1,isElement:rf,isRTL:yie};function dH(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _ie(t,e){let n=null,r;const i=vh(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=y4(p),_=y4(i.clientWidth-(d+m)),S=y4(i.clientHeight-(p+x)),M=y4(d),A={rootMargin:-b+"px "+-_+"px "+-S+"px "+-M+"px",threshold:nu(0,im(1,l))||1};let N=!0;function D(R){const L=R[0].intersectionRatio;if(L!==l){if(!N)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!dH(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 Sie(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=A7(t),d=i||s?[...c?xS(c):[],...xS(e)]:[];d.forEach(M=>{i&&M.addEventListener("scroll",n,{passive:!0}),s&&M.addEventListener("resize",n)});const p=c&&a?_ie(c,n):null;let m=-1,x=null;o&&(x=new ResizeObserver(M=>{let[C]=M;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?gx(t):null;l&&S();function S(){const M=gx(t);_&&!dH(_,M)&&n(),_=M,b=requestAnimationFrame(S)}return n(),()=>{var M;d.forEach(C=>{i&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),p==null||p(),(M=x)==null||M.disconnect(),x=null,l&&cancelAnimationFrame(b)}}const wie=qre,Mie=Xre,Tie=Gre,Cie=Kre,Eie=Wre,sI=Vre,Aie=Yre,Nie=(t,e,n)=>{const r=new Map,i={platform:bie,...n},s={...i.platform,_c:r};return Hre(t,e,{...i,platform:s})};var kie=typeof document<"u",Rie=function(){},n2=kie?w.useLayoutEffect:Rie;function E2(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(!E2(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)&&!E2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function fH(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function oI(t,e){const n=fH(t);return Math.round(e*n)/n}function yA(t){const e=w.useRef(t);return n2(()=>{e.current=t}),e}function Pie(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]=w.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,x]=w.useState(r);E2(m,r)||x(r);const[b,_]=w.useState(null),[S,M]=w.useState(null),C=w.useCallback(K=>{K!==R.current&&(R.current=K,_(K))},[]),A=w.useCallback(K=>{K!==L.current&&(L.current=K,M(K))},[]),N=s||b,D=o||S,R=w.useRef(null),L=w.useRef(null),k=w.useRef(d),O=l!=null,F=yA(l),B=yA(i),Y=yA(c),V=w.useCallback(()=>{if(!R.current||!L.current)return;const K={placement:e,strategy:n,middleware:m};B.current&&(K.platform=B.current),Nie(R.current,L.current,K).then(re=>{const U={...re,isPositioned:Y.current!==!1};q.current&&!E2(k.current,U)&&(k.current=U,$l.flushSync(()=>{p(U)}))})},[m,e,n,B,Y]);n2(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[c]);const q=w.useRef(!1);n2(()=>(q.current=!0,()=>{q.current=!1}),[]),n2(()=>{if(N&&(R.current=N),D&&(L.current=D),N&&D){if(F.current)return F.current(N,D,V);V()}},[N,D,V,F,O]);const G=w.useMemo(()=>({reference:R,floating:L,setReference:C,setFloating:A}),[C,A]),$=w.useMemo(()=>({reference:N,floating:D}),[N,D]),Q=w.useMemo(()=>{const K={position:n,left:0,top:0};if(!$.floating)return K;const re=oI($.floating,d.x),U=oI($.floating,d.y);return a?{...K,transform:"translate("+re+"px, "+U+"px)",...fH($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:U}},[n,a,$.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:V,refs:G,elements:$,floatingStyles:Q}),[d,V,G,$,Q])}const Die=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?sI({element:r.current,padding:i}).fn(n):{}:r?sI({element:r,padding:i}).fn(n):{}}}},Iie=(t,e)=>({...wie(t),options:[t,e]}),Oie=(t,e)=>({...Mie(t),options:[t,e]}),Lie=(t,e)=>({...Aie(t),options:[t,e]}),jie=(t,e)=>({...Tie(t),options:[t,e]}),zie=(t,e)=>({...Cie(t),options:[t,e]}),Fie=(t,e)=>({...Eie(t),options:[t,e]}),Uie=(t,e)=>({...Die(t),options:[t,e]});var Bie="Arrow",hH=w.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return f.jsx(hr.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"})})});hH.displayName=Bie;var Hie=hH,N7="Popper",[pH,Sm]=yu(N7),[Vie,mH]=pH(N7),gH=t=>{const{__scopePopper:e,children:n}=t,[r,i]=w.useState(null);return f.jsx(Vie,{scope:e,anchor:r,onAnchorChange:i,children:n})};gH.displayName=N7;var xH="PopperAnchor",vH=w.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=mH(xH,n),o=w.useRef(null),a=Gr(e,o),l=w.useRef(null);return w.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(hr.div,{...i,ref:a})});vH.displayName=xH;var k7="PopperContent",[Gie,Wie]=pH(k7),yH=w.forwardRef((t,e)=>{var ee,ie,oe,de,ye,ge;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=mH(k7,n),[M,C]=w.useState(null),A=Gr(e,Me=>C(Me)),[N,D]=w.useState(null),R=Nre(N),L=(R==null?void 0:R.width)??0,k=(R==null?void 0:R.height)??0,O=r+(s!=="center"?"-"+s:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},B=Array.isArray(c)?c:[c],Y=B.length>0,V={padding:F,boundary:B.filter(qie),altBoundary:Y},{refs:q,floatingStyles:G,placement:$,isPositioned:Q,middlewareData:K}=Pie({strategy:"fixed",placement:O,whileElementsMounted:(...Me)=>Sie(...Me,{animationFrame:x==="always"}),elements:{reference:S.anchor},middleware:[Iie({mainAxis:i+k,alignmentAxis:o}),l&&Oie({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Lie():void 0,...V}),l&&jie({...V}),zie({...V,apply:({elements:Me,rects:fe,availableWidth:Se,availableHeight:me})=>{const{width:Pe,height:ce}=fe.reference,He=Me.floating.style;He.setProperty("--radix-popper-available-width",`${Se}px`),He.setProperty("--radix-popper-available-height",`${me}px`),He.setProperty("--radix-popper-anchor-width",`${Pe}px`),He.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),N&&Uie({element:N,padding:a}),Xie({arrowWidth:L,arrowHeight:k}),m&&Fie({strategy:"referenceHidden",...V})]}),[re,U]=SH($),H=Aa(b);Na(()=>{Q&&(H==null||H())},[Q,H]);const X=(ee=K.arrow)==null?void 0:ee.x,j=(ie=K.arrow)==null?void 0:ie.y,le=((oe=K.arrow)==null?void 0:oe.centerOffset)!==0,[se,J]=w.useState();return Na(()=>{M&&J(window.getComputedStyle(M).zIndex)},[M]),f.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:Q?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(de=K.transformOrigin)==null?void 0:de.x,(ye=K.transformOrigin)==null?void 0:ye.y].join(" "),...((ge=K.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:f.jsx(Gie,{scope:n,placedSide:re,onArrowChange:D,arrowX:X,arrowY:j,shouldHideArrow:le,children:f.jsx(hr.div,{"data-side":re,"data-align":U,..._,ref:A,style:{..._.style,animation:Q?void 0:"none"}})})})});yH.displayName=k7;var bH="PopperArrow",$ie={top:"bottom",right:"left",bottom:"top",left:"right"},_H=w.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=Wie(bH,r),o=$ie[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(Hie,{...i,ref:n,style:{...i.style,display:"block"}})})});_H.displayName=bH;function qie(t){return t!==null}var Xie=t=>({name:"transformOrigin",options:t,fn(e){var S,M,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]=SH(n),p={start:"0%",center:"50%",end:"100%"}[d],m=(((M=i.arrow)==null?void 0:M.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 SH(t){const[e,n="center"]=t.split("-");return[e,n]}var Sw=gH,ww=vH,wT=yH,MT=_H,bA="rovingFocusGroup.onEntryFocus",Yie={bubbles:!1,cancelable:!0},Mw="RovingFocusGroup",[gk,wH,Kie]=m7(Mw),[Zie,TT]=yu(Mw,[Kie]),[Qie,Jie]=Zie(Mw),MH=w.forwardRef((t,e)=>f.jsx(gk.Provider,{scope:t.__scopeRovingFocusGroup,children:f.jsx(gk.Slot,{scope:t.__scopeRovingFocusGroup,children:f.jsx(ese,{...t,ref:e})})}));MH.displayName=Mw;var ese=w.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=w.useRef(null),x=Gr(e,m),b=vw(s),[_,S]=cd({prop:o,defaultProp:a??null,onChange:l,caller:Mw}),[M,C]=w.useState(!1),A=Aa(c),N=wH(n),D=w.useRef(!1),[R,L]=w.useState(0);return w.useEffect(()=>{const k=m.current;if(k)return k.addEventListener(bA,A),()=>k.removeEventListener(bA,A)},[A]),f.jsx(Qie,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:w.useCallback(k=>S(k),[S]),onItemShiftTab:w.useCallback(()=>C(!0),[]),onFocusableItemAdd:w.useCallback(()=>L(k=>k+1),[]),onFocusableItemRemove:w.useCallback(()=>L(k=>k-1),[]),children:f.jsx(hr.div,{tabIndex:M||R===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...t.style},onMouseDown:Tn(t.onMouseDown,()=>{D.current=!0}),onFocus:Tn(t.onFocus,k=>{const O=!D.current;if(k.target===k.currentTarget&&O&&!M){const F=new CustomEvent(bA,Yie);if(k.currentTarget.dispatchEvent(F),!F.defaultPrevented){const B=N().filter($=>$.focusable),Y=B.find($=>$.active),V=B.find($=>$.id===_),G=[Y,V,...B].filter(Boolean).map($=>$.ref.current);EH(G,d)}}D.current=!1}),onBlur:Tn(t.onBlur,()=>C(!1))})})}),TH="RovingFocusGroupItem",CH=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=Ic(),c=s||l,d=Jie(TH,n),p=d.currentTabStopId===c,m=wH(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:_}=d;return w.useEffect(()=>{if(r)return x(),()=>b()},[r,x,b]),f.jsx(gk.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:f.jsx(hr.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...a,ref:e,onMouseDown:Tn(t.onMouseDown,S=>{r?d.onItemFocus(c):S.preventDefault()}),onFocus:Tn(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:Tn(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){d.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const M=rse(S,d.orientation,d.dir);if(M!==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(M==="last")A.reverse();else if(M==="prev"||M==="next"){M==="prev"&&A.reverse();const N=A.indexOf(S.currentTarget);A=d.loop?ise(A,N+1):A.slice(N+1)}setTimeout(()=>EH(A))}}),children:typeof o=="function"?o({isCurrentTabStop:p,hasTabStop:_!=null}):o})})});CH.displayName=TH;var tse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nse(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function rse(t,e,n){const r=nse(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return tse[r]}function EH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function ise(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var AH=MH,NH=CH,xk=["Enter"," "],sse=["ArrowDown","PageUp","Home"],kH=["ArrowUp","PageDown","End"],ose=[...sse,...kH],ase={ltr:[...xk,"ArrowRight"],rtl:[...xk,"ArrowLeft"]},lse={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tw="Menu",[vS,cse,use]=m7(Tw),[Ex,RH]=yu(Tw,[use,Sm,TT]),Cw=Sm(),PH=TT(),[DH,wm]=Ex(Tw),[dse,Ew]=Ex(Tw),IH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=Cw(e),[l,c]=w.useState(null),d=w.useRef(!1),p=Aa(s),m=vw(i);return w.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(Sw,{...a,children:f.jsx(DH,{scope:e,open:n,onOpenChange:p,content:l,onContentChange:c,children:f.jsx(dse,{scope:e,onClose:w.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};IH.displayName=Tw;var fse="MenuAnchor",R7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Cw(n);return f.jsx(ww,{...i,...r,ref:e})});R7.displayName=fse;var P7="MenuPortal",[hse,OH]=Ex(P7,{forceMount:void 0}),LH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=wm(P7,e);return f.jsx(hse,{scope:e,forceMount:n,children:f.jsx(Za,{present:n||s.open,children:f.jsx(Dy,{asChild:!0,container:i,children:r})})})};LH.displayName=P7;var ad="MenuContent",[pse,D7]=Ex(ad),jH=w.forwardRef((t,e)=>{const n=OH(ad,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=wm(ad,t.__scopeMenu),o=Ew(ad,t.__scopeMenu);return f.jsx(vS.Provider,{scope:t.__scopeMenu,children:f.jsx(Za,{present:r||s.open,children:f.jsx(vS.Slot,{scope:t.__scopeMenu,children:o.modal?f.jsx(mse,{...i,ref:e}):f.jsx(gse,{...i,ref:e})})})})}),mse=w.forwardRef((t,e)=>{const n=wm(ad,t.__scopeMenu),r=w.useRef(null),i=Gr(e,r);return w.useEffect(()=>{const s=r.current;if(s)return xT(s)},[]),f.jsx(I7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Tn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),gse=w.forwardRef((t,e)=>{const n=wm(ad,t.__scopeMenu);return f.jsx(I7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xse=rm("MenuContent.ScrollLock"),I7=w.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=wm(ad,n),M=Ew(ad,n),C=Cw(n),A=PH(n),N=cse(n),[D,R]=w.useState(null),L=w.useRef(null),k=Gr(e,L,S.onContentChange),O=w.useRef(0),F=w.useRef(""),B=w.useRef(0),Y=w.useRef(null),V=w.useRef("right"),q=w.useRef(0),G=b?bw:w.Fragment,$=b?{as:xse,allowPinchZoom:!0}:void 0,Q=re=>{var ee,ie;const U=F.current+re,H=N().filter(oe=>!oe.disabled),X=document.activeElement,j=(ee=H.find(oe=>oe.ref.current===X))==null?void 0:ee.textValue,le=H.map(oe=>oe.textValue),se=Nse(le,U,j),J=(ie=H.find(oe=>oe.textValue===se))==null?void 0:ie.ref.current;(function oe(de){F.current=de,window.clearTimeout(O.current),de!==""&&(O.current=window.setTimeout(()=>oe(""),1e3))})(U),J&&setTimeout(()=>J.focus())};w.useEffect(()=>()=>window.clearTimeout(O.current),[]),mT();const K=w.useCallback(re=>{var H,X;return V.current===((H=Y.current)==null?void 0:H.side)&&Rse(re,(X=Y.current)==null?void 0:X.area)},[]);return f.jsx(pse,{scope:n,searchRef:F,onItemEnter:w.useCallback(re=>{K(re)&&re.preventDefault()},[K]),onItemLeave:w.useCallback(re=>{var U;K(re)||((U=L.current)==null||U.focus(),R(null))},[K]),onTriggerLeave:w.useCallback(re=>{K(re)&&re.preventDefault()},[K]),pointerGraceTimerRef:B,onPointerGraceIntentChange:w.useCallback(re=>{Y.current=re},[]),children:f.jsx(G,{...$,children:f.jsx(yw,{asChild:!0,trapped:i,onMountAutoFocus:Tn(s,re=>{var U;re.preventDefault(),(U=L.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:f.jsx(Py,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:x,children:f.jsx(AH,{asChild:!0,...A,dir:M.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:R,onEntryFocus:Tn(l,re=>{M.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(wT,{role:"menu","aria-orientation":"vertical","data-state":eV(S.open),"data-radix-menu-content":"",dir:M.dir,...C,..._,ref:k,style:{outline:"none",..._.style},onKeyDown:Tn(_.onKeyDown,re=>{const H=re.target.closest("[data-radix-menu-content]")===re.currentTarget,X=re.ctrlKey||re.altKey||re.metaKey,j=re.key.length===1;H&&(re.key==="Tab"&&re.preventDefault(),!X&&j&&Q(re.key));const le=L.current;if(re.target!==le||!ose.includes(re.key))return;re.preventDefault();const J=N().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);kH.includes(re.key)&&J.reverse(),Ese(J)}),onBlur:Tn(t.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(O.current),F.current="")}),onPointerMove:Tn(t.onPointerMove,yS(re=>{const U=re.target,H=q.current!==re.clientX;if(re.currentTarget.contains(U)&&H){const X=re.clientX>q.current?"right":"left";V.current=X,q.current=re.clientX}}))})})})})})})});jH.displayName=ad;var vse="MenuGroup",O7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(hr.div,{role:"group",...r,ref:e})});O7.displayName=vse;var yse="MenuLabel",zH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(hr.div,{...r,ref:e})});zH.displayName=yse;var A2="MenuItem",aI="menu.itemSelect",CT=w.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=w.useRef(null),o=Ew(A2,t.__scopeMenu),a=D7(A2,t.__scopeMenu),l=Gr(e,s),c=w.useRef(!1),d=()=>{const p=s.current;if(!n&&p){const m=new CustomEvent(aI,{bubbles:!0,cancelable:!0});p.addEventListener(aI,x=>r==null?void 0:r(x),{once:!0}),nB(p,m),m.defaultPrevented?c.current=!1:o.onClose()}};return f.jsx(FH,{...i,ref:l,disabled:n,onClick:Tn(t.onClick,d),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),c.current=!0},onPointerUp:Tn(t.onPointerUp,p=>{var m;c.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:Tn(t.onKeyDown,p=>{const m=a.searchRef.current!=="";n||m&&p.key===" "||xk.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});CT.displayName=A2;var FH=w.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=D7(A2,n),a=PH(n),l=w.useRef(null),c=Gr(e,l),[d,p]=w.useState(!1),[m,x]=w.useState("");return w.useEffect(()=>{const b=l.current;b&&x((b.textContent??"").trim())},[s.children]),f.jsx(vS.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:f.jsx(NH,{asChild:!0,...a,focusable:!r,children:f.jsx(hr.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Tn(t.onPointerMove,yS(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Tn(t.onPointerLeave,yS(b=>o.onItemLeave(b))),onFocus:Tn(t.onFocus,()=>p(!0)),onBlur:Tn(t.onBlur,()=>p(!1))})})})}),bse="MenuCheckboxItem",UH=w.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return f.jsx(WH,{scope:t.__scopeMenu,checked:n,children:f.jsx(CT,{role:"menuitemcheckbox","aria-checked":N2(n)?"mixed":n,...i,ref:e,"data-state":z7(n),onSelect:Tn(i.onSelect,()=>r==null?void 0:r(N2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});UH.displayName=bse;var BH="MenuRadioGroup",[_se,Sse]=Ex(BH,{value:void 0,onValueChange:()=>{}}),HH=w.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Aa(r);return f.jsx(_se,{scope:t.__scopeMenu,value:n,onValueChange:s,children:f.jsx(O7,{...i,ref:e})})});HH.displayName=BH;var VH="MenuRadioItem",GH=w.forwardRef((t,e)=>{const{value:n,...r}=t,i=Sse(VH,t.__scopeMenu),s=n===i.value;return f.jsx(WH,{scope:t.__scopeMenu,checked:s,children:f.jsx(CT,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":z7(s),onSelect:Tn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});GH.displayName=VH;var L7="MenuItemIndicator",[WH,wse]=Ex(L7,{checked:!1}),$H=w.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=wse(L7,n);return f.jsx(Za,{present:r||N2(s.checked)||s.checked===!0,children:f.jsx(hr.span,{...i,ref:e,"data-state":z7(s.checked)})})});$H.displayName=L7;var Mse="MenuSeparator",qH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return f.jsx(hr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});qH.displayName=Mse;var Tse="MenuArrow",XH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Cw(n);return f.jsx(MT,{...i,...r,ref:e})});XH.displayName=Tse;var j7="MenuSub",[Cse,YH]=Ex(j7),KH=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:i}=t,s=wm(j7,e),o=Cw(e),[a,l]=w.useState(null),[c,d]=w.useState(null),p=Aa(i);return w.useEffect(()=>(s.open===!1&&p(!1),()=>p(!1)),[s.open,p]),f.jsx(Sw,{...o,children:f.jsx(DH,{scope:e,open:r,onOpenChange:p,content:c,onContentChange:d,children:f.jsx(Cse,{scope:e,contentId:Ic(),triggerId:Ic(),trigger:a,onTriggerChange:l,children:n})})})};KH.displayName=j7;var N_="MenuSubTrigger",ZH=w.forwardRef((t,e)=>{const n=wm(N_,t.__scopeMenu),r=Ew(N_,t.__scopeMenu),i=YH(N_,t.__scopeMenu),s=D7(N_,t.__scopeMenu),o=w.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},d=w.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return w.useEffect(()=>d,[d]),w.useEffect(()=>{const p=a.current;return()=>{window.clearTimeout(p),l(null)}},[a,l]),f.jsx(R7,{asChild:!0,...c,children:f.jsx(FH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":eV(n.open),...t,ref:hT(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:Tn(t.onPointerMove,yS(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:Tn(t.onPointerLeave,yS(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",M=S?-5:5,C=m[S?"left":"right"],A=m[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+M,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:Tn(t.onKeyDown,p=>{var x;const m=s.searchRef.current!=="";t.disabled||m&&p.key===" "||ase[r.dir].includes(p.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),p.preventDefault())})})})});ZH.displayName=N_;var QH="MenuSubContent",JH=w.forwardRef((t,e)=>{const n=OH(ad,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=wm(ad,t.__scopeMenu),o=Ew(ad,t.__scopeMenu),a=YH(QH,t.__scopeMenu),l=w.useRef(null),c=Gr(e,l);return f.jsx(vS.Provider,{scope:t.__scopeMenu,children:f.jsx(Za,{present:r||s.open,children:f.jsx(vS.Slot,{scope:t.__scopeMenu,children:f.jsx(I7,{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:Tn(t.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Tn(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Tn(t.onKeyDown,d=>{var x;const p=d.currentTarget.contains(d.target),m=lse[o.dir].includes(d.key);p&&m&&(s.onOpenChange(!1),(x=a.trigger)==null||x.focus(),d.preventDefault())})})})})})});JH.displayName=QH;function eV(t){return t?"open":"closed"}function N2(t){return t==="indeterminate"}function z7(t){return N2(t)?"indeterminate":t?"checked":"unchecked"}function Ese(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ase(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Nse(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=Ase(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 kse(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 Rse(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return kse(n,e)}function yS(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Pse=IH,Dse=R7,Ise=LH,Ose=jH,Lse=O7,jse=zH,zse=CT,Fse=UH,Use=HH,Bse=GH,Hse=$H,Vse=qH,Gse=XH,Wse=KH,$se=ZH,qse=JH,ET="DropdownMenu",[Xse]=yu(ET,[RH]),_l=RH(),[Yse,tV]=Xse(ET),nV=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=_l(e),c=w.useRef(null),[d,p]=cd({prop:i,defaultProp:s??!1,onChange:o,caller:ET});return f.jsx(Yse,{scope:e,triggerId:Ic(),triggerRef:c,contentId:Ic(),open:d,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(m=>!m),[p]),modal:a,children:f.jsx(Pse,{...l,open:d,onOpenChange:p,dir:r,modal:a,children:n})})};nV.displayName=ET;var rV="DropdownMenuTrigger",iV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=tV(rV,n),o=_l(n);return f.jsx(Dse,{asChild:!0,...o,children:f.jsx(hr.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:hT(e,s.triggerRef),onPointerDown:Tn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Tn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iV.displayName=rV;var Kse="DropdownMenuPortal",sV=t=>{const{__scopeDropdownMenu:e,...n}=t,r=_l(e);return f.jsx(Ise,{...r,...n})};sV.displayName=Kse;var oV="DropdownMenuContent",aV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=tV(oV,n),s=_l(n),o=w.useRef(!1);return f.jsx(Ose,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:Tn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Tn(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)"}})});aV.displayName=oV;var Zse="DropdownMenuGroup",Qse=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Lse,{...i,...r,ref:e})});Qse.displayName=Zse;var Jse="DropdownMenuLabel",lV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(jse,{...i,...r,ref:e})});lV.displayName=Jse;var eoe="DropdownMenuItem",cV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(zse,{...i,...r,ref:e})});cV.displayName=eoe;var toe="DropdownMenuCheckboxItem",uV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Fse,{...i,...r,ref:e})});uV.displayName=toe;var noe="DropdownMenuRadioGroup",roe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Use,{...i,...r,ref:e})});roe.displayName=noe;var ioe="DropdownMenuRadioItem",soe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Bse,{...i,...r,ref:e})});soe.displayName=ioe;var ooe="DropdownMenuItemIndicator",dV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Hse,{...i,...r,ref:e})});dV.displayName=ooe;var aoe="DropdownMenuSeparator",fV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Vse,{...i,...r,ref:e})});fV.displayName=aoe;var loe="DropdownMenuArrow",coe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(Gse,{...i,...r,ref:e})});coe.displayName=loe;var uoe=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:i,defaultOpen:s}=t,o=_l(e),[a,l]=cd({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return f.jsx(Wse,{...o,open:a,onOpenChange:l,children:n})},doe="DropdownMenuSubTrigger",hV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx($se,{...i,...r,ref:e})});hV.displayName=doe;var foe="DropdownMenuSubContent",pV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return f.jsx(qse,{...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)"}})});pV.displayName=foe;var hoe=nV,poe=iV,moe=sV,goe=aV,xoe=lV,voe=cV,yoe=uV,boe=dV,_oe=fV,Soe=uoe,woe=hV,Moe=pV,Toe="Label",mV=w.forwardRef((t,e)=>f.jsx(hr.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())}}));mV.displayName=Toe;var Coe=mV;function vk(t,[e,n]){return Math.min(n,Math.max(e,t))}var AT="Popover",[gV]=yu(AT,[Sm]),Aw=Sm(),[Eoe,Mm]=gV(AT),xV=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=Aw(e),l=w.useRef(null),[c,d]=w.useState(!1),[p,m]=cd({prop:r,defaultProp:i??!1,onChange:s,caller:AT});return f.jsx(Sw,{...a,children:f.jsx(Eoe,{scope:e,contentId:Ic(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:c,onCustomAnchorAdd:w.useCallback(()=>d(!0),[]),onCustomAnchorRemove:w.useCallback(()=>d(!1),[]),modal:o,children:n})})};xV.displayName=AT;var vV="PopoverAnchor",Aoe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Mm(vV,n),s=Aw(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return w.useEffect(()=>(o(),()=>a()),[o,a]),f.jsx(ww,{...s,...r,ref:e})});Aoe.displayName=vV;var yV="PopoverTrigger",bV=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Mm(yV,n),s=Aw(n),o=Gr(e,i.triggerRef),a=f.jsx(hr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":TV(i.open),...r,ref:o,onClick:Tn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:f.jsx(ww,{asChild:!0,...s,children:a})});bV.displayName=yV;var F7="PopoverPortal",[Noe,koe]=gV(F7,{forceMount:void 0}),_V=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Mm(F7,e);return f.jsx(Noe,{scope:e,forceMount:n,children:f.jsx(Za,{present:n||s.open,children:f.jsx(Dy,{asChild:!0,container:i,children:r})})})};_V.displayName=F7;var ey="PopoverContent",SV=w.forwardRef((t,e)=>{const n=koe(ey,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Mm(ey,t.__scopePopover);return f.jsx(Za,{present:r||s.open,children:s.modal?f.jsx(Poe,{...i,ref:e}):f.jsx(Doe,{...i,ref:e})})});SV.displayName=ey;var Roe=rm("PopoverContent.RemoveScroll"),Poe=w.forwardRef((t,e)=>{const n=Mm(ey,t.__scopePopover),r=w.useRef(null),i=Gr(e,r),s=w.useRef(!1);return w.useEffect(()=>{const o=r.current;if(o)return xT(o)},[]),f.jsx(bw,{as:Roe,allowPinchZoom:!0,children:f.jsx(wV,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tn(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Tn(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:Tn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Doe=w.forwardRef((t,e)=>{const n=Mm(ey,t.__scopePopover),r=w.useRef(!1),i=w.useRef(!1);return f.jsx(wV,{...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()}})}),wV=w.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=Mm(ey,n),x=Aw(n);return mT(),f.jsx(yw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:f.jsx(Py,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:f.jsx(wT,{"data-state":TV(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)"}})})})}),MV="PopoverClose",Ioe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Mm(MV,n);return f.jsx(hr.button,{type:"button",...r,ref:e,onClick:Tn(t.onClick,()=>i.onOpenChange(!1))})});Ioe.displayName=MV;var Ooe="PopoverArrow",Loe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Aw(n);return f.jsx(MT,{...i,...r,ref:e})});Loe.displayName=Ooe;function TV(t){return t?"open":"closed"}var joe=xV,zoe=bV,Foe=_V,Uoe=SV;function Boe(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var U7="ScrollArea",[CV]=yu(U7),[Hoe,md]=CV(U7),EV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=w.useState(null),[c,d]=w.useState(null),[p,m]=w.useState(null),[x,b]=w.useState(null),[_,S]=w.useState(null),[M,C]=w.useState(0),[A,N]=w.useState(0),[D,R]=w.useState(!1),[L,k]=w.useState(!1),O=Gr(e,B=>l(B)),F=vw(i);return f.jsx(Hoe,{scope:n,type:r,dir:F,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:p,onContentChange:m,scrollbarX:x,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:R,scrollbarY:_,onScrollbarYChange:S,scrollbarYEnabled:L,onScrollbarYEnabledChange:k,onCornerWidthChange:C,onCornerHeightChange:N,children:f.jsx(hr.div,{dir:F,...o,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":M+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});EV.displayName=U7;var AV="ScrollAreaViewport",NV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=md(AV,n),a=w.useRef(null),l=Gr(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(hr.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})})]})});NV.displayName=AV;var yh="ScrollAreaScrollbar",kV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=md(yh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return w.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?f.jsx(Voe,{...r,ref:e,forceMount:n}):i.type==="scroll"?f.jsx(Goe,{...r,ref:e,forceMount:n}):i.type==="auto"?f.jsx(RV,{...r,ref:e,forceMount:n}):i.type==="always"?f.jsx(B7,{...r,ref:e}):null});kV.displayName=yh;var Voe=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=md(yh,t.__scopeScrollArea),[s,o]=w.useState(!1);return w.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(Za,{present:n||s,children:f.jsx(RV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Goe=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=md(yh,t.__scopeScrollArea),s=t.orientation==="horizontal",o=kT(()=>l("SCROLL_END"),100),[a,l]=Boe("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 w.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),w.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(Za,{present:n||a!=="hidden",children:f.jsx(B7,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Tn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Tn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),RV=w.forwardRef((t,e)=>{const n=md(yh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=w.useState(!1),a=t.orientation==="horizontal",l=kT(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:d)}},10);return ty(n.viewport,l),ty(n.content,l),f.jsx(Za,{present:r||s,children:f.jsx(B7,{"data-state":s?"visible":"hidden",...i,ref:e})})}),B7=w.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=md(yh,t.__scopeScrollArea),s=w.useRef(null),o=w.useRef(0),[a,l]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=LV(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 Koe(m,o.current,a,x)}return n==="horizontal"?f.jsx(Woe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,x=lI(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($oe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,x=lI(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}),Woe=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=md(yh,t.__scopeScrollArea),[o,a]=w.useState(),l=w.useRef(null),c=Gr(e,l,s.onScrollbarXChange);return w.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(DV,{"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":NT(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),zV(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:R2(o.paddingLeft),paddingEnd:R2(o.paddingRight)}})}})}),$oe=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=md(yh,t.__scopeScrollArea),[o,a]=w.useState(),l=w.useRef(null),c=Gr(e,l,s.onScrollbarYChange);return w.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(DV,{"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":NT(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),zV(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:R2(o.paddingTop),paddingEnd:R2(o.paddingBottom)}})}})}),[qoe,PV]=CV(yh),DV=w.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=md(yh,n),[b,_]=w.useState(null),S=Gr(e,O=>_(O)),M=w.useRef(null),C=w.useRef(""),A=x.viewport,N=r.content-r.viewport,D=Aa(d),R=Aa(l),L=kT(p,10);function k(O){if(M.current){const F=O.clientX-M.current.left,B=O.clientY-M.current.top;c({x:F,y:B})}}return w.useEffect(()=>{const O=F=>{const B=F.target;(b==null?void 0:b.contains(B))&&D(F,N)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[A,b,N,D]),w.useEffect(R,[r,R]),ty(b,L),ty(x.content,L),f.jsx(qoe,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:Aa(s),onThumbPointerUp:Aa(o),onThumbPositionChange:R,onThumbPointerDown:Aa(a),children:f.jsx(hr.div,{...m,ref:S,style:{position:"absolute",...m.style},onPointerDown:Tn(t.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),M.current=b.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),k(O))}),onPointerMove:Tn(t.onPointerMove,k),onPointerUp:Tn(t.onPointerUp,O=>{const F=O.target;F.hasPointerCapture(O.pointerId)&&F.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=C.current,x.viewport&&(x.viewport.style.scrollBehavior=""),M.current=null})})})}),k2="ScrollAreaThumb",IV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=PV(k2,t.__scopeScrollArea);return f.jsx(Za,{present:n||i.hasThumb,children:f.jsx(Xoe,{ref:e,...r})})}),Xoe=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=md(k2,n),o=PV(k2,n),{onThumbPositionChange:a}=o,l=Gr(e,p=>o.onThumbChange(p)),c=w.useRef(void 0),d=kT(()=>{c.current&&(c.current(),c.current=void 0)},100);return w.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(d(),!c.current){const x=Zoe(p,a);c.current=x,a()}};return a(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,d,a]),f.jsx(hr.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:Tn(t.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),b=p.clientX-x.left,_=p.clientY-x.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:Tn(t.onPointerUp,o.onThumbPointerUp)})});IV.displayName=k2;var H7="ScrollAreaCorner",OV=w.forwardRef((t,e)=>{const n=md(H7,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.jsx(Yoe,{...t,ref:e}):null});OV.displayName=H7;var Yoe=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=md(H7,n),[s,o]=w.useState(0),[a,l]=w.useState(0),c=!!(s&&a);return ty(i.scrollbarX,()=>{var p;const d=((p=i.scrollbarX)==null?void 0:p.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),ty(i.scrollbarY,()=>{var p;const d=((p=i.scrollbarY)==null?void 0:p.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),c?f.jsx(hr.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 R2(t){return t?parseInt(t,10):0}function LV(t,e){const n=t/e;return isNaN(n)?0:n}function NT(t){const e=LV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Koe(t,e,n,r="ltr"){const i=NT(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 jV([l,c],p)(t)}function lI(t,e,n="ltr"){const r=NT(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=vk(t,l);return jV([0,o],[0,a])(c)}function jV(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 zV(t,e){return t>0&&t<e}var Zoe=(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 kT(t,e){const n=Aa(t),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function ty(t,e){const n=Aa(e);Na(()=>{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 Qoe=EV,Joe=NV,eae=OV,tae=[" ","Enter","ArrowUp","ArrowDown"],nae=[" ","Enter"],xx="Select",[RT,PT,rae]=m7(xx),[Ly]=yu(xx,[rae,Sm]),DT=Sm(),[iae,Tm]=Ly(xx),[sae,oae]=Ly(xx),FV=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,_=DT(e),[S,M]=w.useState(null),[C,A]=w.useState(null),[N,D]=w.useState(!1),R=vw(c),[L,k]=cd({prop:r,defaultProp:i??!1,onChange:s,caller:xx}),[O,F]=cd({prop:o,defaultProp:a,onChange:l,caller:xx}),B=w.useRef(null),Y=S?b||!!S.closest("form"):!0,[V,q]=w.useState(new Set),G=Array.from(V).map($=>$.props.value).join(";");return f.jsx(Sw,{..._,children:f.jsxs(iae,{required:x,scope:e,trigger:S,onTriggerChange:M,valueNode:C,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:D,contentId:Ic(),value:O,onValueChange:F,open:L,onOpenChange:k,dir:R,triggerPointerDownPosRef:B,disabled:m,children:[f.jsx(RT.Provider,{scope:e,children:f.jsx(sae,{scope:t.__scopeSelect,onNativeOptionAdd:w.useCallback($=>{q(Q=>new Set(Q).add($))},[]),onNativeOptionRemove:w.useCallback($=>{q(Q=>{const K=new Set(Q);return K.delete($),K})},[]),children:n})}),Y?f.jsxs(aG,{"aria-hidden":!0,required:x,tabIndex:-1,name:d,autoComplete:p,value:O,onChange:$=>F($.target.value),disabled:m,form:b,children:[O===void 0?f.jsx("option",{value:""}):null,Array.from(V)]},G):null]})})};FV.displayName=xx;var UV="SelectTrigger",BV=w.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=DT(n),o=Tm(UV,n),a=o.disabled||r,l=Gr(e,o.onTriggerChange),c=PT(n),d=w.useRef("touch"),[p,m,x]=cG(_=>{const S=c().filter(A=>!A.disabled),M=S.find(A=>A.value===o.value),C=uG(S,_,M);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(ww,{asChild:!0,...s,children:f.jsx(hr.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":lG(o.value)?"":void 0,...i,ref:l,onClick:Tn(i.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&b(_)}),onPointerDown:Tn(i.onPointerDown,_=>{d.current=_.pointerType;const S=_.target;S.hasPointerCapture(_.pointerId)&&S.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:Tn(i.onKeyDown,_=>{const S=p.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&m(_.key),!(S&&_.key===" ")&&tae.includes(_.key)&&(b(),_.preventDefault())})})})});BV.displayName=UV;var HV="SelectValue",VV=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=Tm(HV,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,p=Gr(e,l.onValueNodeChange);return Na(()=>{c(d)},[c,d]),f.jsx(hr.span,{...a,ref:p,style:{pointerEvents:"none"},children:lG(l.value)?f.jsx(f.Fragment,{children:o}):s})});VV.displayName=HV;var aae="SelectIcon",GV=w.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return f.jsx(hr.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});GV.displayName=aae;var lae="SelectPortal",WV=t=>f.jsx(Dy,{asChild:!0,...t});WV.displayName=lae;var vx="SelectContent",$V=w.forwardRef((t,e)=>{const n=Tm(vx,t.__scopeSelect),[r,i]=w.useState();if(Na(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?$l.createPortal(f.jsx(qV,{scope:t.__scopeSelect,children:f.jsx(RT.Slot,{scope:t.__scopeSelect,children:f.jsx("div",{children:t.children})})}),s):null}return f.jsx(XV,{...t,ref:e})});$V.displayName=vx;var qd=10,[qV,Cm]=Ly(vx),cae="SelectContentImpl",uae=rm("SelectContent.RemoveScroll"),XV=w.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,...M}=t,C=Tm(vx,n),[A,N]=w.useState(null),[D,R]=w.useState(null),L=Gr(e,ee=>N(ee)),[k,O]=w.useState(null),[F,B]=w.useState(null),Y=PT(n),[V,q]=w.useState(!1),G=w.useRef(!1);w.useEffect(()=>{if(A)return xT(A)},[A]),mT();const $=w.useCallback(ee=>{const[ie,...oe]=Y().map(ge=>ge.ref.current),[de]=oe.slice(-1),ye=document.activeElement;for(const ge of ee)if(ge===ye||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===ie&&D&&(D.scrollTop=0),ge===de&&D&&(D.scrollTop=D.scrollHeight),ge==null||ge.focus(),document.activeElement!==ye))return},[Y,D]),Q=w.useCallback(()=>$([k,A]),[$,k,A]);w.useEffect(()=>{V&&Q()},[V,Q]);const{onOpenChange:K,triggerPointerDownPosRef:re}=C;w.useEffect(()=>{if(A){let ee={x:0,y:0};const ie=de=>{var ye,ge;ee={x:Math.abs(Math.round(de.pageX)-(((ye=re.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(de.pageY)-(((ge=re.current)==null?void 0:ge.y)??0))}},oe=de=>{ee.x<=10&&ee.y<=10?de.preventDefault():A.contains(de.target)||K(!1),document.removeEventListener("pointermove",ie),re.current=null};return re.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",oe,{capture:!0})}}},[A,K,re]),w.useEffect(()=>{const ee=()=>K(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[K]);const[U,H]=cG(ee=>{const ie=Y().filter(ye=>!ye.disabled),oe=ie.find(ye=>ye.ref.current===document.activeElement),de=uG(ie,ee,oe);de&&setTimeout(()=>de.ref.current.focus())}),X=w.useCallback((ee,ie,oe)=>{const de=!G.current&&!oe;(C.value!==void 0&&C.value===ie||de)&&(O(ee),de&&(G.current=!0))},[C.value]),j=w.useCallback(()=>A==null?void 0:A.focus(),[A]),le=w.useCallback((ee,ie,oe)=>{const de=!G.current&&!oe;(C.value!==void 0&&C.value===ie||de)&&B(ee)},[C.value]),se=r==="popper"?yk:YV,J=se===yk?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S}:{};return f.jsx(qV,{scope:n,content:A,viewport:D,onViewportChange:R,itemRefCallback:X,selectedItem:k,onItemLeave:j,itemTextRefCallback:le,focusSelectedItem:Q,selectedItemText:F,position:r,isPositioned:V,searchRef:U,children:f.jsx(bw,{as:uae,allowPinchZoom:!0,children:f.jsx(yw,{asChild:!0,trapped:C.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Tn(i,ee=>{var ie;(ie=C.trigger)==null||ie.focus({preventScroll:!0}),ee.preventDefault()}),children:f.jsx(Py,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:f.jsx(se,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ee=>ee.preventDefault(),...M,...J,onPlaced:()=>q(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:Tn(M.onKeyDown,ee=>{const ie=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ie&&ee.key.length===1&&H(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let de=Y().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const ye=ee.target,ge=de.indexOf(ye);de=de.slice(ge+1)}setTimeout(()=>$(de)),ee.preventDefault()}})})})})})})});XV.displayName=cae;var dae="SelectItemAlignedPosition",YV=w.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=Tm(vx,n),o=Cm(vx,n),[a,l]=w.useState(null),[c,d]=w.useState(null),p=Gr(e,L=>d(L)),m=PT(n),x=w.useRef(!1),b=w.useRef(!0),{viewport:_,selectedItem:S,selectedItemText:M,focusSelectedItem:C}=o,A=w.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&_&&S&&M){const L=s.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),F=M.getBoundingClientRect();if(s.dir!=="rtl"){const ye=F.left-k.left,ge=O.left-ye,Me=L.left-ge,fe=L.width+Me,Se=Math.max(fe,k.width),me=window.innerWidth-qd,Pe=vk(ge,[qd,Math.max(qd,me-Se)]);a.style.minWidth=fe+"px",a.style.left=Pe+"px"}else{const ye=k.right-F.right,ge=window.innerWidth-O.right-ye,Me=window.innerWidth-L.right-ge,fe=L.width+Me,Se=Math.max(fe,k.width),me=window.innerWidth-qd,Pe=vk(ge,[qd,Math.max(qd,me-Se)]);a.style.minWidth=fe+"px",a.style.right=Pe+"px"}const B=m(),Y=window.innerHeight-qd*2,V=_.scrollHeight,q=window.getComputedStyle(c),G=parseInt(q.borderTopWidth,10),$=parseInt(q.paddingTop,10),Q=parseInt(q.borderBottomWidth,10),K=parseInt(q.paddingBottom,10),re=G+$+V+K+Q,U=Math.min(S.offsetHeight*5,re),H=window.getComputedStyle(_),X=parseInt(H.paddingTop,10),j=parseInt(H.paddingBottom,10),le=L.top+L.height/2-qd,se=Y-le,J=S.offsetHeight/2,ee=S.offsetTop+J,ie=G+$+ee,oe=re-ie;if(ie<=le){const ye=B.length>0&&S===B[B.length-1].ref.current;a.style.bottom="0px";const ge=c.clientHeight-_.offsetTop-_.offsetHeight,Me=Math.max(se,J+(ye?j:0)+ge+Q),fe=ie+Me;a.style.height=fe+"px"}else{const ye=B.length>0&&S===B[0].ref.current;a.style.top="0px";const Me=Math.max(le,G+_.offsetTop+(ye?X:0)+J)+oe;a.style.height=Me+"px",_.scrollTop=ie-le+_.offsetTop}a.style.margin=`${qd}px 0`,a.style.minHeight=U+"px",a.style.maxHeight=Y+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,a,c,_,S,M,s.dir,r]);Na(()=>A(),[A]);const[N,D]=w.useState();Na(()=>{c&&D(window.getComputedStyle(c).zIndex)},[c]);const R=w.useCallback(L=>{L&&b.current===!0&&(A(),C==null||C(),b.current=!1)},[A,C]);return f.jsx(hae,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:R,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(hr.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});YV.displayName=dae;var fae="SelectPopperPosition",yk=w.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=qd,...s}=t,o=DT(n);return f.jsx(wT,{...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)"}})});yk.displayName=fae;var[hae,V7]=Ly(vx,{}),bk="SelectViewport",KV=w.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=Cm(bk,n),o=V7(bk,n),a=Gr(e,s.onViewportChange),l=w.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(RT.Slot,{scope:n,children:f.jsx(hr.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Tn(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-qd*2,_=parseFloat(p.style.minHeight),S=parseFloat(p.style.height),M=Math.max(_,S);if(M<b){const C=M+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})})})]})});KV.displayName=bk;var ZV="SelectGroup",[pae,mae]=Ly(ZV),gae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Ic();return f.jsx(pae,{scope:n,id:i,children:f.jsx(hr.div,{role:"group","aria-labelledby":i,...r,ref:e})})});gae.displayName=ZV;var QV="SelectLabel",xae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=mae(QV,n);return f.jsx(hr.div,{id:i.id,...r,ref:e})});xae.displayName=QV;var P2="SelectItem",[vae,JV]=Ly(P2),eG=w.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=Tm(P2,n),l=Cm(P2,n),c=a.value===r,[d,p]=w.useState(s??""),[m,x]=w.useState(!1),b=Gr(e,C=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,C,r,i)}),_=Ic(),S=w.useRef("touch"),M=()=>{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(vae,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:w.useCallback(C=>{p(A=>A||((C==null?void 0:C.textContent)??"").trim())},[]),children:f.jsx(RT.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:f.jsx(hr.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:Tn(o.onFocus,()=>x(!0)),onBlur:Tn(o.onBlur,()=>x(!1)),onClick:Tn(o.onClick,()=>{S.current!=="mouse"&&M()}),onPointerUp:Tn(o.onPointerUp,()=>{S.current==="mouse"&&M()}),onPointerDown:Tn(o.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:Tn(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:Tn(o.onPointerLeave,C=>{var A;C.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:Tn(o.onKeyDown,C=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&C.key===" "||(nae.includes(C.key)&&M(),C.key===" "&&C.preventDefault())})})})})});eG.displayName=P2;var k_="SelectItemText",tG=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=Tm(k_,n),a=Cm(k_,n),l=JV(k_,n),c=oae(k_,n),[d,p]=w.useState(null),m=Gr(e,M=>p(M),l.onItemTextChange,M=>{var C;return(C=a.itemTextRefCallback)==null?void 0:C.call(a,M,l.value,l.disabled)}),x=d==null?void 0:d.textContent,b=w.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:_,onNativeOptionRemove:S}=c;return Na(()=>(_(b),()=>S(b)),[_,S,b]),f.jsxs(f.Fragment,{children:[f.jsx(hr.span,{id:l.textId,...s,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?$l.createPortal(s.children,o.valueNode):null]})});tG.displayName=k_;var nG="SelectItemIndicator",rG=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return JV(nG,n).isSelected?f.jsx(hr.span,{"aria-hidden":!0,...r,ref:e}):null});rG.displayName=nG;var _k="SelectScrollUpButton",iG=w.forwardRef((t,e)=>{const n=Cm(_k,t.__scopeSelect),r=V7(_k,t.__scopeSelect),[i,s]=w.useState(!1),o=Gr(e,r.onScrollButtonChange);return Na(()=>{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(oG,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});iG.displayName=_k;var Sk="SelectScrollDownButton",sG=w.forwardRef((t,e)=>{const n=Cm(Sk,t.__scopeSelect),r=V7(Sk,t.__scopeSelect),[i,s]=w.useState(!1),o=Gr(e,r.onScrollButtonChange);return Na(()=>{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(oG,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});sG.displayName=Sk;var oG=w.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=Cm("SelectScrollButton",n),o=w.useRef(null),a=PT(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Na(()=>{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(hr.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Tn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Tn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Tn(i.onPointerLeave,()=>{l()})})}),yae="SelectSeparator",bae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return f.jsx(hr.div,{"aria-hidden":!0,...r,ref:e})});bae.displayName=yae;var wk="SelectArrow",_ae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=DT(n),s=Tm(wk,n),o=Cm(wk,n);return s.open&&o.position==="popper"?f.jsx(MT,{...i,...r,ref:e}):null});_ae.displayName=wk;var Sae="SelectBubbleInput",aG=w.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=w.useRef(null),s=Gr(r,i),o=Are(e);return w.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(hr.select,{...n,style:{...rB,...n.style},ref:s,defaultValue:e})});aG.displayName=Sae;function lG(t){return t===""||t===void 0}function cG(t){const e=Aa(t),n=w.useRef(""),r=w.useRef(0),i=w.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=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function uG(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=wae(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 wae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Mae=FV,Tae=BV,Cae=VV,Eae=GV,Aae=WV,Nae=$V,kae=KV,Rae=eG,Pae=tG,Dae=rG,Iae=iG,Oae=sG,dG="Toggle",G7=w.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[o,a]=cd({prop:n,onChange:i,defaultProp:r??!1,caller:dG});return f.jsx(hr.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:Tn(t.onClick,()=>{t.disabled||a(!o)})})});G7.displayName=dG;var Lae=G7,Em="ToggleGroup",[fG]=yu(Em,[TT]),hG=TT(),W7=ni.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return f.jsx(jae,{...i,ref:e})}if(n==="multiple"){const i=r;return f.jsx(zae,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${Em}\``)});W7.displayName=Em;var[pG,mG]=fG(Em),jae=ni.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=cd({prop:n,defaultProp:r??"",onChange:i,caller:Em});return f.jsx(pG,{scope:t.__scopeToggleGroup,type:"single",value:ni.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:ni.useCallback(()=>a(""),[a]),children:f.jsx(gG,{...s,ref:e})})}),zae=ni.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=cd({prop:n,defaultProp:r??[],onChange:i,caller:Em}),l=ni.useCallback(d=>a((p=[])=>[...p,d]),[a]),c=ni.useCallback(d=>a((p=[])=>p.filter(m=>m!==d)),[a]);return f.jsx(pG,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:f.jsx(gG,{...s,ref:e})})});W7.displayName=Em;var[Fae,Uae]=fG(Em),gG=ni.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:o,loop:a=!0,...l}=t,c=hG(n),d=vw(o),p={role:"group",dir:d,...l};return f.jsx(Fae,{scope:n,rovingFocus:i,disabled:r,children:i?f.jsx(AH,{asChild:!0,...c,orientation:s,dir:d,loop:a,children:f.jsx(hr.div,{...p,ref:e})}):f.jsx(hr.div,{...p,ref:e})})}),D2="ToggleGroupItem",xG=ni.forwardRef((t,e)=>{const n=mG(D2,t.__scopeToggleGroup),r=Uae(D2,t.__scopeToggleGroup),i=hG(t.__scopeToggleGroup),s=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:s,disabled:o},l=ni.useRef(null);return r.rovingFocus?f.jsx(NH,{asChild:!0,...i,focusable:!o,active:s,ref:l,children:f.jsx(cI,{...a,ref:e})}):f.jsx(cI,{...a,ref:e})});xG.displayName=D2;var cI=ni.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=mG(D2,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=s.type==="single"?o:void 0;return f.jsx(G7,{...a,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),Bae=W7,Hae=xG,[IT]=yu("Tooltip",[Sm]),OT=Sm(),vG="TooltipProvider",Vae=700,Mk="tooltip.open",[Gae,$7]=IT(vG),yG=t=>{const{__scopeTooltip:e,delayDuration:n=Vae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=w.useRef(!0),a=w.useRef(!1),l=w.useRef(0);return w.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),f.jsx(Gae,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:w.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};yG.displayName=vG;var bS="Tooltip",[Wae,Nw]=IT(bS),bG=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=$7(bS,t.__scopeTooltip),c=OT(e),[d,p]=w.useState(null),m=Ic(),x=w.useRef(0),b=o??l.disableHoverableContent,_=a??l.delayDuration,S=w.useRef(!1),[M,C]=cd({prop:r,defaultProp:i??!1,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(Mk))):l.onClose(),s==null||s(L)},caller:bS}),A=w.useMemo(()=>M?S.current?"delayed-open":"instant-open":"closed",[M]),N=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,C(!0)},[C]),D=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,C(!1)},[C]),R=w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,C(!0),x.current=0},_)},[_,C]);return w.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(Sw,{...c,children:f.jsx(Wae,{scope:e,contentId:m,open:M,stateAttribute:A,trigger:d,onTriggerChange:p,onTriggerEnter:w.useCallback(()=>{l.isOpenDelayedRef.current?R():N()},[l.isOpenDelayedRef,R,N]),onTriggerLeave:w.useCallback(()=>{b?D():(window.clearTimeout(x.current),x.current=0)},[D,b]),onOpen:N,onClose:D,disableHoverableContent:b,children:n})})};bG.displayName=bS;var Tk="TooltipTrigger",_G=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Nw(Tk,n),s=$7(Tk,n),o=OT(n),a=w.useRef(null),l=Gr(e,a,i.onTriggerChange),c=w.useRef(!1),d=w.useRef(!1),p=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(ww,{asChild:!0,...o,children:f.jsx(hr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Tn(t.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Tn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Tn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Tn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:Tn(t.onBlur,i.onClose),onClick:Tn(t.onClick,i.onClose)})})});_G.displayName=Tk;var q7="TooltipPortal",[$ae,qae]=IT(q7,{forceMount:void 0}),SG=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=Nw(q7,e);return f.jsx($ae,{scope:e,forceMount:n,children:f.jsx(Za,{present:n||s.open,children:f.jsx(Dy,{asChild:!0,container:i,children:r})})})};SG.displayName=q7;var ny="TooltipContent",wG=w.forwardRef((t,e)=>{const n=qae(ny,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=Nw(ny,t.__scopeTooltip);return f.jsx(Za,{present:r||o.open,children:o.disableHoverableContent?f.jsx(MG,{side:i,...s,ref:e}):f.jsx(Xae,{side:i,...s,ref:e})})}),Xae=w.forwardRef((t,e)=>{const n=Nw(ny,t.__scopeTooltip),r=$7(ny,t.__scopeTooltip),i=w.useRef(null),s=Gr(e,i),[o,a]=w.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:p}=r,m=w.useCallback(()=>{a(null),p(!1)},[p]),x=w.useCallback((b,_)=>{const S=b.currentTarget,M={x:b.clientX,y:b.clientY},C=Jae(M,S.getBoundingClientRect()),A=ele(M,C),N=tle(_.getBoundingClientRect()),D=rle([...A,...N]);a(D),p(!0)},[p]);return w.useEffect(()=>()=>m(),[m]),w.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]),w.useEffect(()=>{if(o){const b=_=>{const S=_.target,M={x:_.clientX,y:_.clientY},C=(l==null?void 0:l.contains(S))||(d==null?void 0:d.contains(S)),A=!nle(M,o);C?m():A&&(m(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,d,o,c,m]),f.jsx(MG,{...t,ref:s})}),[Yae,Kae]=IT(bS,{isInside:!1}),Zae=tB("TooltipContent"),MG=w.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=Nw(ny,n),c=OT(n),{onClose:d}=l;return w.useEffect(()=>(document.addEventListener(Mk,d),()=>document.removeEventListener(Mk,d)),[d]),w.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(Py,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:f.jsxs(wT,{"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(Zae,{children:r}),f.jsx(Yae,{scope:n,isInside:!0,children:f.jsx(Dte,{id:l.contentId,role:"tooltip",children:i||r})})]})})});wG.displayName=ny;var TG="TooltipArrow",Qae=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=OT(n);return Kae(TG,n).isInside?null:f.jsx(MT,{...i,...r,ref:e})});Qae.displayName=TG;function Jae(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 ele(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 tle(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 nle(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 rle(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),ile(e)}function ile(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 sle=yG,ole=bG,ale=_G,lle=SG,cle=wG;function CG(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=CG(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function EG(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=CG(t))&&(r&&(r+=" "),r+=e);return r}const ule=(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},dle=(t,e)=>({classGroupId:t,validator:e}),AG=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),I2="-",uI=[],fle="arbitrary..",hle=t=>{const e=mle(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return ple(o);const a=o.split(I2),l=a[0]===""&&a.length>1?1:0;return NG(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?ule(c,l):l:c||uI}return n[o]||uI}}},NG=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=NG(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(I2):t.slice(e).join(I2),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(a))return d.classGroupId}},ple=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?fle+r:void 0})(),mle=t=>{const{theme:e,classGroups:n}=t;return gle(n,e)},gle=(t,e)=>{const n=AG();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];xle(o,e,n,r)}},xle=(t,e,n,r)=>{if(typeof t=="string"){vle(t,e,n);return}if(typeof t=="function"){yle(t,e,n,r);return}ble(t,e,n,r)},vle=(t,e,n)=>{const r=t===""?e:kG(e,t);r.classGroupId=n},yle=(t,e,n,r)=>{if(_le(t)){X7(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(dle(n,t))},ble=(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,kG(e,a),n,r)}},kG=(t,e)=>{let n=t;const r=e.split(I2),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=AG(),n.nextPart.set(o,a)),n=a}return n},_le=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Sle=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)}}},Ck="!",dI=":",wle=[],fI=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Mle=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===dI){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(Ck)?(m=p.slice(0,-1),x=!0):p.startsWith(Ck)&&(m=p.slice(1),x=!0);const b=c&&c>l?c-l:void 0;return fI(s,x,m,b)};if(e){const i=e+dI,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):fI(wle,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},Tle=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}},Cle=t=>({cache:Sle(t.cacheSize),parseClassName:Mle(t),sortModifiers:Tle(t),...hle(t)}),Ele=/\s+/,Ale=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Ele);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=!!_,M=r(S?b.substring(0,_):b);if(!M){if(!S){l=d+(l.length>0?" "+l:l);continue}if(M=r(b),!M){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+Ck:C,N=A+M;if(o.indexOf(N)>-1)continue;o.push(N);const D=i(M,S);for(let R=0;R<D.length;++R){const L=D[R];o.push(A+L)}l=d+(l.length>0?" "+l:l)}return l},Nle=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=RG(n))&&(i&&(i+=" "),i+=r);return i},RG=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=RG(t[r]))&&(n&&(n+=" "),n+=e);return n},kle=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((d,p)=>p(d),t());return n=Cle(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=Ale(l,n);return i(l,d),d};return s=o,(...l)=>s(Nle(...l))},Rle=[],la=t=>{const e=n=>n[t]||Rle;return e.isThemeGetter=!0,e},PG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,DG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ple=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dle=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ile=/\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$/,Ole=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lle=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jle=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,b0=t=>Ple.test(t),Yr=t=>!!t&&!Number.isNaN(Number(t)),_0=t=>!!t&&Number.isInteger(Number(t)),_A=t=>t.endsWith("%")&&Yr(t.slice(0,-1)),Zh=t=>Dle.test(t),IG=()=>!0,zle=t=>Ile.test(t)&&!Ole.test(t),Y7=()=>!1,Fle=t=>Lle.test(t),Ule=t=>jle.test(t),Ble=t=>!zn(t)&&!Un(t),Hle=t=>Am(t,jG,Y7),zn=t=>PG.test(t),vg=t=>Am(t,zG,zle),hI=t=>Am(t,Kle,Yr),Vle=t=>Am(t,UG,IG),Gle=t=>Am(t,FG,Y7),pI=t=>Am(t,OG,Y7),Wle=t=>Am(t,LG,Ule),b4=t=>Am(t,BG,Fle),Un=t=>DG.test(t),s_=t=>Ax(t,zG),$le=t=>Ax(t,FG),mI=t=>Ax(t,OG),qle=t=>Ax(t,jG),Xle=t=>Ax(t,LG),_4=t=>Ax(t,BG,!0),Yle=t=>Ax(t,UG,!0),Am=(t,e,n)=>{const r=PG.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Ax=(t,e,n=!1)=>{const r=DG.exec(t);return r?r[1]?e(r[1]):n:!1},OG=t=>t==="position"||t==="percentage",LG=t=>t==="image"||t==="url",jG=t=>t==="length"||t==="size"||t==="bg-size",zG=t=>t==="length",Kle=t=>t==="number",FG=t=>t==="family-name",UG=t=>t==="number"||t==="weight",BG=t=>t==="shadow",Zle=()=>{const t=la("color"),e=la("font"),n=la("text"),r=la("font-weight"),i=la("tracking"),s=la("leading"),o=la("breakpoint"),a=la("container"),l=la("spacing"),c=la("radius"),d=la("shadow"),p=la("inset-shadow"),m=la("text-shadow"),x=la("drop-shadow"),b=la("blur"),_=la("perspective"),S=la("aspect"),M=la("ease"),C=la("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(),Un,zn],R=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],k=()=>[Un,zn,l],O=()=>[b0,"full","auto",...k()],F=()=>[_0,"none","subgrid",Un,zn],B=()=>["auto",{span:["full",_0,Un,zn]},_0,Un,zn],Y=()=>[_0,"auto",Un,zn],V=()=>["auto","min","max","fr",Un,zn],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...k()],Q=()=>[b0,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],K=()=>[b0,"screen","full","dvw","lvw","svw","min","max","fit",...k()],re=()=>[b0,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],U=()=>[t,Un,zn],H=()=>[...N(),mI,pI,{position:[Un,zn]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",qle,Hle,{size:[Un,zn]}],le=()=>[_A,s_,vg],se=()=>["","none","full",c,Un,zn],J=()=>["",Yr,s_,vg],ee=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[Yr,_A,mI,pI],de=()=>["","none",b,Un,zn],ye=()=>["none",Yr,Un,zn],ge=()=>["none",Yr,Un,zn],Me=()=>[Yr,Un,zn],fe=()=>[b0,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zh],breakpoint:[Zh],color:[IG],container:[Zh],"drop-shadow":[Zh],ease:["in","out","in-out"],font:[Ble],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zh],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zh],shadow:[Zh],spacing:["px",Yr],text:[Zh],"text-shadow":[Zh],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",b0,zn,Un,S]}],container:["container"],columns:[{columns:[Yr,zn,Un,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:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[_0,"auto",Un,zn]}],basis:[{basis:[b0,"full","auto",a,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Yr,b0,"auto","initial","none",zn]}],grow:[{grow:["",Yr,Un,zn]}],shrink:[{shrink:["",Yr,Un,zn]}],order:[{order:[_0,"first","last","none",Un,zn]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...re()]}],"min-block-size":[{"min-block":["auto",...re()]}],"max-block-size":[{"max-block":["none",...re()]}],w:[{w:[a,"screen",...Q()]}],"min-w":[{"min-w":[a,"screen","none",...Q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,s_,vg]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Yle,Vle]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_A,zn]}],"font-family":[{font:[$le,Gle,e]}],"font-features":[{"font-features":[zn]}],"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,Un,zn]}],"line-clamp":[{"line-clamp":[Yr,"none",Un,hI]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",Un,zn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Un,zn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Yr,"from-font","auto",Un,vg]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Yr,"auto",Un,zn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Un,zn]}],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",Un,zn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_0,Un,zn],radial:["",Un,zn],conic:[_0,Un,zn]},Xle,Wle]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Yr,Un,zn]}],"outline-w":[{outline:["",Yr,s_,vg]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,_4,b4]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,_4,b4]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Yr,vg]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",m,_4,b4]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Yr,Un,zn]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"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":[Yr]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Un,zn]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":[Yr]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Un,zn]}],filter:[{filter:["","none",Un,zn]}],blur:[{blur:de()}],brightness:[{brightness:[Yr,Un,zn]}],contrast:[{contrast:[Yr,Un,zn]}],"drop-shadow":[{"drop-shadow":["","none",x,_4,b4]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Yr,Un,zn]}],"hue-rotate":[{"hue-rotate":[Yr,Un,zn]}],invert:[{invert:["",Yr,Un,zn]}],saturate:[{saturate:[Yr,Un,zn]}],sepia:[{sepia:["",Yr,Un,zn]}],"backdrop-filter":[{"backdrop-filter":["","none",Un,zn]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[Yr,Un,zn]}],"backdrop-contrast":[{"backdrop-contrast":[Yr,Un,zn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Yr,Un,zn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Yr,Un,zn]}],"backdrop-invert":[{"backdrop-invert":["",Yr,Un,zn]}],"backdrop-opacity":[{"backdrop-opacity":[Yr,Un,zn]}],"backdrop-saturate":[{"backdrop-saturate":[Yr,Un,zn]}],"backdrop-sepia":[{"backdrop-sepia":["",Yr,Un,zn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Un,zn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Yr,"initial",Un,zn]}],ease:[{ease:["linear","initial",M,Un,zn]}],delay:[{delay:[Yr,Un,zn]}],animate:[{animate:["none",C,Un,zn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Un,zn]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:Me()}],"skew-x":[{"skew-x":Me()}],"skew-y":[{"skew-y":Me()}],transform:[{transform:[Un,zn,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Un,zn]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",Un,zn]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Yr,s_,vg,hI]}],stroke:[{stroke:["none",...U()]}],"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"]}},Qle=kle(Zle);function bt(...t){return Qle(EG(t))}function HG({delayDuration:t=0,...e}){return f.jsx(sle,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Nx({...t}){return f.jsx(HG,{children:f.jsx(ole,{"data-slot":"tooltip",...t})})}function kx({...t}){return f.jsx(ale,{"data-slot":"tooltip-trigger",...t})}function Rx({className:t,sideOffset:e=4,children:n,...r}){return f.jsx(lle,{children:f.jsx(cle,{"data-slot":"tooltip-content",sideOffset:e,className:bt("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 K7={},Jle=Symbol((K7?"production":void 0)!=="production"?"RESET":""),VG=t=>typeof(t==null?void 0:t.then)=="function";function ece(t=()=>{try{return window.localStorage}catch(n){(K7?"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 VG(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 tce=ece();function Oo(t,e,n=tce,r){const i=Rr(e);return(K7?"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},Rr(o=>o(i),(o,a,l)=>{const c=typeof l=="function"?l(o(i)):l;return c===Jle?(a(i,e),n.removeItem(t)):VG(c)?c.then(d=>(a(i,d),n.setItem(t,d))):(a(i,c),n.setItem(t,c))})}const gs=Oo("dark-mode",!1),GG=Rr(!1),WG=Rr(!1),$G=Rr(!1),nce=()=>{try{const t=localStorage.getItem("selected-run-path");if(t!==null)return JSON.parse(t)}catch{}return null},gI=Rr(nce()),bl=Rr(t=>t(gI),(t,e,n)=>{e(gI,n);try{n===null?localStorage.removeItem("selected-run-path"):localStorage.setItem("selected-run-path",JSON.stringify(n))}catch{}}),LT=Oo("visible-runs",[]),qG=Rr(!1),XG=Rr(!1);function xs(t){const e=Rr({});return Rr(n=>{const r=n(bl);if(!r)return t;const i=n(e);return Object.prototype.hasOwnProperty.call(i,r)?i[r]:t},(n,r,i)=>{const s=n(bl);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 YG=Rr(!1),KG=Rr(!1),rce=Oo("overview-show-ema",!1),ice=Oo("overview-ema-span",10),sce=Oo("overview-show-all-runs",!1),oce=[{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"}],ace=Oo("overview-plots",oce),lce=Rr(!1),cce=Rr(10),uce=Rr("step"),dce=Rr(!1),fce=Rr(100),hce=Rr(3600),pce=Rr(0),mce=Rr("all"),gce=Rr(null),xce=Rr(null),Z7=Rr({}),vce=xs(0),yce=Rr(30),jT=xs(null),xI=xs(null),bce=Rr(0),_ce=Rr(0),zT=Rr(!0),Sce=Rr(!0),ZG=Rr(!1),wce=Rr(!1),Mce=Rr(14),Tce=Rr(0),Cce=Oo("inference-max-lanes",128),QG=xs(null),JG=xs(null),Ece=Oo("rollouts-selected-metrics",[]),Ace=Oo("rollouts-discarded-selected-metrics",[]),Q7=Oo("rollouts-metrics-sidebar-open",!0),SA=Oo("rollouts-discarded-metrics-sidebar-open",!0),J7=Oo("rollouts-sample-picker-sidebar-open",!0),wA=Oo("rollouts-discarded-sample-picker-sidebar-open",!0),eW=xs(null),vI=xs(null),tW=xs(null),yI=xs(null),nW=xs(null),bI=xs(null),rW=Rr("groups"),Nce=Oo("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),kce=Oo("rollouts-sample-picker-tooltips",!0),Rce=Oo("rollouts-sample-view-metrics",[]),_I=Rr("groups"),SI=xs(null),Pce=xs(null),wI=xs(null),MI=xs(null),TI=xs(null),MA=Oo("evals-sample-picker-sidebar-open",!0),CI=Rr("groups"),TA=Oo("evals-metrics-sidebar-open",!0),Dce=Oo("evals-selected-metrics",[]),Ice=Rr("metrics"),Oce=xs(0),Lce=Rr(60),jce=Rr(!0),zce=Rr(!1),Fce=Rr(1),Uce=xs(0),Bce=xs("separated"),Hce=xs(!0),Vce=xs(!0),Gce=xs(!0),Wce=xs(!0),$ce=xs("combined"),qce=xs("combined"),Xce=xs(!0),FT=Rr(null),UT=Oo("rollouts-render-options",["markdown","latex","code"]),BT=Oo("rollouts-format-think",!0),iW=Rr(null);function Yce(){const t=qn(gs);return w.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]),null}function Kce({children:t}){const[e]=w.useState(()=>new $ee({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return f.jsxs(Tte,{children:[f.jsx(Yce,{}),f.jsx(qee,{client:e,children:f.jsx(HG,{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 Zce=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qce=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),EI=t=>{const e=Qce(t);return e.charAt(0).toUpperCase()+e.slice(1)},sW=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),Jce=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 eue={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 tue=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>w.createElement("svg",{ref:l,...eue,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:sW("lucide",i),...!s&&!Jce(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,d])=>w.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 ri=(t,e)=>{const n=w.forwardRef(({className:r,...i},s)=>w.createElement(tue,{ref:s,iconNode:e,className:sW(`lucide-${Zce(EI(t))}`,`lucide-${t}`,r),...i}));return n.displayName=EI(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 nue=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rue=ri("arrow-down",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=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r2=ri("arrow-left",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:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],oue=ri("arrow-right",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:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],lue=ri("arrow-up",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 cue=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Nm=ri("check",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 uue=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],kr=ri("chevron-down",uue);/**
 * @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:"m15 18-6-6 6-6",key:"1wnfg3"}]],HT=ri("chevron-left",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 fue=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],tm=ri("chevron-right",fue);/**
 * @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=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],e8=ri("chevron-up",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 pue=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],mue=ri("chevrons-left",pue);/**
 * @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 gue=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],xue=ri("chevrons-right",gue);/**
 * @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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yue=ri("circle-check",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 bue=[["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"}]],_ue=ri("circle-x",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 Sue=[["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"}]],VT=ri("copy",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 wue=[["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"}]],Mue=ri("database",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:"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"}]],Cue=ri("file-code-corner",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:"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"}]],Aue=ri("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"}]],kue=ri("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 Rue=[["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"}]],GT=ri("grip-vertical",Rue);/**
 * @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 Pue=[["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"}]],Due=ri("layers",Pue);/**
 * @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=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Zl=ri("loader-circle",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 Oue=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],WT=ri("maximize-2",Oue);/**
 * @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"}]],Ek=ri("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 jue=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],$T=ri("minimize-2",jue);/**
 * @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 zue=[["path",{d:"M5 12h14",key:"1ays0h"}]],Fue=ri("minus",zue);/**
 * @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 Uue=[["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"}]],Bue=ri("moon",Uue);/**
 * @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"}]],Vue=ri("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 Gue=[["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"}]],Wue=ri("panel-right-close",Gue);/**
 * @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=[["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"}]],oW=ri("pencil",$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 que=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],hp=ri("plus",que);/**
 * @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 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yue=ri("search",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 Kue=[["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"}]],aW=ri("settings",Kue);/**
 * @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 Zue=[["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"}]],bh=ri("sliders-horizontal",Zue);/**
 * @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 Que=[["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"}]],Jue=ri("sun",Que);/**
 * @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 ede=[["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"}]],tde=ri("trash-2",ede);/**
 * @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 nde=[["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"}]],rde=ri("triangle-alert",nde);/**
 * @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 ide=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qa=ri("x",ide);function nd({...t}){return f.jsx(jB,{"data-slot":"dialog",...t})}function qT({...t}){return f.jsx(zB,{"data-slot":"dialog-trigger",...t})}function sde({...t}){return f.jsx(FB,{"data-slot":"dialog-portal",...t})}function ode({className:t,...e}){return f.jsx(UB,{"data-slot":"dialog-overlay",className:bt("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 rd({className:t,children:e,...n}){return f.jsxs(sde,{children:[f.jsx(ode,{}),f.jsxs(BB,{"data-slot":"dialog-content",className:bt("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(S7,{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(qa,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function iu({className:t,...e}){return f.jsx("div",{"data-slot":"dialog-header",className:bt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function XT({className:t,...e}){return f.jsx("div",{"data-slot":"dialog-footer",className:bt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function su({className:t,...e}){return f.jsx(HB,{"data-slot":"dialog-title",className:bt("text-lg leading-none font-semibold",t),...e})}function Xg({className:t,...e}){return f.jsx(VB,{"data-slot":"dialog-description",className:bt("text-muted-foreground text-sm",t),...e})}function oo({...t}){return f.jsx(hoe,{"data-slot":"dropdown-menu",...t})}function ao({...t}){return f.jsx(poe,{"data-slot":"dropdown-menu-trigger",...t})}function lo({className:t,align:e="start",sideOffset:n=4,...r}){return f.jsx(moe,{children:f.jsx(goe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:bt("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 ua({className:t,inset:e,variant:n="default",...r}){return f.jsx(voe,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:bt("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 Er({className:t,children:e,checked:n,...r}){return f.jsxs(yoe,{"data-slot":"dropdown-menu-checkbox-item",className:bt("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(boe,{children:f.jsx(Nm,{})})}),e]})}function om({className:t,inset:e,...n}){return f.jsx(xoe,{"data-slot":"dropdown-menu-label","data-inset":e,className:bt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function Bs({className:t,...e}){return f.jsx(_oe,{"data-slot":"dropdown-menu-separator",className:bt("bg-border -mx-1 my-1 h-px",t),...e})}function ade({...t}){return f.jsx(Soe,{"data-slot":"dropdown-menu-sub",...t})}function lde({className:t,inset:e,children:n,...r}){return f.jsxs(woe,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:bt("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(tm,{className:"ml-auto"})]})}function cde({className:t,...e}){return f.jsx(Moe,{"data-slot":"dropdown-menu-sub-content",className:bt("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,NI=EG,t8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return NI(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 NI(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},ude=t8("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 En({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?JU:"button";return f.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:bt(ude({variant:e,size:n,className:t})),...i})}function ah({className:t,type:e,...n}){return f.jsx("input",{type:e,"data-slot":"input",className:bt("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 dde({className:t,...e}){return f.jsx(Coe,{"data-slot":"label",className:bt("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 gl({className:t,...e}){return f.jsx(Zl,{role:"status","aria-label":"Loading",className:bt("size-4 animate-spin",t),...e})}function Px({className:t,children:e,...n}){return f.jsxs(Qoe,{"data-slot":"scroll-area",className:bt("relative",t),...n,children:[f.jsx(Joe,{"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(fde,{}),f.jsx(eae,{})]})}function fde({className:t,orientation:e="vertical",...n}){return f.jsx(kV,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:bt("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(IV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function YT({...t}){return f.jsx(joe,{"data-slot":"popover",...t})}function KT({...t}){return f.jsx(zoe,{"data-slot":"popover-trigger",...t})}function ZT({className:t,align:e="center",sideOffset:n=4,...r}){return f.jsx(Foe,{children:f.jsx(Uoe,{"data-slot":"popover-content",align:e,sideOffset:n,className:bt("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 O2({...t}){return f.jsx(vre,{"data-slot":"alert-dialog",...t})}function hde({...t}){return f.jsx(yre,{"data-slot":"alert-dialog-portal",...t})}function pde({className:t,...e}){return f.jsx(bre,{"data-slot":"alert-dialog-overlay",className:bt("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 L2({className:t,size:e="default",...n}){return f.jsxs(hde,{children:[f.jsx(pde,{}),f.jsx(_re,{"data-slot":"alert-dialog-content","data-size":e,className:bt("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 j2({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-header",className:bt("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 z2({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-footer",className:bt("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 mde({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-media",className:bt("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 F2({className:t,...e}){return f.jsx(Mre,{"data-slot":"alert-dialog-title",className:bt("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 U2({className:t,...e}){return f.jsx(Tre,{"data-slot":"alert-dialog-description",className:bt("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...e})}function B2({className:t,variant:e="default",size:n="default",...r}){return f.jsx(En,{variant:e,size:n,asChild:!0,children:f.jsx(Sre,{"data-slot":"alert-dialog-action",className:bt(t),...r})})}function H2({className:t,variant:e="outline",size:n="default",...r}){return f.jsx(En,{variant:e,size:n,asChild:!0,children:f.jsx(wre,{"data-slot":"alert-dialog-cancel",className:bt(t),...r})})}const rr="",Io=5e3,CA={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"},R_={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"},H_="#0284c7",EA="#10b981",_S="#ababab",SS="#555555",QT="#c9c9c9",wS="#4a4a4a",kI={request:H_,weight_broadcast:"#f97316"},MS="#e6e9ed",n8="#2a2d32",JT="#6b7280";function r8(t){if(CA[t])return CA[t];for(const[e,n]of Object.entries(CA))if(t.startsWith(e))return n;return JT}function V2(t){if(R_[t])return R_[t];if(t.includes("/")){const e=t.split("/")[0];if(R_[e])return R_[e]}return JT}function lW(t){return kI[t]?kI[t]:JT}function i8(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function cW(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 km(){return Ei({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${rr}/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:Io}})}function gde(t=!0){return Ei({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${rr}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function xde(t=!0){return Ei({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${rr}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function vde(t,e,n,r){return Ei({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${rr}/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:Io})}function yde(t,e,n,r){return Ei({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${rr}/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:Io})}function bde(t,e,n,r,i){return Ei({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${rr}/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:Io})}function uW(t,e,n,r,i){return Ei({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${rr}/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 s8(t,e,n){const r=w.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=w.useMemo(()=>r.map(s=>`${s.group_id}:${s.sample_idx}`).join("|"),[r]);return Ei({queryKey:["sample-statuses",t,i],queryFn:async()=>{const s=await fetch(`${rr}/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 gd(t,e,n){return Ei({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${rr}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?Io:!1})}function _de(t,e,n,r){return Ei({queryKey:["logs",t,e,n],queryFn:async()=>{const i=await fetch(`${rr}/api/logs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,page_size:500,...n})});if(!i.ok)throw new Error("Failed to fetch logs");return i.json()},enabled:!!t,refetchInterval:Io,placeholderData:Lc})}function Sde(t,e){return Ei({queryKey:["logs-summary",t],queryFn:async()=>{const n=await fetch(`${rr}/api/logs/summary/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch logs summary");return n.json()},enabled:!!t,staleTime:1e4})}function RI(t,e){return Ei({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${rr}/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 PI(t,e,n){return Ei({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${rr}/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:Lc})}function wde(t,e,n){return Ei({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${rr}/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:Lc})}function Mde(t,e,n,r,i){return Ei({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${rr}/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:Io,placeholderData:Lc,gcTime:0})}function Tde(t,e,n){return Ei({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${rr}/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 Cde(t,e,n,r,i){return Ei({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${rr}/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 Wd(t,e,n,r=60){return Ei({queryKey:["inference-performance",t,r],queryFn:async()=>{const i=await fetch(`${rr}/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?Io:!1,placeholderData:Lc})}function Xu(t,e,n,r=60){return Ei({queryKey:["trainer-performance",t,r],queryFn:async()=>{const i=await fetch(`${rr}/trainer-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 trainer performance");return i.json()},enabled:e&&!!t,refetchInterval:n?Io:!1,placeholderData:Lc})}function Ede(t,e,n,r,i,s,o){const a=n.filter(l=>Number.isFinite(l.rank));return Zee({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(`${rr}/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:Io,placeholderData:Lc}))})}function Ade(t,e,n,r,i,s){return Ei({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const o=await fetch(`${rr}/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:Io,placeholderData:Lc})}function Nde(t,e,n,r,i,s,o,a){return Ei({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${rr}/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:Io,placeholderData:Lc})}function kde(t,e,n,r,i,s,o,a){return Ei({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${rr}/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:Io,placeholderData:Lc})}function Rde(t,e,n,r,i,s){const o=Cx(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const d=a.current;if(d.length>0&&t.length<d.length){const p=new Set(d);if(t.every(x=>p.has(x))){const x=["step-metrics-multi",d,e,i,s],b=o.getQueryData(x);if(b){const _=new Set(t),S=["step-metrics-multi",t,e,i,s];o.setQueryData(S,{runs:b.runs.filter(M=>_.has(M.run_path))})}}}a.current=t}return Ei({queryKey:["step-metrics-multi",t,e,i,s],queryFn:async()=>{const d={run_paths:t,metric_names:e,limit:1e5};i&&Object.keys(i).length>0&&(d.tag_filters=i),s&&s.length>0&&(d.env_filters=s);const p=await fetch(`${rr}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!p.ok)throw new Error("Failed to fetch step metrics (multi-run)");return p.json()},enabled:n&&t.length>0,refetchInterval:r?Io:!1,staleTime:Io})}function Vr(t,e,n){return Ei({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${rr}/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?Io:!1})}function dW(t,e,n,r){return Ei({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${rr}/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?Io:!1,placeholderData:Lc})}function Pde(t,e,n,r,i,s){return Ei({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(`${rr}/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?Io:!1,placeholderData:Lc})}function Dde(t,e,n,r,i,s){const o=Cx(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const d=a.current;if(d.length>0&&t.length<d.length){const p=new Set(d);if(t.every(x=>p.has(x))){const x=["eval-step-metrics-multi",d,e,n,s],b=o.getQueryData(x);if(b){const _=new Set(t),S=["eval-step-metrics-multi",t,e,n,s];o.setQueryData(S,{runs:b.runs.filter(M=>_.has(M.run_path))})}}}a.current=t}return Ei({queryKey:["eval-step-metrics-multi",t,e,n,s],queryFn:async()=>({runs:await Promise.all(t.map(async p=>{const m={run_path:p,eval_name:e,metric_names:n,limit:1e5};s&&s.length>0&&(m.env_filters=s);const x=await fetch(`${rr}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});if(!x.ok)return{run_path:p,metrics:[]};const b=await x.json();return{run_path:p,metrics:b.metrics??[]}}))}),enabled:r&&t.length>0&&!!e&&n.length>0,refetchInterval:i?Io:!1,staleTime:Io})}function Ide(t,e,n,r){return Ei({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${rr}/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:Lc})}function fW(t,e,n,r){return Ei({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${rr}/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?Io:!1,staleTime:3e4,placeholderData:Lc})}function hW(){return Ei({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${rr}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function Ode(){return Ei({queryKey:["custom-metrics-templates"],queryFn:async()=>{const t=await fetch(`${rr}/custom-metrics-templates`);if(!t.ok)throw new Error("Failed to fetch custom metrics templates");return t.json()},staleTime:6e4})}function Lde(t){return Ei({queryKey:["custom-metrics-template",t],queryFn:async()=>{const e=await fetch(`${rr}/custom-metrics-templates/${t}`);if(!e.ok)throw new Error("Failed to fetch template");return e.json()},enabled:!!t,staleTime:6e4})}function am(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 pp(t){return`${t.toFixed(0)}s`}function gu(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 pW(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 eC(t){if(t<60)return`${pW(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 Ak(t){const e=`${pW(t)}s`;return t<60?e:`${eC(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function ud(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 Ko(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 ry(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 C1=16,jde=6,DI=4,zde=2;function mW(t,e=C1){const n=Math.max(jde,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(zde,n-DI);return{prefix:t.slice(0,r),suffix:t.slice(-DI),isTruncated:!0}}function Pi({...t}){return f.jsx(qte,{"data-slot":"collapsible",...t})}function Di({...t}){return f.jsx(Xte,{"data-slot":"collapsible-trigger",...t})}function Ii({...t}){return f.jsx(Yte,{"data-slot":"collapsible-content",...t})}function Fde(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 Ude(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 Bde(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"?Fde(t,2):String(t)}function Hde(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 II(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 Vde(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=Ude(c),p=l==="environments"?Hde(d):d;let m=!1;for(const x of e)if(x.match(l)){n.get(x.key).items.push({key:l,displayKey:II(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:II(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 Gde({displayKey:t,value:e}){const n=Bde(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 Wde="ml-[22px]",$de="ml-[38px]";function gW({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,o]=w.useState(e),[a,l]=w.useState(r),[c,d]=w.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(Pi,{open:s,onOpenChange:o,children:[f.jsx(Di,{asChild:!0,children:f.jsx("div",{className:bt("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(kr,{className:bt("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(Ii,{children:p?f.jsx("div",{className:"mt-1",children:t.subcategories.map(m=>f.jsx(gW,{category:m,nested:!0,collapseAllSignal:r,expandAllSignal:i},m.key))}):f.jsx("div",{className:bt("mt-1",n?$de:Wde),children:t.items.map(m=>f.jsx(Gde,{displayKey:m.displayKey,value:m.value},m.key))})})]})}function xW({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=w.useMemo(()=>Vde(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(gW,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const vW="#e67439",qde="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",Xde=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function E1(t){return Math.max(0,Math.min(1,t))}function lx(t){return Math.max(0,Math.min(255,Math.round(t)))}function G2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(lx(t))}${r(lx(e))}${r(lx(n))}`}function o8(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 Yde({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 Kde({h:t,s:e,v:n}){const r=(t%360+360)%360,i=E1(e),s=E1(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:lx((c+l)*255),g:lx((d+l)*255),b:lx((p+l)*255)}}function Zde(t,e){const n=o8(t);if(!n)return"#000000";const r=E1(1-e);return G2({r:n.r*r,g:n.g*r,b:n.b*r})}function V_(t,e=vW){const n=o8(t);return n?G2(n):e}function Qde({value:t,onChange:e,className:n}){const r=w.useMemo(()=>V_(t,vW),[t]),i=w.useMemo(()=>o8(r),[r]),s=w.useMemo(()=>Yde(i),[i]),[o,a]=w.useState(r.slice(1).toUpperCase());w.useEffect(()=>{a(r.slice(1).toUpperCase())},[r]);const l=w.useCallback(x=>{const b=G2(Kde(x));e(b)},[e]),c=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=E1((x.clientX-b.left)/b.width),S=E1((x.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-S})},[s.h,l]),d=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=E1((x.clientX-b.left)/b.width);l({h:_*360,s:s.s,v:s.v})},[s.s,s.v,l]),p=w.useCallback(()=>{const b=`#${o.replace(/[^0-9a-f]/gi,"")}`,_=V_(b,r);a(_.slice(1).toUpperCase()),_!==r&&e(_)},[o,r,e]),m=w.useCallback((x,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const S={...i,[x]:lx(_)};e(G2(S))},[e,i]);return f.jsxs("div",{className:bt("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:qde},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(ah,{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(ah,{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:Xde.map(x=>f.jsx("button",{type:"button",className:bt("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:Zde(x,.2)},onClick:()=>e(x),"aria-label":`Use color ${x}`},x))})]})}const yW=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],Jde=yW.map(t=>t.key);function efe(t){return Jde.indexOf(t)}function AA(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 tfe({open:t,onOpenChange:e}){const[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,a]=w.useState(null),l=w.useRef(null),c=o!=null&&o.status!=="idle"&&o.status!=="done"&&o.status!=="error",d=w.useCallback(async()=>{s(!0);try{const M=await fetch(`${rr}/database-info`);if(M.ok){const C=await M.json();r(C.size_bytes)}}catch{}finally{s(!1)}},[]);w.useEffect(()=>(t&&(d(),a(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,d]);const p=async()=>{try{const M=await fetch(`${rr}/compact-database`,{method:"POST"});if(!M.ok){const C=await M.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(`${rr}/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(M){a({status:"error",error:M instanceof Error?M.message:"Unknown error",size_before:null,size_after:null})}},m=M=>{c&&!M||e(M)},x=o?efe(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(nd,{open:t,onOpenChange:m,children:f.jsxs(rd,{className:bt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:M=>{c&&M.preventDefault()},onEscapeKeyDown:M=>{c&&M.preventDefault()},children:[f.jsxs(iu,{children:[f.jsxs(su,{className:"flex items-center gap-2",children:[f.jsx(Mue,{className:"h-4 w-4"}),"Database"]}),!S&&f.jsx(Xg,{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(gl,{className:"h-3.5 w-3.5"}):n!=null?AA(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:[yW.map((M,C)=>{const A=M.key===o.status,N=b||x>C||_&&x>C,D=_&&M.key===o.status;return f.jsxs("div",{className:"flex items-center gap-2.5",children:[N?f.jsx(yue,{className:"h-4 w-4 text-green-500 shrink-0"}):D?f.jsx(_ue,{className:"h-4 w-4 text-destructive shrink-0"}):A?f.jsx(gl,{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:bt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",D&&"text-destructive font-medium",!N&&!A&&!D&&"text-muted-foreground/60"),children:[M.label,A&&!b&&!_&&"…"]})]},M.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:AA(o.size_before)})," → ",f.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:AA(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(XT,{children:[!S&&f.jsx(En,{onClick:p,disabled:i||n==null,children:"Compress Database"}),(b||_)&&f.jsx(En,{onClick:()=>e(!1),children:"Close"})]})]})})}function S4({name:t,className:e,maxChars:n=C1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:o}=mW(t,n);return i?f.jsxs(Nx,{delayDuration:300,children:[f.jsx(kx,{asChild:!0,children:f.jsxs("span",{className:bt("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(Rx,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):f.jsx("span",{className:bt("truncate",r),children:s})}function nfe(){const{pathname:t}=xh(),e=Cx(),[n,r]=hn(bl),[i,s]=hn(LT),[o,a]=hn(GG),[l,c]=hn(WG),[d,p]=hn(gs),m=td(FT),x=td(YG),b=td(KG),[_,S]=w.useState(!1),[M,C]=hn($G),[A,N]=w.useState(""),[D,R]=w.useState(!1),[L,k]=w.useState(null),[O,F]=w.useState(null),[B,Y]=w.useState(!1),[V,q]=w.useState(""),[G,$]=w.useState(!1),[Q,K]=w.useState(!1),[re,U]=w.useState(null),[H,X]=w.useState(null),[j,le]=w.useState("removed_at"),[se,J]=w.useState("desc"),[ee,ie]=w.useState(null),[oe,de]=w.useState(null),[ye,ge]=w.useState(null),[Me,fe]=w.useState(null),[Se,me]=w.useState(!1),[Pe,ce]=w.useState(""),[He,Be]=w.useState(null),[Ge,We]=w.useState(!1),[ae,Z]=w.useState(null),[he,be]=w.useState({}),we=td(XG),ve=td(qG),{data:Re,isLoading:Ae}=km(),{data:Oe,isLoading:qe}=gde(_),{data:Fe,refetch:Ke}=xde(M),je=w.useRef(new Map);w.useEffect(()=>{if(!(Re!=null&&Re.runs))return;const $e=je.current,dt=[];for(const Tt of Re.runs){const Bt=$e.get(Tt.run_id);Bt!=null&&Bt.is_syncing&&!Tt.is_syncing&&dt.push(Tt.run_id),Bt!=null&&Bt.is_tracking&&!Tt.is_tracking&&dt.push(Tt.run_id),$e.set(Tt.run_id,{is_syncing:Tt.is_syncing,is_tracking:Tt.is_tracking})}if(dt.length>0){const Tt=[...new Set(dt)];for(const Bt of Tt)e.invalidateQueries({predicate:Ct=>{const At=Ct.queryKey;return Array.isArray(At)?At.some(Ot=>!!(Ot===Bt||Array.isArray(Ot)&&Ot.includes(Bt))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[Re==null?void 0:Re.runs,e]),w.useEffect(()=>{if(!(Re!=null&&Re.runs)||!n)return;const $e=Re.runs.find(dt=>dt.run_id===n);$e&&(we($e.is_syncing),ve($e.is_tracking))},[Re==null?void 0:Re.runs,n,we,ve]),w.useEffect(()=>{t!=="/"&&(x(!1),b(!1))},[t,x,b]),w.useEffect(()=>{if(!(Re!=null&&Re.runs))return;const $e=new Set(Re.runs.map(dt=>dt.run_id));s(dt=>{const Tt=dt.filter(Bt=>$e.has(Bt));return Tt.length===dt.length?dt:Tt}),n&&!$e.has(n)&&(r(null),we(!1),ve(!1))},[Re==null?void 0:Re.runs,n,r,s,we,ve]);const Te=w.useMemo(()=>{const $e=(Oe==null?void 0:Oe.runs)??[];return $e.length===0?$e:[...$e].sort((dt,Tt)=>{const Bt=j;let Ct,At;if(Bt==="run_id"?(Ct=dt.run_id.split("/").pop()??dt.run_id,At=Tt.run_id.split("/").pop()??Tt.run_id):(Ct=dt[Bt],At=Tt[Bt]),Ct==null&&At==null)return 0;if(Ct==null)return 1;if(At==null)return-1;const Ot=Ct.localeCompare(At);return se==="asc"?Ot:-Ot})},[Oe==null?void 0:Oe.runs,j,se]),Xe=$e=>{j===$e?J(dt=>dt==="asc"?"desc":"asc"):(le($e),J("asc"))},ht=async $e=>{$e.preventDefault();const dt=G?{use_netrc:!0}:{api_key:V.trim(),use_netrc:!1};if(!(!G&&!V.trim())){K(!0);try{const Tt=await fetch(`${rr}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(dt)});if(!Tt.ok){const Bt=await Tt.json();throw new Error(Bt.detail||"Failed to configure W&B")}a(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),q("")}catch(Tt){console.error("Failed to configure W&B:",Tt)}finally{K(!1)}}},ke=$e=>{S(!1),r($e),fetch(`${rr}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})}).then(dt=>{if(!dt.ok)return dt.json().then(Tt=>{throw new Error(Tt.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(dt=>{console.error("Failed to add run:",dt)})},et=async()=>{const $e=A.trim();if($e){R(!0),k(null);try{const dt=await fetch(`${rr}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:$e})});if(!dt.ok){const Tt=await dt.json();k(Tt.detail||"Failed to add project");return}N(""),C(!1),Ke(),e.invalidateQueries({queryKey:["runs"]})}catch{k("Failed to add project")}finally{R(!1)}}},ct=async $e=>{F($e);try{const dt=await fetch(`${rr}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:$e})});if(!dt.ok){const Tt=await dt.json();throw new Error(Tt.detail||"Failed to remove project")}Ke()}catch(dt){console.error("Failed to remove project:",dt)}finally{F(null)}},yt=async $e=>{if($e){U($e);try{const dt=await fetch(`${rr}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!dt.ok){const Tt=await dt.json();throw new Error(Tt.detail||"Failed to remove run")}s(Tt=>Tt.filter(Bt=>Bt!==$e)),n===$e&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(dt){console.error("Failed to remove run:",dt)}finally{U(null),X(null)}}},lt=$e=>{s(dt=>dt.includes($e)?dt.filter(Tt=>Tt!==$e):[...dt,$e])},Je=w.useCallback(($e,dt)=>{e.setQueryData(["runs"],Tt=>Tt&&{...Tt,runs:Tt.runs.map(Bt=>Bt.run_id===$e?{...Bt,color:dt}:Bt)})},[e]),Ee=w.useCallback(async($e,dt,Tt)=>{const Bt=V_(dt,Tt);if(Bt.toLowerCase()!==Tt.toLowerCase()){Je($e,Bt);try{const Ct=await fetch(`${rr}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e,color:Bt})});if(!Ct.ok){let At="Failed to update run color";try{At=(await Ct.json()).detail??At}catch{}throw new Error(At)}}catch(Ct){console.error("Failed to update run color:",Ct),Je($e,Tt)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,Je]),Ze=w.useCallback(($e,dt,Tt)=>{if(dt){Z($e),be(Ct=>Ct[$e]===Tt?Ct:{...Ct,[$e]:Tt});return}Z(Ct=>Ct===$e?null:Ct);const Bt=he[$e];Bt&&Ee($e,Bt,Tt),be(Ct=>{if(!($e in Ct))return Ct;const At={...Ct};return delete At[$e],At})},[Ee,he]),Ie=w.useCallback(async $e=>{ge($e);try{const dt=Re==null?void 0:Re.runs.find(Bt=>Bt.run_id===$e);dt!=null&&dt.is_tracking&&await fetch(`${rr}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});const Tt=await fetch(`${rr}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!Tt.ok){const Bt=await Tt.json();throw new Error(Bt.detail||"Failed to delete run data")}await fetch(`${rr}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})}),e.invalidateQueries({queryKey:["run-summary",$e]}),e.invalidateQueries({queryKey:["runs"]})}catch(dt){console.error("Failed to force full resync:",dt)}finally{ge(null),de(null)}},[Re==null?void 0:Re.runs,e]),Ue=w.useCallback(async $e=>{fe($e);try{const dt=await fetch(`${rr}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!dt.ok){const Tt=await dt.json();throw new Error(Tt.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",$e]}),e.invalidateQueries({queryKey:["runs"]})}catch(dt){console.error("Failed to sync evals after training:",dt)}finally{fe(null)}},[e]),rt=Pe.trimStart().toLowerCase().startsWith("config:"),ut=w.useCallback(async()=>{const dt=Pe.trimStart().slice(7).trim();if(dt){We(!0);try{const Tt=await fetch(`${rr}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:dt})});if(!Tt.ok){Be([]);return}const Bt=await Tt.json();Be(Bt.run_ids??[])}catch{Be([])}finally{We(!1)}}},[Pe]);w.useEffect(()=>{rt||Be(null)},[rt]);const Dt=(Re==null?void 0:Re.runs)||[],Rt=Re==null?void 0:Re.discovery,St=(Re==null?void 0:Re.has_wandb_key)??o,Ht=(Re==null?void 0:Re.has_netrc_wandb_key)??!1,en=(Re==null?void 0:Re.wandb_key_source)??"unconfigured";w.useEffect(()=>{l&&$(en==="netrc")},[l,en]);const Ut=[{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(v2,{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($e=>!$e),className:"text-sidebar-foreground/60 hover:text-sidebar-foreground transition-colors","aria-label":"Toggle dark mode",children:d?f.jsx(Bue,{className:"h-4 w-4"}):f.jsx(Jue,{className:"h-4 w-4"})})]}),f.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:Ut.map($e=>f.jsx(v2,{to:$e.href,onClick:()=>{$e.href==="/"&&(x(!1),b(!1))},className:bt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",$e.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:$e.title},$e.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(ah,{type:"text",placeholder:"Search runs…",value:Pe,onChange:$e=>ce($e.target.value),onKeyDown:$e=>{$e.key==="Enter"&&rt&&($e.preventDefault(),ut())},className:bt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",rt&&"pr-10")}),rt&&f.jsx(En,{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:ut,disabled:Ge,children:Ge?f.jsx(gl,{className:"h-2.5 w-2.5"}):"Go"})]}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsx(En,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:f.jsx(Ek,{className:"h-3.5 w-3.5"})})}),f.jsxs(lo,{align:"end",className:"w-48",children:[f.jsx(ua,{className:"text-xs",onClick:()=>C(!0),children:"Add Project"}),f.jsx(ua,{className:"text-xs",onClick:()=>S(!0),children:"Add Run"}),f.jsxs(ua,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",St?f.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):f.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),f.jsx(Bs,{}),f.jsx(ua,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),f.jsxs(ua,{className:"text-xs flex items-center justify-between",onClick:()=>me($e=>!$e),children:["Only Show Selected",f.jsx(Nm,{className:bt("h-3.5 w-3.5",Se?"opacity-100":"opacity-0")})]}),f.jsx(Bs,{}),f.jsx(ua,{className:"text-xs flex items-center gap-1.5",onClick:()=>Y(!0),children:"Database"})]})]})]}),(Rt==null?void 0:Rt.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(gl,{className:"h-3 w-3 shrink-0"}),(Rt==null?void 0:Rt.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(Px,{className:"flex-1 min-h-0 overflow-hidden",children:f.jsx("div",{className:"px-2 pb-2",children:Ae?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(gl,{className:"h-4 w-4"})}):f.jsxs("div",{className:"flex flex-col",children:[Dt.filter($e=>{if(Se&&n!==$e.run_id&&!i.includes($e.run_id))return!1;if(rt){if(He!==null&&!He.includes($e.run_id))return!1}else if(Pe.trim()){const dt=Pe.trim().toLowerCase(),Tt=($e.name||"").toLowerCase(),Bt=$e.run_id.toLowerCase();if(!Tt.includes(dt)&&!Bt.includes(dt))return!1}return!0}).map($e=>{const dt=n===$e.run_id,Tt=dt||i.includes($e.run_id),Bt=he[$e.run_id],Ct=V_(Bt??$e.color,$e.color),At=$e.last_rollout_step===-1&&!$e.is_syncing&&!$e.is_tracking,Ot=Number($e.is_tracking)+Number($e.is_syncing),cn=Ot>=2?C1-4:Ot===1?C1-2:C1-1,Lt=$e.name||$e.run_id.split("/").pop()||$e.run_id;return f.jsxs("div",{className:bt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!dt&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",dt&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r($e.run_id),onMouseEnter:()=>{Tt&&m($e.run_id)},onMouseLeave:()=>m(null),children:[f.jsx("button",{onClick:wt=>{wt.stopPropagation(),dt||lt($e.run_id)},disabled:dt,className:bt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",Tt?"bg-foreground border-foreground":"border-muted-foreground/50",dt&&"opacity-50 cursor-not-allowed"),children:Tt&&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(YT,{open:ae===$e.run_id,onOpenChange:wt=>Ze($e.run_id,wt,$e.color),children:[f.jsx(KT,{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:Ct},onClick:wt=>wt.stopPropagation(),"aria-label":`Change color for ${Lt}`})}),f.jsx(ZT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:wt=>wt.stopPropagation(),onOpenAutoFocus:wt=>wt.preventDefault(),children:f.jsx(Qde,{value:Ct,onChange:wt=>{be(Zt=>({...Zt,[$e.run_id]:V_(wt,$e.color)}))}})})]}),f.jsx("div",{className:bt("flex-1 min-w-0 text-left",At&&"text-muted-foreground/60"),children:f.jsx(S4,{name:Lt,maxChars:cn})}),$e.is_tracking&&f.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),$e.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:ry($e.created_at)}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsx(En,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:re===$e.run_id,onClick:wt=>wt.stopPropagation(),children:f.jsx(Ek,{className:"h-3.5 w-3.5"})})}),f.jsxs(lo,{align:"end",className:"w-auto",children:[f.jsx(om,{className:"text-xs font-normal",children:f.jsx("span",{className:"font-sans",children:$e.run_id})}),f.jsx(Bs,{}),f.jsx(ua,{disabled:ye===$e.run_id,onClick:wt=>{wt.stopPropagation(),de($e.run_id)},children:ye===$e.run_id?"Resyncing...":"Force Full Resync"}),f.jsx(ua,{disabled:Me===$e.run_id,onClick:wt=>{wt.stopPropagation(),Ue($e.run_id)},children:Me===$e.run_id?"Syncing evals...":"Sync Evals After Training"}),f.jsx(ua,{className:"text-destructive",disabled:re===$e.run_id,onClick:wt=>{wt.stopPropagation(),X($e.run_id)},children:"Remove"})]})]})]})]},$e.run_id)}),Dt.length===0&&f.jsx("div",{className:"text-center py-4 px-2",children:St?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(En,{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(nd,{open:l,onOpenChange:c,children:f.jsxs(rd,{className:"sm:max-w-md",children:[f.jsxs(iu,{children:[f.jsx(su,{children:"Configure W&B"}),f.jsx(Xg,{children:G?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:ht,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:G,onChange:$e=>$($e.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"})]}),G&&!Ht&&f.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",f.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),G&&Ht&&f.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!G&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(dde,{htmlFor:"config-api-key",children:"W&B API Key"}),St&&en==="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(ah,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:V,onChange:$e=>q($e.target.value),required:!0})]})]}),f.jsxs(XT,{children:[f.jsx(En,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),f.jsx(En,{type:"submit",disabled:Q||(G?!Ht:!V.trim()),children:Q?f.jsxs(f.Fragment,{children:[f.jsx(gl,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),f.jsx(nd,{open:_,onOpenChange:S,children:f.jsxs(rd,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:$e=>{$e.preventDefault();const dt=$e.currentTarget;dt==null||dt.focus()},children:[f.jsxs(iu,{className:"pb-3",children:[f.jsx(su,{children:"Add Run"}),f.jsx(Xg,{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($e=>f.jsxs("button",{className:bt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",$e.cls),onClick:()=>Xe($e.key),children:[$e.label,j===$e.key&&(se==="asc"?f.jsx(lue,{className:"h-2.5 w-2.5"}):f.jsx(rue,{className:"h-2.5 w-2.5"}))]},$e.key)),f.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),f.jsx("div",{className:"py-1",children:qe?f.jsx("div",{className:"flex items-center justify-center py-6",children:f.jsx(gl,{className:"h-4 w-4"})}):f.jsxs(f.Fragment,{children:[Te.map($e=>{const dt=$e.run_id.split("/").pop()??$e.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:$e.color??"#888"},onClick:()=>ke($e.run_id)}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>ke($e.run_id),children:f.jsx(S4,{name:$e.name??"Unnamed"})}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>ke($e.run_id),children:f.jsx(S4,{name:$e.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),f.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>ke($e.run_id),children:f.jsx(S4,{name:$e.project??"—",className:"text-xs font-sans text-muted-foreground"})}),f.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>ke($e.run_id),children:dt}),f.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>ke($e.run_id),children:$e.created_at?new Date($e.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:()=>ke($e.run_id),children:$e.removed_at?ry($e.removed_at):"—"}),f.jsx(En,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:Tt=>{Tt.stopPropagation(),ie($e)},disabled:!$e.config,children:"View"})]},$e.run_id)}),Te.length===0&&f.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),f.jsx(nd,{open:M,onOpenChange:C,children:f.jsxs(rd,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[f.jsxs(iu,{className:"pb-3",children:[f.jsx(su,{children:"Known Projects"}),f.jsx(Xg,{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(ah,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:A,onChange:$e=>{N($e.target.value),L&&k(null)},onKeyDown:$e=>{$e.key==="Enter"&&et()}}),f.jsx(En,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:et,disabled:D||!A.trim(),children:D?f.jsx(gl,{className:"h-3 w-3"}):"Ok"})]}),L&&f.jsx("span",{className:"text-[11px] text-red-500",children:L})]}),f.jsxs("div",{className:"space-y-1",children:[Fe==null?void 0:Fe.projects.map($e=>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:$e.project}),f.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[$e.source==="user"?"User-added":"From existing runs",$e.added_at&&` · ${new Date($e.added_at).toLocaleDateString()}`]})]}),$e.source==="user"&&f.jsx(En,{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:()=>ct($e.project),disabled:O===$e.project,children:O===$e.project?f.jsx(gl,{className:"h-3 w-3"}):f.jsx(tde,{className:"h-3 w-3"})})]},$e.project)),(Fe==null?void 0:Fe.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(nd,{open:!!ee,onOpenChange:$e=>{$e||ie(null)},children:f.jsxs(rd,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[f.jsxs(iu,{children:[f.jsxs(su,{className:"flex items-center gap-2",children:[(ee==null?void 0:ee.color)&&f.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:ee.color}}),"Configuration —"," ",(ee==null?void 0:ee.name)??(ee==null?void 0:ee.run_id.split("/").pop())]}),f.jsx(Xg,{children:ee==null?void 0:ee.run_id})]}),f.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:ee!=null&&ee.config?f.jsx(xW,{config:ee.config}):f.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),f.jsx(O2,{open:!!H,onOpenChange:$e=>{$e||X(null)},children:f.jsxs(L2,{children:[f.jsxs(j2,{children:[f.jsx(F2,{children:"Remove run locally?"}),f.jsx(U2,{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(z2,{children:[f.jsx(H2,{children:"Cancel"}),f.jsx(B2,{onClick:()=>{H&&yt(H)},children:"Remove"})]})]})}),f.jsx(O2,{open:!!oe,onOpenChange:$e=>{$e||de(null)},children:f.jsxs(L2,{children:[f.jsxs(j2,{children:[f.jsx(mde,{className:"bg-destructive/10",children:f.jsx(rde,{className:"text-destructive"})}),f.jsx(F2,{children:"Force Full Resync"}),f.jsx(U2,{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(z2,{children:[f.jsx(H2,{children:"Cancel"}),f.jsx(B2,{variant:"destructive",onClick:()=>{oe&&Ie(oe)},children:"Yes, Delete & Resync"})]})]})}),f.jsx(tfe,{open:B,onOpenChange:Y})]})}function rfe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const tC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function jy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function a8(t){return"nodeType"in t}function jc(t){var e,n;return t?jy(t)?t:a8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function l8(t){const{Document:e}=jc(t);return t instanceof e}function kw(t){return jy(t)?!1:t instanceof jc(t).HTMLElement}function bW(t){return t instanceof jc(t).SVGElement}function zy(t){return t?jy(t)?t.document:a8(t)?l8(t)?t:kw(t)||bW(t)?t.ownerDocument:document:document:document}const dh=tC?w.useLayoutEffect:w.useEffect;function c8(t){const e=w.useRef(t);return dh(()=>{e.current=t}),w.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 ife(){const t=w.useRef(null),e=w.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=w.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function TS(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return dh(()=>{n.current!==t&&(n.current=t)},e),n}function Rw(t,e){const n=w.useRef();return w.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function W2(t){const e=c8(t),n=w.useRef(null),r=w.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function Nk(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let NA={};function Pw(t,e){return w.useMemo(()=>{if(e)return e;const n=NA[t]==null?0:NA[t]+1;return NA[t]=n,t+"-"+n},[t,e])}function _W(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 A1=_W(1),CS=_W(-1);function sfe(t){return"clientX"in t&&"clientY"in t}function u8(t){if(!t)return!1;const{KeyboardEvent:e}=jc(t.target);return e&&t instanceof e}function ofe(t){if(!t)return!1;const{TouchEvent:e}=jc(t.target);return e&&t instanceof e}function kk(t){if(ofe(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 sfe(t)?{x:t.clientX,y:t.clientY}:null}const iy=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[iy.Translate.toString(t),iy.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),OI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function afe(t){return t.matches(OI)?t:t.querySelector(OI)}const lfe={display:"none"};function cfe(t){let{id:e,value:n}=t;return ni.createElement("div",{id:e,style:lfe},n)}function ufe(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 ni.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function dfe(){const[t,e]=w.useState("");return{announce:w.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const SW=w.createContext(null);function ffe(t){const e=w.useContext(SW);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function hfe(){const[t]=w.useState(()=>new Set),e=w.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[w.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 pfe={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.
  `},mfe={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 gfe(t){let{announcements:e=mfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=pfe}=t;const{announce:s,announcement:o}=dfe(),a=Pw("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),ffe(w.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=ni.createElement(ni.Fragment,null,ni.createElement(cfe,{id:r,value:i.draggable}),ni.createElement(ufe,{id:a,announcement:o}));return n?$l.createPortal(d,n):d}var fa;(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"})(fa||(fa={}));function $2(){}function id(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function sy(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const of=Object.freeze({x:0,y:0});function wW(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function MW(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function xfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function LI(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 TW(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function jI(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 oy=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=jI(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=wW(jI(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(MW)},vfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=LI(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=LI(l),d=i.reduce((m,x,b)=>m+wW(c[b],x),0),p=Number((d/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:p}})}}return s.sort(MW)};function yfe(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 bfe=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=yfe(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(xfe)};function _fe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function CW(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:of}function Sfe(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 wfe=Sfe(1);function Mfe(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 Tfe(t,e,n){const r=Mfe(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 Cfe={ignoreTransform:!1};function Fy(t,e){e===void 0&&(e=Cfe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=jc(t).getComputedStyle(t);c&&(n=Tfe(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 zI(t){return Fy(t,{ignoreTransform:!0})}function Efe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Afe(t,e){return e===void 0&&(e=jc(t).getComputedStyle(t)),e.position==="fixed"}function Nfe(t,e){e===void 0&&(e=jc(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 nC(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(l8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!kw(i)||bW(i)||n.includes(i))return n;const s=jc(t).getComputedStyle(i);return i!==t&&Nfe(i,s)&&n.push(i),Afe(i,s)?n:r(i.parentNode)}return t?r(t):n}function EW(t){const[e]=nC(t,1);return e??null}function kA(t){return!tC||!t?null:jy(t)?t:a8(t)?l8(t)||t===zy(t).scrollingElement?window:kw(t)?t:null:null}function AW(t){return jy(t)?t.scrollX:t.scrollLeft}function NW(t){return jy(t)?t.scrollY:t.scrollTop}function Rk(t){return{x:AW(t),y:NW(t)}}var Ea;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ea||(Ea={}));function kW(t){return!tC||!t?!1:t===document.scrollingElement}function RW(t){const e={x:0,y:0},n=kW(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 kfe={x:.2,y:.2};function Rfe(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=kfe);const{isTop:c,isBottom:d,isLeft:p,isRight:m}=RW(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=Ea.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!d&&l>=e.bottom-_.height&&(x.y=Ea.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!m&&a>=e.right-_.width?(x.x=Ea.Forward,b.x=r*Math.abs((e.right-_.width-a)/_.width)):!p&&o<=e.left+_.width&&(x.x=Ea.Backward,b.x=r*Math.abs((e.left+_.width-o)/_.width)),{direction:x,speed:b}}function Pfe(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 PW(t){return t.reduce((e,n)=>A1(e,Rk(n)),of)}function Dfe(t){return t.reduce((e,n)=>e+AW(n),0)}function Ife(t){return t.reduce((e,n)=>e+NW(n),0)}function Ofe(t,e){if(e===void 0&&(e=Fy),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);EW(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Lfe=[["x",["left","right"],Dfe],["y",["top","bottom"],Ife]];class d8{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=nC(n),i=PW(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of Lfe)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 G_{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 jfe(t){const{EventTarget:e}=jc(t);return t instanceof e?t:zy(t)}function RA(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 Qu;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Qu||(Qu={}));function FI(t){t.preventDefault()}function zfe(t){t.stopPropagation()}var fi;(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"})(fi||(fi={}));const DW={start:[fi.Space,fi.Enter],cancel:[fi.Esc],end:[fi.Space,fi.Enter,fi.Tab]},Ffe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case fi.Right:return{...n,x:n.x+25};case fi.Left:return{...n,x:n.x-25};case fi.Down:return{...n,y:n.y+25};case fi.Up:return{...n,y:n.y-25}}};class lm{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 G_(zy(n)),this.windowListeners=new G_(jc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qu.Resize,this.handleCancel),this.windowListeners.add(Qu.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qu.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Ofe(r),n(of)}handleKeyDown(e){if(u8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=DW,coordinateGetter:o=Ffe,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}:of;this.referenceCoordinates||(this.referenceCoordinates=d);const p=o(e,{active:n,context:r.current,currentCoordinates:d});if(p){const m=CS(p,d),x={x:0,y:0},{scrollableAncestors:b}=r.current;for(const _ of b){const S=e.code,{isTop:M,isRight:C,isLeft:A,isBottom:N,maxScroll:D,minScroll:R}=RW(_),L=Pfe(_),k={x:Math.min(S===fi.Right?L.right-L.width/2:L.right,Math.max(S===fi.Right?L.left:L.left+L.width/2,p.x)),y:Math.min(S===fi.Down?L.bottom-L.height/2:L.bottom,Math.max(S===fi.Down?L.top:L.top+L.height/2,p.y))},O=S===fi.Right&&!C||S===fi.Left&&!A,F=S===fi.Down&&!N||S===fi.Up&&!M;if(O&&k.x!==p.x){const B=_.scrollLeft+m.x,Y=S===fi.Right&&B<=D.x||S===fi.Left&&B>=R.x;if(Y&&!m.y){_.scrollTo({left:B,behavior:a});return}Y?x.x=_.scrollLeft-B:x.x=S===fi.Right?_.scrollLeft-D.x:_.scrollLeft-R.x,x.x&&_.scrollBy({left:-x.x,behavior:a});break}else if(F&&k.y!==p.y){const B=_.scrollTop+m.y,Y=S===fi.Down&&B<=D.y||S===fi.Up&&B>=R.y;if(Y&&!m.x){_.scrollTo({top:B,behavior:a});return}Y?x.y=_.scrollTop-B:x.y=S===fi.Down?_.scrollTop-D.y:_.scrollTop-R.y,x.y&&_.scrollBy({top:-x.y,behavior:a});break}}this.handleMove(e,A1(CS(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()}}lm.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=DW,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 UI(t){return!!(t&&"distance"in t)}function BI(t){return!!(t&&"delay"in t)}class f8{constructor(e,n,r){var i;r===void 0&&(r=jfe(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=zy(o),this.documentListeners=new G_(this.document),this.listeners=new G_(r),this.windowListeners=new G_(jc(o)),this.initialCoordinates=(i=kk(s))!=null?i:of,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(Qu.Resize,this.handleCancel),this.windowListeners.add(Qu.DragStart,FI),this.windowListeners.add(Qu.VisibilityChange,this.handleCancel),this.windowListeners.add(Qu.ContextMenu,FI),this.documentListeners.add(Qu.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(BI(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(UI(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(Qu.Click,zfe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qu.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=kk(e))!=null?n:of,c=CS(i,l);if(!r&&a){if(UI(a)){if(a.tolerance!=null&&RA(c,a.tolerance))return this.handleCancel();if(RA(c,a.distance))return this.handleStart()}if(BI(a)&&RA(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===fi.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Ufe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cm extends f8{constructor(e){const{event:n}=e,r=zy(n.target);super(e,Ufe,r)}}cm.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 Bfe={move:{name:"mousemove"},end:{name:"mouseup"}};var Pk;(function(t){t[t.RightClick=2]="RightClick"})(Pk||(Pk={}));class Hfe extends f8{constructor(e){super(e,Bfe,zy(e.event.target))}}Hfe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Pk.RightClick?!1:(r==null||r({event:n}),!0)}}];const PA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vfe extends f8{constructor(e){super(e,PA)}static setup(){return window.addEventListener(PA.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(PA.move.name,e)};function e(){}}}Vfe.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 W_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(W_||(W_={}));var q2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(q2||(q2={}));function Gfe(t){let{acceleration:e,activator:n=W_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=q2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:p,threshold:m}=t;const x=$fe({delta:p,disabled:!s}),[b,_]=ife(),S=w.useRef({x:0,y:0}),M=w.useRef({x:0,y:0}),C=w.useMemo(()=>{switch(n){case W_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case W_.DraggableRect:return i}},[n,i,l]),A=w.useRef(null),N=w.useCallback(()=>{const R=A.current;if(!R)return;const L=S.current.x*M.current.x,k=S.current.y*M.current.y;R.scrollBy(L,k)},[]),D=w.useMemo(()=>a===q2.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!s||!c.length||!C){_();return}for(const R of D){if((r==null?void 0:r(R))===!1)continue;const L=c.indexOf(R),k=d[L];if(!k)continue;const{direction:O,speed:F}=Rfe(R,k,C,e,m);for(const B of["x","y"])x[B][O[B]]||(F[B]=0,O[B]=0);if(F.x>0||F.y>0){_(),A.current=R,b(N,o),S.current=F,M.current=O;return}}S.current={x:0,y:0},M.current={x:0,y:0},_()},[e,N,r,_,s,o,JSON.stringify(C),JSON.stringify(x),b,c,D,d,JSON.stringify(m)])}const Wfe={x:{[Ea.Backward]:!1,[Ea.Forward]:!1},y:{[Ea.Backward]:!1,[Ea.Forward]:!1}};function $fe(t){let{delta:e,disabled:n}=t;const r=Nk(e);return Rw(i=>{if(n||!r||!i)return Wfe;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ea.Backward]:i.x[Ea.Backward]||s.x===-1,[Ea.Forward]:i.x[Ea.Forward]||s.x===1},y:{[Ea.Backward]:i.y[Ea.Backward]||s.y===-1,[Ea.Forward]:i.y[Ea.Forward]||s.y===1}}},[n,e,r])}function qfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Rw(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function Xfe(t,e){return w.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 ES;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ES||(ES={}));var Dk;(function(t){t.Optimized="optimized"})(Dk||(Dk={}));const HI=new Map;function Yfe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=i,d=w.useRef(t),p=S(),m=TS(p),x=w.useCallback(function(M){M===void 0&&(M=[]),!m.current&&o(C=>C===null?M:C.concat(M.filter(A=>!C.includes(A))))},[m]),b=w.useRef(null),_=Rw(M=>{if(p&&!n)return HI;if(!M||M===HI||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 d8(l(N),N):null;A.rect.current=D,D&&C.set(A.id,D)}return C}return M},[t,s,n,p,l]);return w.useEffect(()=>{d.current=t},[t]),w.useEffect(()=>{p||x()},[n,p]),w.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),w.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 ES.Always:return!1;case ES.BeforeDragging:return n;default:return!n}}}function IW(t,e){return Rw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Kfe(t,e){return IW(t,e)}function Zfe(t){let{callback:e,disabled:n}=t;const r=c8(e),i=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return w.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function rC(t){let{callback:e,disabled:n}=t;const r=c8(e),i=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return w.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Qfe(t){return new d8(Fy(t),t)}function VI(t,e,n){e===void 0&&(e=Qfe);const[r,i]=w.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=Zfe({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=rC({callback:s});return dh(()=>{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 Jfe(t){const e=IW(t);return CW(t,e)}const GI=[];function ehe(t){const e=w.useRef(t),n=Rw(r=>t?r&&r!==GI&&t&&e.current&&t.parentNode===e.current.parentNode?r:nC(t):GI,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function the(t){const[e,n]=w.useState(null),r=w.useRef(t),i=w.useCallback(s=>{const o=kA(s.target);o&&n(a=>a?(a.set(o,Rk(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=kA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Rk(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=kA(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>A1(s,o),of):PW(t):of,[t,e])}function WI(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const r=t!==of;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?CS(t,n.current):of}function nhe(t){w.useEffect(()=>{if(!tC)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 rhe(t,e){return w.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function OW(t){return w.useMemo(()=>t?Efe(t):null,[t])}const $I=[];function ihe(t,e){e===void 0&&(e=Fy);const[n]=t,r=OW(n?jc(n):null),[i,s]=w.useState($I);function o(){s(()=>t.length?t.map(l=>kW(l)?r:new d8(e(l),l)):$I)}const a=rC({callback:o});return dh(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),i}function she(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return kw(e)?e:t}function ohe(t){let{measure:e}=t;const[n,r]=w.useState(null),i=w.useCallback(c=>{for(const{target:d}of c)if(kw(d)){r(p=>{const m=e(d);return p?{...p,width:m.width,height:m.height}:m});break}},[e]),s=rC({callback:i}),o=w.useCallback(c=>{const d=she(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?e(d):null)},[e,s]),[a,l]=W2(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const ahe=[{sensor:cm,options:{}},{sensor:lm,options:{}}],lhe={current:{}},i2={draggable:{measure:zI},droppable:{measure:zI,strategy:ES.WhileDragging,frequency:Dk.Optimized},dragOverlay:{measure:Fy}};class $_ 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 che={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new $_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:i2,measureDroppableContainers:$2,windowRect:null,measuringScheduled:!1},uhe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$2,draggableNodes:new Map,over:null,measureDroppableContainers:$2},iC=w.createContext(uhe),LW=w.createContext(che);function dhe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new $_}}}function fhe(t,e){switch(e.type){case fa.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case fa.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 fa.DragEnd:case fa.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fa.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new $_(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case fa.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 $_(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case fa.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new $_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function hhe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=w.useContext(iC),s=Nk(r),o=Nk(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!u8(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=afe(d);if(p){p.focus();break}}})}},[r,e,i,o,s]),null}function phe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function mhe(t){return w.useMemo(()=>({draggable:{...i2.draggable,...t==null?void 0:t.draggable},droppable:{...i2.droppable,...t==null?void 0:t.droppable},dragOverlay:{...i2.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 ghe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=w.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;dh(()=>{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=CW(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=EW(c);m&&m.scrollBy({top:p.y,left:p.x})}},[e,o,a,r,n])}const jW=w.createContext({...of,scaleX:1,scaleY:1});var O0;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(O0||(O0={}));const ay=w.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=ahe,collisionDetection:p=bfe,measuring:m,modifiers:x,...b}=e;const _=w.useReducer(fhe,void 0,dhe),[S,M]=_,[C,A]=hfe(),[N,D]=w.useState(O0.Uninitialized),R=N===O0.Initialized,{draggable:{active:L,nodes:k,translate:O},droppable:{containers:F}}=S,B=L!=null?k.get(L):null,Y=w.useRef({initial:null,translated:null}),V=w.useMemo(()=>{var yt;return L!=null?{id:L,data:(yt=B==null?void 0:B.data)!=null?yt:lhe,rect:Y}:null},[L,B]),q=w.useRef(null),[G,$]=w.useState(null),[Q,K]=w.useState(null),re=TS(b,Object.values(b)),U=Pw("DndDescribedBy",o),H=w.useMemo(()=>F.getEnabled(),[F]),X=mhe(m),{droppableRects:j,measureDroppableContainers:le,measuringScheduled:se}=Yfe(H,{dragging:R,dependencies:[O.x,O.y],config:X.droppable}),J=qfe(k,L),ee=w.useMemo(()=>Q?kk(Q):null,[Q]),ie=ct(),oe=Kfe(J,X.draggable.measure);ghe({activeNode:L!=null?k.get(L):null,config:ie.layoutShiftCompensation,initialRect:oe,measure:X.draggable.measure});const de=VI(J,X.draggable.measure,oe),ye=VI(J?J.parentElement:null),ge=w.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Me=F.getNodeFor((n=ge.current.over)==null?void 0:n.id),fe=ohe({measure:X.dragOverlay.measure}),Se=(r=fe.nodeRef.current)!=null?r:J,me=R?(i=fe.rect)!=null?i:de:null,Pe=!!(fe.nodeRef.current&&fe.rect),ce=Jfe(Pe?null:de),He=OW(Se?jc(Se):null),Be=ehe(R?Me??J:null),Ge=ihe(Be),We=phe(x,{transform:{x:O.x-ce.x,y:O.y-ce.y,scaleX:1,scaleY:1},activatorEvent:Q,active:V,activeNodeRect:de,containerNodeRect:ye,draggingNodeRect:me,over:ge.current.over,overlayNodeRect:fe.rect,scrollableAncestors:Be,scrollableAncestorRects:Ge,windowRect:He}),ae=ee?A1(ee,O):null,Z=the(Be),he=WI(Z),be=WI(Z,[de]),we=A1(We,he),ve=me?wfe(me,We):null,Re=V&&ve?p({active:V,collisionRect:ve,droppableRects:j,droppableContainers:H,pointerCoordinates:ae}):null,Ae=TW(Re,"id"),[Oe,qe]=w.useState(null),Fe=Pe?We:A1(We,be),Ke=_fe(Fe,(s=Oe==null?void 0:Oe.rect)!=null?s:null,de),je=w.useRef(null),Te=w.useCallback((yt,lt)=>{let{sensor:Je,options:Ee}=lt;if(q.current==null)return;const Ze=k.get(q.current);if(!Ze)return;const Ie=yt.nativeEvent,Ue=new Je({active:q.current,activeNode:Ze,event:Ie,options:Ee,context:ge,onAbort(ut){if(!k.get(ut))return;const{onDragAbort:Rt}=re.current,St={id:ut};Rt==null||Rt(St),C({type:"onDragAbort",event:St})},onPending(ut,Dt,Rt,St){if(!k.get(ut))return;const{onDragPending:en}=re.current,Ut={id:ut,constraint:Dt,initialCoordinates:Rt,offset:St};en==null||en(Ut),C({type:"onDragPending",event:Ut})},onStart(ut){const Dt=q.current;if(Dt==null)return;const Rt=k.get(Dt);if(!Rt)return;const{onDragStart:St}=re.current,Ht={activatorEvent:Ie,active:{id:Dt,data:Rt.data,rect:Y}};$l.unstable_batchedUpdates(()=>{St==null||St(Ht),D(O0.Initializing),M({type:fa.DragStart,initialCoordinates:ut,active:Dt}),C({type:"onDragStart",event:Ht}),$(je.current),K(Ie)})},onMove(ut){M({type:fa.DragMove,coordinates:ut})},onEnd:rt(fa.DragEnd),onCancel:rt(fa.DragCancel)});je.current=Ue;function rt(ut){return async function(){const{active:Rt,collisions:St,over:Ht,scrollAdjustedTranslate:en}=ge.current;let Ut=null;if(Rt&&en){const{cancelDrop:$e}=re.current;Ut={activatorEvent:Ie,active:Rt,collisions:St,delta:en,over:Ht},ut===fa.DragEnd&&typeof $e=="function"&&await Promise.resolve($e(Ut))&&(ut=fa.DragCancel)}q.current=null,$l.unstable_batchedUpdates(()=>{M({type:ut}),D(O0.Uninitialized),qe(null),$(null),K(null),je.current=null;const $e=ut===fa.DragEnd?"onDragEnd":"onDragCancel";if(Ut){const dt=re.current[$e];dt==null||dt(Ut),C({type:$e,event:Ut})}})}}},[k]),Xe=w.useCallback((yt,lt)=>(Je,Ee)=>{const Ze=Je.nativeEvent,Ie=k.get(Ee);if(q.current!==null||!Ie||Ze.dndKit||Ze.defaultPrevented)return;const Ue={active:Ie};yt(Je,lt.options,Ue)===!0&&(Ze.dndKit={capturedBy:lt.sensor},q.current=Ee,Te(Je,lt))},[k,Te]),ht=Xfe(d,Xe);nhe(d),dh(()=>{de&&N===O0.Initializing&&D(O0.Initialized)},[de,N]),w.useEffect(()=>{const{onDragMove:yt}=re.current,{active:lt,activatorEvent:Je,collisions:Ee,over:Ze}=ge.current;if(!lt||!Je)return;const Ie={active:lt,activatorEvent:Je,collisions:Ee,delta:{x:we.x,y:we.y},over:Ze};$l.unstable_batchedUpdates(()=>{yt==null||yt(Ie),C({type:"onDragMove",event:Ie})})},[we.x,we.y]),w.useEffect(()=>{const{active:yt,activatorEvent:lt,collisions:Je,droppableContainers:Ee,scrollAdjustedTranslate:Ze}=ge.current;if(!yt||q.current==null||!lt||!Ze)return;const{onDragOver:Ie}=re.current,Ue=Ee.get(Ae),rt=Ue&&Ue.rect.current?{id:Ue.id,rect:Ue.rect.current,data:Ue.data,disabled:Ue.disabled}:null,ut={active:yt,activatorEvent:lt,collisions:Je,delta:{x:Ze.x,y:Ze.y},over:rt};$l.unstable_batchedUpdates(()=>{qe(rt),Ie==null||Ie(ut),C({type:"onDragOver",event:ut})})},[Ae]),dh(()=>{ge.current={activatorEvent:Q,active:V,activeNode:J,collisionRect:ve,collisions:Re,droppableRects:j,draggableNodes:k,draggingNode:Se,draggingNodeRect:me,droppableContainers:F,over:Oe,scrollableAncestors:Be,scrollAdjustedTranslate:we},Y.current={initial:me,translated:ve}},[V,J,Re,ve,k,Se,me,j,F,Oe,Be,we]),Gfe({...ie,delta:O,draggingRect:ve,pointerCoordinates:ae,scrollableAncestors:Be,scrollableAncestorRects:Ge});const ke=w.useMemo(()=>({active:V,activeNode:J,activeNodeRect:de,activatorEvent:Q,collisions:Re,containerNodeRect:ye,dragOverlay:fe,draggableNodes:k,droppableContainers:F,droppableRects:j,over:Oe,measureDroppableContainers:le,scrollableAncestors:Be,scrollableAncestorRects:Ge,measuringConfiguration:X,measuringScheduled:se,windowRect:He}),[V,J,de,Q,Re,ye,fe,k,F,j,Oe,le,Be,Ge,X,se,He]),et=w.useMemo(()=>({activatorEvent:Q,activators:ht,active:V,activeNodeRect:de,ariaDescribedById:{draggable:U},dispatch:M,draggableNodes:k,over:Oe,measureDroppableContainers:le}),[Q,ht,V,de,M,U,k,Oe,le]);return ni.createElement(SW.Provider,{value:A},ni.createElement(iC.Provider,{value:et},ni.createElement(LW.Provider,{value:ke},ni.createElement(jW.Provider,{value:Ke},c)),ni.createElement(hhe,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ni.createElement(gfe,{...a,hiddenTextDescribedById:U}));function ct(){const yt=(G==null?void 0:G.autoScrollEnabled)===!1,lt=typeof l=="object"?l.enabled===!1:l===!1,Je=R&&!yt&&!lt;return typeof l=="object"?{...l,enabled:Je}:{enabled:Je}}}),xhe=w.createContext(null),qI="button",vhe="Draggable";function yhe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=Pw(vhe),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:p,over:m}=w.useContext(iC),{role:x=qI,roleDescription:b="draggable",tabIndex:_=0}=i??{},S=(l==null?void 0:l.id)===e,M=w.useContext(S?jW:xhe),[C,A]=W2(),[N,D]=W2(),R=rhe(o,e),L=TS(n);dh(()=>(p.set(e,{id:e,key:s,node:C,activatorNode:N,data:L}),()=>{const O=p.get(e);O&&O.key===s&&p.delete(e)}),[p,e]);const k=w.useMemo(()=>({role:x,tabIndex:_,"aria-disabled":r,"aria-pressed":S&&x===qI?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[r,x,_,S,b,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:k,isDragging:S,listeners:r?void 0:R,node:C,over:m,setNodeRef:A,setActivatorNodeRef:D,transform:M}}function bhe(){return w.useContext(LW)}const _he="Droppable",She={timeout:25};function whe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=Pw(_he),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(iC),d=w.useRef({disabled:n}),p=w.useRef(!1),m=w.useRef(null),x=w.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:S}={...She,...i},M=TS(_??r),C=w.useCallback(()=>{if(!p.current){p.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(M.current)?M.current:[M.current]),x.current=null},S)},[S]),A=rC({callback:C,disabled:b||!o}),N=w.useCallback((k,O)=>{A&&(O&&(A.unobserve(O),p.current=!1),k&&A.observe(k))},[A]),[D,R]=W2(N),L=TS(e);return w.useEffect(()=>{!A||!D.current||(A.disconnect(),p.current=!1,A.observe(D.current))},[D,A]),w.useEffect(()=>(a({type:fa.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:m,data:L}}),()=>a({type:fa.UnregisterDroppable,key:s,id:r})),[r]),w.useEffect(()=>{n!==d.current.disabled&&(a({type:fa.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:R}}function um(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Mhe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function w4(t){return t!==null&&t>=0}function The(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 Che(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Dw=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=um(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}},M4={scaleX:1,scaleY:1},h8=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,...M4}:null}const l=Ehe(s,i,n);return i>n&&i<=o?{x:0,y:-a.height-l,...M4}:i<n&&i>=o?{x:0,y:a.height+l,...M4}:{x:0,y:0,...M4}};function Ehe(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 zW="Sortable",FW=ni.createContext({activeIndex:-1,containerId:zW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dw,disabled:{draggable:!1,droppable:!1}});function ly(t){let{children:e,id:n,items:r,strategy:i=Dw,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=bhe(),p=Pw(zW,n),m=a.rect!==null,x=w.useMemo(()=>r.map(R=>typeof R=="object"&&"id"in R?R.id:R),[r]),b=o!=null,_=o?x.indexOf(o.id):-1,S=c?x.indexOf(c.id):-1,M=w.useRef(x),C=!The(x,M.current),A=S!==-1&&_===-1||C,N=Che(s);dh(()=>{C&&b&&d(x)},[C,x,b,d]),w.useEffect(()=>{M.current=x},[x]);const D=w.useMemo(()=>({activeIndex:_,containerId:p,disabled:N,disableTransforms:A,items:x,overIndex:S,useDragOverlay:m,sortedRects:Mhe(x,l),strategy:i}),[_,p,N.draggable,N.droppable,A,x,S,l,m,i]);return ni.createElement(FW.Provider,{value:D},e)}const Ahe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return um(n,r,i).indexOf(e)},Nhe=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},khe={duration:200,easing:"ease"},UW="transform",Rhe=iy.Transition.toString({property:UW,duration:0,easing:"linear"}),Phe={roleDescription:"sortable"};function Dhe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=w.useState(null),a=w.useRef(n);return dh(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=Fy(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]),w.useEffect(()=>{s&&o(null)},[s]),s}function sC(t){let{animateLayoutChanges:e=Nhe,attributes:n,disabled:r,data:i,getNewIndex:s=Ahe,id:o,strategy:a,resizeObserverConfig:l,transition:c=khe}=t;const{items:d,containerId:p,activeIndex:m,disabled:x,disableTransforms:b,sortedRects:_,overIndex:S,useDragOverlay:M,strategy:C}=w.useContext(FW),A=Ihe(r,x),N=d.indexOf(o),D=w.useMemo(()=>({sortable:{containerId:p,index:N,items:d},...i}),[p,i,N,d]),R=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:L,node:k,isOver:O,setNodeRef:F}=whe({id:o,data:D,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...l}}),{active:B,activatorEvent:Y,activeNodeRect:V,attributes:q,setNodeRef:G,listeners:$,isDragging:Q,over:K,setActivatorNodeRef:re,transform:U}=yhe({id:o,data:D,attributes:{...Phe,...n},disabled:A.draggable}),H=rfe(F,G),X=!!B,j=X&&!b&&w4(m)&&w4(S),le=!M&&Q,se=le&&j?U:null,ee=j?se??(a??C)({rects:_,activeNodeRect:V,activeIndex:m,overIndex:S,index:N}):null,ie=w4(m)&&w4(S)?s({id:o,items:d,activeIndex:m,overIndex:S}):N,oe=B==null?void 0:B.id,de=w.useRef({activeId:oe,items:d,newIndex:ie,containerId:p}),ye=d!==de.current.items,ge=e({active:B,containerId:p,isDragging:Q,isSorting:X,id:o,index:N,items:d,newIndex:de.current.newIndex,previousItems:de.current.items,previousContainerId:de.current.containerId,transition:c,wasDragging:de.current.activeId!=null}),Me=Dhe({disabled:!ge,index:N,node:k,rect:L});return w.useEffect(()=>{X&&de.current.newIndex!==ie&&(de.current.newIndex=ie),p!==de.current.containerId&&(de.current.containerId=p),d!==de.current.items&&(de.current.items=d)},[X,ie,p,d]),w.useEffect(()=>{if(oe===de.current.activeId)return;if(oe!=null&&de.current.activeId==null){de.current.activeId=oe;return}const Se=setTimeout(()=>{de.current.activeId=oe},50);return()=>clearTimeout(Se)},[oe]),{active:B,activeIndex:m,attributes:q,data:D,rect:L,index:N,newIndex:ie,items:d,isOver:O,isSorting:X,isDragging:Q,listeners:$,node:k,overIndex:S,over:K,setNodeRef:H,setActivatorNodeRef:re,setDroppableNodeRef:F,setDraggableNodeRef:G,transform:Me??ee,transition:fe()};function fe(){if(Me||ye&&de.current.newIndex===N)return Rhe;if(!(le&&!u8(Y)||!c)&&(X||ge))return iy.Transition.toString({...c,property:UW})}}function Ihe(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 X2(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 Ohe=[fi.Down,fi.Right,fi.Up,fi.Left],cy=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(Ohe.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 fi.Down:r.top<m.top&&l.push(p);break;case fi.Up:r.top>m.top&&l.push(p);break;case fi.Left:r.left>m.left&&l.push(p);break;case fi.Right:r.left<m.left&&l.push(p);break}});const c=vfe({collisionRect:r,droppableRects:i,droppableContainers:l});let d=TW(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=nC(b).some((R,L)=>a[L]!==R),M=BW(p,m),C=Lhe(p,m),A=S||!M?{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:CS(N,A)}}}};function BW(t,e){return!X2(t)||!X2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Lhe(t,e){return!X2(t)||!X2(e)||!BW(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function ld({className:t,size:e="default",...n}){return f.jsx("div",{"data-slot":"card","data-size":e,className:bt("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 XI({className:t,...e}){return f.jsx("div",{"data-slot":"card-header",className:bt("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 T4({className:t,...e}){return f.jsx("div",{"data-slot":"card-title",className:bt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function C4({className:t,...e}){return f.jsx("div",{"data-slot":"card-description",className:bt("text-muted-foreground text-sm",t),...e})}function lh({className:t,...e}){return f.jsx("div",{"data-slot":"card-content",className:bt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function op({className:t,...e}){return f.jsx("div",{"data-slot":"skeleton",className:bt("bg-muted rounded-md animate-pulse",t),...e})}const HW=t8("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 N1({className:t,variant:e="default",size:n="default",...r}){return f.jsx(Lae,{"data-slot":"toggle",className:bt(HW({variant:e,size:n,className:t})),...r})}const VW=w.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function dm({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...o}){return f.jsx(Bae,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:bt("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(VW.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Xa({className:t,children:e,variant:n="default",size:r="default",...i}){const s=w.useContext(VW);return f.jsx(Hae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:bt("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",HW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function AS({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=M=>{M.key==="Enter"&&(e||n(!0),s(r),M.currentTarget.blur())},_=()=>{s(r)},S=p==="selecting";return f.jsxs("div",{className:bt("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(N1,{variant:p,size:m,pressed:e,onPressedChange:n,className:bt("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:M=>i(M.target.value),onKeyDown:b,onBlur:_,className:bt("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 jhe=t8("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 uy({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?JU:"span";return f.jsx(i,{"data-slot":"badge","data-variant":e,className:bt(jhe({variant:e}),t),...r})}const GW="...";function zhe(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-GW.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 x1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const o=w.useRef(null),a=w.useRef(null),[l,c]=w.useState({prefix:t,suffix:"",isTruncated:!1}),d=w.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),M=Math.max(1,Math.floor(b/S)),C=zhe(t,M);c(A=>A.prefix===C.prefix&&A.suffix===C.suffix&&A.isTruncated===C.isTruncated?A:C)},[t]);w.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:bt("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:bt("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:GW}),f.jsx("span",{className:"shrink-0",children:l.suffix})]}):f.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?f.jsxs(Nx,{delayDuration:s,children:[f.jsx(kx,{asChild:!0,children:p}),f.jsx(Rx,{side:"top",className:bt("max-w-xs break-all text-[11px]",n),children:t})]}):p}function Ik(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 WW(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 YI(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"?Ik(t):String(t)}function KI(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function p8(t,e){return t===e?!0:t==null?e==null:e==null?!1:typeof t=="object"||typeof e=="object"?Ik(t)===Ik(e):String(t)===String(e)}function Fhe(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=WW(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:KI(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:KI(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 ZI(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=WW(r);i!==null&&e.set(n,i)}return e}function m8(t,e,n){return t.subcategories?t.subcategories.some(r=>m8(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!p8(i,s)})}function Uhe({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:bt("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(x1,{text:s,className:"text-sm font-medium"})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&f.jsx(uy,{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:ry(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 QI({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=f.jsx("span",{className:bt("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(Nx,{children:[f.jsx(kx,{asChild:!0,children:i}),f.jsx(Rx,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Bhe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=YI(e),s=YI(n),o=!p8(e,n);return r&&!o?null:f.jsxs("div",{className:bt("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(Nx,{children:[f.jsx(kx,{asChild:!0,children:f.jsx("span",{className:bt("text-sm truncate min-w-0",o?"text-foreground":"text-muted-foreground"),children:t})}),f.jsx(Rx,{side:"left",className:"text-xs",children:t})]}),f.jsx("div",{className:"min-w-0 overflow-hidden",children:f.jsx(QI,{value:e,formatted:i,isDifferent:o})}),f.jsx("div",{className:"min-w-0 overflow-hidden",children:f.jsx(QI,{value:n,formatted:s,isDifferent:o})})]})}const Hhe="ml-[22px]",Vhe="ml-[38px]";function $W({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const o=m8(t,e,n),[a,l]=w.useState(s??o);if(r&&!o)return null;const c=t.subcategories&&t.subcategories.length>0;return f.jsxs(Pi,{open:a,onOpenChange:l,children:[f.jsx(Di,{asChild:!0,children:f.jsx("div",{className:bt("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(kr,{className:bt("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(Ii,{children:c?f.jsx("div",{className:"mt-1",children:t.subcategories.map(d=>f.jsx($W,{category:d,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},d.key))}):f.jsx("div",{className:bt("mt-1",i?Vhe:Hhe),children:t.items.map(d=>f.jsx(Bhe,{displayKey:d.displayKey,value1:e.get(d.key),value2:n.get(d.key),showOnlyDifferences:r},d.key))})})]})}function Ghe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:o,run2Color:a}){const[l,c]=w.useState(!0),d=w.useMemo(()=>ZI(t),[t]),p=w.useMemo(()=>ZI(e),[e]),m=w.useMemo(()=>{const _={...t};for(const[S,M]of Object.entries(e))S in _||(_[S]=M);return _},[t,e]),x=w.useMemo(()=>Fhe(m),[m]),b=w.useMemo(()=>{let _=0;for(const[S,M]of d){const C=p.get(S);p8(M,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(uy,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),f.jsxs(dm,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[f.jsx(Xa,{value:"everything",className:"text-xs px-3",children:"Everything"}),f.jsx(Xa,{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(x1,{text:n,className:"text-sm font-medium min-w-0"})]}),f.jsx("div",{className:"ml-4",children:f.jsx(x1,{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(x1,{text:r,className:"text-sm font-medium min-w-0"})]}),f.jsx("div",{className:"ml-4",children:f.jsx(x1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),f.jsx(Px,{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"&&m8(C,d,p)).length===0),f.jsx($W,{category:_,config1Map:d,config2Map:p,showOnlyDifferences:l,defaultOpen:S},_.key)})})})]})}function Whe({currentRunId:t,currentConfig:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(null),{data:o,isLoading:a}=km(),l=(o==null?void 0:o.runs)||[],{data:c,isLoading:d}=gd(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)},M=()=>{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(nd,{open:n,onOpenChange:N=>{N?r(!0):M()},children:[f.jsx(qT,{asChild:!0,children:f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),f.jsx(rd,{className:"sm:max-w-4xl max-h-[95vh]",children:i?f.jsxs(f.Fragment,{children:[f.jsx(iu,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(En,{variant:"ghost",size:"sm",onClick:S,className:"h-7 px-2",children:"← Back"}),f.jsx("div",{children:f.jsx(su,{children:"Configuration Comparison"})})]})}),d?f.jsxs("div",{className:"flex items-center justify-center py-16",children:[f.jsx(gl,{className:"h-6 w-6"}),f.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?f.jsx(Ghe,{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(iu,{children:[f.jsx(su,{children:"Compare Configuration"}),f.jsxs(Xg,{children:["Select another run to compare its configuration with"," ",f.jsx("span",{className:"font-sans text-foreground",children:C})]})]}),f.jsx(Px,{className:"h-[500px] pr-4",children:a?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(gl,{className:"h-5 w-5"})}):f.jsx(Uhe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class $he{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 M=()=>{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 R=!1;if(D){const k=D.oldPos-C;R=D&&0<=k&&k<a}const L=N&&N.oldPos+1<l;if(!R&&!L){x[C]=void 0;continue}if(!L||R&&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);M()||C()},0)})();else for(;c<=d&&Date.now()<=m;){const C=M();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 qhe extends $he{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Xhe=new qhe;function Yhe(t,e,n){return Xhe.diff(t,e,n)}function Khe({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:bt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":bt("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(x1,{text:a,className:"text-sm font-medium"})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&f.jsx(uy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&o&&f.jsx(uy,{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:ry(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 JI({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=w.useState(!1),{data:o,isLoading:a}=km(),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(nd,{open:i,onOpenChange:x=>{s(x)},children:[f.jsx(qT,{asChild:!0,children:f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),f.jsxs(rd,{className:"sm:max-w-4xl max-h-[90vh]",children:[f.jsxs(iu,{children:[f.jsx(su,{children:"Select Run To Compare"}),f.jsxs(Xg,{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(En,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),f.jsx(Px,{className:"h-[480px] pr-4",children:a?f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx(gl,{className:"h-5 w-5"})}):f.jsx(Khe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:x=>{n(x),s(!1)}})})]})]})}const Zhe={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"]},Qhe=new Set(["python","bash","yaml","toml"]),Jhe=new Set(["sql"]);function epe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tpe(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 npe(t){return Qhe.has(t)?"#.*$":Jhe.has(t)?"--.*$":t==="json"?null:"//.*$"}function L0(t,e){if(t.length===0)return[{text:" "}];const n=Zhe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=npe(e),o=n.length>0?`\\b(?:${n.map(m=>epe(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 rpe(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 DA(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>L0(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(...L0(b,e)),i.push(_);continue}const o=rpe(s);if(!o){i.push(L0(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(...L0(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(...L0(l,e)),c.push({text:d,className:"text-muted-foreground"}),p.length>0&&c.push(...L0(p,e)),i.push(c)}return i}function eO(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 ipe(t,e){const n=eO(t),r=eO(e),i=Yhe(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 qW(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)?qW(e.children):void 0}})}function XW(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=XW((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 spe(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 IA(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function ope(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 YW(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=YW(n.children);if(r)return r}}return null}function Ok(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)&&Ok(r.children,e))return!0;return!1}function KW(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)&&KW(r.children,e))return!0;return!1}function tO(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function ape({runPath:t,onBack:e}){const[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState(null),[d,p]=w.useState(0),[m,x]=w.useState(null),b=w.useRef({}),_=w.useRef({}),S=w.useRef(!1),M=w.useRef(null),C=w.useRef(null),{data:A}=km(),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,R=(A==null?void 0:A.runs.find(Ct=>Ct.run_id===o))??null,L=(R==null?void 0:R.name)||(o==null?void 0:o.split("/").pop())||o,{data:k,isLoading:O,error:F}=RI(t,!!t),{data:B,isLoading:Y,error:V}=RI(o||"",!!o),{data:q,isFetching:G}=wde(o||"",t,!!o&&!!(k!=null&&k.available)&&!!(B!=null&&B.available)&&!Y),$=w.useMemo(()=>k!=null&&k.available?k.tree:[],[k]),Q=w.useMemo(()=>B!=null&&B.available?B.tree:[],[B]),K=o!==null,re=K&&!Y&&(B==null?void 0:B.available)===!0,U=w.useMemo(()=>re?XW(Q,$):qW($),[re,$,Q]),H=tO(U),X=n??H,j=U.length===0?null:i&&KW(U,i)?i:YW(U),le=tpe(j),se=!!j&&Ok($,j),J=!!j&&Ok(Q,j),{data:ee,isLoading:ie,isFetching:oe,error:de}=PI(t,j??"",!!t&&!!j&&!!(k!=null&&k.available)&&se),{data:ye,isLoading:ge,isFetching:Me,error:fe}=PI(o??"",j??"",!!o&&!!j&&!!(B!=null&&B.available)&&J),Se=se?ee:null,me=J?ye:null,Pe=j&&(Se==null?void 0:Se.file_path)===j?Se:null,ce=j&&(me==null?void 0:me.file_path)===j?me:null,He=(Se==null?void 0:Se.content)??null,Be=(Pe==null?void 0:Pe.content)??null,Ge=(ce==null?void 0:ce.content)??null,We=se?Be:"",ae=J?Ge:"",Z=j&&(m==null?void 0:m.targetPath)===j?m:null,be=K&&!(We!==null&&ae!==null)&&Z!==null,we=be?Z.rightContent:We,ve=be?Z.leftContent:ae,Re=Ct=>{r(At=>{const Ot=new Set(At??H);return Ot.has(Ct)?Ot.delete(Ct):Ot.add(Ct),Ot})},Ae=(Ct,At)=>Ct.map(Ot=>{var Zt;const cn=Ot.status==="added"?"text-emerald-700 dark:text-emerald-400":Ot.status==="removed"?"text-[#f27c7e] line-through":Ot.status==="modified"?"text-[#ab6100]":"",Lt=Ot.status==="added"?"text-emerald-700 dark:text-emerald-400":Ot.status==="removed"?"text-[#f27c7e]":Ot.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(Ot.type==="directory"){const Jt=X.has(Ot.path);return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>Re(Ot.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${At*14+6}px`},children:[f.jsx("span",{className:bt("inline-flex h-4 w-4 items-center justify-center",Lt),children:Jt?f.jsx(kr,{className:"h-3 w-3"}):f.jsx(tm,{className:"h-3 w-3"})}),Jt?f.jsx(Aue,{className:bt("h-3.5 w-3.5",Lt)}):f.jsx(kue,{className:bt("h-3.5 w-3.5",Lt)}),f.jsx("span",{className:bt("truncate",cn),children:Ot.name})]}),Jt&&((Zt=Ot.children)!=null&&Zt.length)?Ae(Ot.children,At+1):null]},Ot.path)}const wt=j===Ot.path;return f.jsxs("button",{type:"button",ref:Jt=>{_.current[Ot.path]=Jt},onClick:()=>{$e(Ot.path),s(Ot.path),K&&(p(0),S.current=!0,M.current=Ot.path)},className:bt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",wt&&"bg-muted font-medium"),style:{paddingLeft:`${At*14+26}px`},children:[f.jsx(Cue,{className:bt("h-3.5 w-3.5",Lt)}),f.jsx("span",{className:bt("truncate",cn),children:Ot.name})]},Ot.path)}),Oe=w.useMemo(()=>DA(He??"",le),[He,le]),qe=w.useMemo(()=>DA(ve??"",le),[ve,le]),Fe=w.useMemo(()=>DA(we??"",le),[we,le]),Ke=w.useMemo(()=>!K||!j?[]:ipe(ve??"",we??""),[K,j,ve,we]),je=!!j&&K&&!be&&(se&&We===null&&!de||J&&ae===null&&!fe),Te=!!j&&K&&(se&&oe||J&&Me),Xe=!se||Pe!==null&&!ie&&!oe,ht=!J||ce!==null&&!ge&&!Me,ke=!!(ce!=null&&ce.is_binary),et=!!(Se!=null&&Se.is_binary),ct=!!(Pe!=null&&Pe.is_binary),yt=K?se?we:J?ve:null:He,Je=!!j&&yt!==null&&!(K?se?ct:J?ke:!1:et),Ee=w.useMemo(()=>ope(Ke),[Ke]),Ze=w.useMemo(()=>spe(U),[U]),Ie=j?Ze.indexOf(j):-1,Ue=Ee.length>0?(d%Ee.length+Ee.length)%Ee.length:0,rt=Ee.length>0?Ue+1:0,ut=Ze.length>0&&Ie>=0?Ie+1:0,Dt=w.useMemo(()=>Ke.reduce((Ct,At)=>Ct+(At.kind==="add"?1:0),0),[Ke]),Rt=w.useMemo(()=>Ke.reduce((Ct,At)=>Ct+(At.kind==="remove"?1:0),0),[Ke]),St=(q==null?void 0:q.added_lines)??0,Ht=(q==null?void 0:q.removed_lines)??0,en=l!==null&&l===j,Ut=async()=>{!Je||yt===null||(await navigator.clipboard.writeText(yt),c(j),setTimeout(()=>c(null),2e3))},$e=Ct=>{K&&x({targetPath:Ct,leftContent:ve??"",rightContent:we??""})},dt=Ct=>{var cn;if(Ee.length===0)return;const At=(Ue+Ct+Ee.length)%Ee.length;p(At);const Ot=Ee[At].startRowIndex;(cn=b.current[Ot])==null||cn.scrollIntoView({behavior:"smooth",block:"center"})},Tt=Ct=>{if(Ze.length===0)return;const At=Ie<0?Ct===1?0:Ze.length-1:(Ie+Ct+Ze.length)%Ze.length;if(At===Ie)return;const Ot=Ze[At];$e(Ot),s(Ot),r(cn=>{const Lt=new Set(cn??H);for(const wt of IA(Ot))Lt.add(wt);return Lt}),p(0),S.current=!0,M.current=Ot,setTimeout(()=>{var cn;(cn=_.current[Ot])==null||cn.scrollIntoView({behavior:"smooth",block:"center"})},0)},Bt=()=>{if(Ze.length===0)return;const Ct=Ze[0];$e(Ct),s(Ct),r(At=>{const Ot=new Set(At??H);for(const cn of IA(Ct))Ot.add(cn);return Ot}),p(0),S.current=!0,M.current=Ct,setTimeout(()=>{var At;(At=_.current[Ct])==null||At.scrollIntoView({behavior:"smooth",block:"center"})},0)};return w.useEffect(()=>{C.current=o,o===null&&(S.current=!1,M.current=null)},[o]),w.useEffect(()=>{if(!K||!o||!re||C.current!==o||(C.current=null,Ze.length===0))return;const Ct=Ze[0];S.current=!0,M.current=Ct;const At=window.setTimeout(()=>{var Ot;j!==Ct&&(x({targetPath:Ct,leftContent:ve??"",rightContent:we??""}),s(Ct),r(cn=>{const Lt=new Set(cn??tO(U));for(const wt of IA(Ct))Lt.add(wt);return Lt})),p(0),(Ot=_.current[Ct])==null||Ot.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(At)},[K,o,re,Ze,j,ve,we,U]),w.useEffect(()=>{if(!K||!j||!S.current||M.current!==null&&M.current!==j||!Xe||!ht)return;const Ct=Ee.length>0?Ee[0].startRowIndex:null,At=requestAnimationFrame(()=>{var Ot;Ct!==null&&((Ot=b.current[Ct])==null||Ot.scrollIntoView({behavior:"smooth",block:"center"})),S.current=!1,M.current=null});return()=>cancelAnimationFrame(At)},[K,j,Ee,Xe,ht]),f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&L&&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:L}),(R==null?void 0:R.created_at)&&f.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:ry(R.created_at)})]}),f.jsx(oue,{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:ry(N.created_at)})]})]}),f.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[f.jsxs("span",{className:bt("text-emerald-700 transition-opacity dark:text-emerald-400",G&&"opacity-70"),children:["+",St]}),f.jsxs("span",{className:bt("text-red-500 transition-opacity dark:text-red-300",G&&"opacity-70"),children:["-",Ht]})]}),f.jsx(En,{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,M.current=null},children:f.jsx(qa,{className:"h-3.5 w-3.5"})})]}),f.jsx("div",{className:"min-h-0 flex-1",children:O&&!k?f.jsx("div",{className:"h-full min-h-0"}):F?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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(r2,{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."})]}):k!=null&&k.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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(r2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),f.jsx(JI,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!j})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:Ae(U,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:Ut,disabled:!Je,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:en?"Copied!":"Copy code",children:en?f.jsx(Nm,{className:"h-3.5 w-3.5"}):f.jsx(VT,{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:le})]}),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:["+",Dt]}),f.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",Rt]})]})]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{className:bt("h-full overflow-auto",K&&"pb-14"),children:j?K?Y&&!B?f.jsx("div",{className:"h-full"}):V?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):o&&!Y&&B&&!B.available?f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):je?f.jsx("div",{className:"h-full"}):se&&de&&!Pe||J&&fe&&!ce?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):ct||ke?f.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):f.jsx("div",{className:bt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",Te&&"opacity-50"),children:Ke.map((Ct,At)=>{const Ot=Ct.kind==="add"?Fe[(Ct.rightLine??1)-1]??L0(Ct.text.length>0?Ct.text:" ",le):qe[(Ct.leftLine??1)-1]??L0(Ct.text.length>0?Ct.text:" ",le);return f.jsxs("div",{ref:cn=>{Ct.kind!=="context"&&(b.current[At]=cn)},className:bt("flex",Ct.kind==="add"&&"bg-emerald-500/18",Ct.kind==="remove"&&"bg-red-400/10"),children:[f.jsxs("div",{className:bt("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:bt("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:bt("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:bt("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:Ot.map((cn,Lt)=>f.jsx("span",{className:bt(cn.className),children:cn.text},`diff-line-${At}-token-${Lt}`))})]},`diff-line-${At}`)})}):ie&&!Se?f.jsx("div",{className:"h-full"}):de&&!Se?f.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):et?f.jsx("div",{className:bt("p-4 text-sm text-muted-foreground transition-opacity",oe&&"opacity-50"),children:"Binary file preview is not supported."}):f.jsxs("div",{className:bt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",oe&&"opacity-50"),children:[(Se==null?void 0:Se.truncated)&&f.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),Oe.map((Ct,At)=>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:At+1})}),f.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Ct.map((Ot,cn)=>f.jsx("span",{className:bt(Ot.className),children:Ot.text},`line-${At}-token-${cn}`))})]},`line-${At}`))]}):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:Ee.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(En,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:Bt,disabled:Ze.length===0,children:f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx("span",{children:"See Changes"}),f.jsx(tm,{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(En,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>dt(-1),disabled:Ee.length===0,children:f.jsx(e8,{className:"h-3.5 w-3.5"})}),f.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[rt," / ",Ee.length]}),f.jsx(En,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>dt(1),disabled:Ee.length===0,children:f.jsx(kr,{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(En,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Tt(-1),disabled:Ze.length===0,children:f.jsx(HT,{className:"h-3.5 w-3.5"})}),f.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[ut," / ",Ze.length," files"]}),f.jsx(En,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Tt(1),disabled:Ze.length===0,children:f.jsx(tm,{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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(r2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),f.jsx(JI,{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 NS({...t}){return f.jsx(Mae,{"data-slot":"select",...t})}function kS({...t}){return f.jsx(Cae,{"data-slot":"select-value",...t})}function RS({className:t,size:e="default",children:n,...r}){return f.jsxs(Tae,{"data-slot":"select-trigger","data-size":e,className:bt("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(Eae,{asChild:!0,children:f.jsx(kr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function PS({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return f.jsx(Aae,{children:f.jsxs(Nae,{"data-slot":"select-content",className:bt("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(lpe,{}),f.jsx(kae,{"data-position":n,className:bt("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(cpe,{})]})})}function DS({className:t,children:e,...n}){return f.jsxs(Rae,{"data-slot":"select-item",className:bt("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(Dae,{children:f.jsx(Nm,{className:"pointer-events-none"})})}),f.jsx(Pae,{children:e})]})}function lpe({className:t,...e}){return f.jsx(Iae,{"data-slot":"select-scroll-up-button",className:bt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:f.jsx(e8,{})})}function cpe({className:t,...e}){return f.jsx(Oae,{"data-slot":"select-scroll-down-button",className:bt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:f.jsx(kr,{})})}const nO={DEBUG:"text-muted-foreground",INFO:"text-blue-600 dark:text-blue-400",WARNING:"text-yellow-600 dark:text-yellow-400",ERROR:"text-red-600 dark:text-red-400",CRITICAL:"text-red-700 dark:text-red-500 font-bold"};function upe({runPath:t,onBack:e}){const[n,r]=w.useState(0),[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState([]),[d,p]=w.useState(""),[m,x]=w.useState(""),b=w.useRef(null),_=w.useRef(null),{data:S}=Sde(t);w.useEffect(()=>{S&&(i===null&&S.components.length>0&&s(S.components[0]),o===null&&S.sources.length>0&&a(S.sources[0]))},[S,i,o]);const M=w.useMemo(()=>({components:i?[i]:void 0,levels:l.length>0?l:void 0,sources:o?[o]:void 0,search:m||void 0}),[i,l,o,m]),{data:C,isFetching:A}=_de(t,n,M);w.useEffect(()=>{r(0)},[i,l,o,m]);const N=w.useCallback(F=>{p(F),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>x(F),300)},[]),D=F=>{c(B=>B.includes(F)?B.filter(Y=>Y!==F):[...B,F])},R=F=>new Date(F*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),L=(C==null?void 0:C.logs)??[],k=(C==null?void 0:C.total_pages)??1,O=(C==null?void 0:C.total)??0;return 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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[f.jsx(r2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),f.jsx("span",{className:"text-xs font-medium",children:"Logs"}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:[O.toLocaleString()," records"]}),A&&f.jsx("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),f.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[((S==null?void 0:S.components.length)??0)>0&&f.jsxs(NS,{value:i??"",onValueChange:s,children:[f.jsx(RS,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(kS,{placeholder:"Component"})}),f.jsx(PS,{children:((S==null?void 0:S.components)??[]).map(F=>f.jsx(DS,{value:F,className:"text-xs",children:F},F))})]}),((S==null?void 0:S.sources.length)??0)>0&&f.jsxs(NS,{value:o??"",onValueChange:a,children:[f.jsx(RS,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(kS,{placeholder:"Source"})}),f.jsx(PS,{children:((S==null?void 0:S.sources)??[]).map(F=>f.jsx(DS,{value:F,className:"text-xs",children:F},F))})]}),f.jsx("div",{className:"flex items-center gap-1",children:((S==null?void 0:S.levels)??[]).map(F=>f.jsx("button",{onClick:()=>D(F),className:bt("px-1.5 py-0.5 text-[10px] rounded border transition-colors",l.includes(F)?"border-blue-600 bg-blue-600/10":l.length===0?"border-border hover:border-ring":"border-border text-muted-foreground/50 hover:border-ring",nO[F]??"text-muted-foreground"),children:F},F))}),f.jsxs("div",{className:"relative flex-1 max-w-xs",children:[f.jsx(Yue,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),f.jsx(ah,{type:"text",placeholder:"Search messages...",value:d,onChange:F=>N(F.target.value),className:"h-7 pl-7 pr-7 text-xs"}),d&&f.jsx("button",{onClick:()=>{p(""),x("")},className:"absolute right-2 top-1/2 -translate-y-1/2",children:f.jsx(qa,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})})]})]}),f.jsx("div",{ref:b,className:"min-h-0 flex-1 overflow-auto font-mono text-[11px] leading-[18px]",children:L.length===0?f.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:O===0?"No logs available":"No logs match filters"}):f.jsx("table",{className:"w-full",children:f.jsx("tbody",{children:L.map((F,B)=>f.jsxs("tr",{className:"hover:bg-muted/50 align-top",children:[f.jsx("td",{className:"px-2 py-px text-muted-foreground whitespace-nowrap select-none",children:R(F.timestamp)}),f.jsx("td",{className:bt("px-1 py-px whitespace-nowrap w-[60px] select-none",nO[F.level]??"text-muted-foreground"),children:F.level.substring(0,5).padEnd(5)}),f.jsx("td",{className:"px-2 py-px text-foreground whitespace-pre-wrap break-all",children:F.message})]},`${n}-${B}`))})})}),k>1&&f.jsxs("div",{className:"flex items-center justify-between px-2 border-t h-10",children:[f.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",n+1," of ",k]}),f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n===0,onClick:()=>r(F=>Math.max(0,F-1)),children:f.jsx(HT,{className:"h-3.5 w-3.5"})}),f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n>=k-1,onClick:()=>r(F=>F+1),children:f.jsx(tm,{className:"h-3.5 w-3.5"})})]})]})]})}function Rm({description:t}){const e=qn(GG),n=td(WG),r=td($G),{data:i,isLoading:s}=km(),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(ld,{className:"max-w-md w-full border-dashed",children:f.jsxs(XI,{className:"items-center text-center",children:[f.jsx(T4,{children:"Fetching runs from W&B…"}),f.jsxs(C4,{className:"flex items-center gap-1.5 font-medium",children:[f.jsx(gl,{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(ld,{className:"max-w-md w-full border-dashed",children:f.jsx(XI,{className:"text-center items-center",children:m?f.jsxs(f.Fragment,{children:[f.jsx(T4,{children:"No wandb key added yet"}),f.jsx(C4,{children:"Add your W&B API key to discover and sync runs."}),f.jsx(En,{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(T4,{children:"Add a project"}),f.jsx(C4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),f.jsx(En,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):f.jsxs(f.Fragment,{children:[f.jsx(T4,{children:"No Run Selected"}),f.jsx(C4,{children:t})]})})})})}const dpe=!0,xa="u-",fpe="uplot",hpe=xa+"hz",ppe=xa+"vt",mpe=xa+"title",gpe=xa+"wrap",xpe=xa+"under",vpe=xa+"over",ype=xa+"axis",Wg=xa+"off",bpe=xa+"select",_pe=xa+"cursor-x",Spe=xa+"cursor-y",wpe=xa+"cursor-pt",Mpe=xa+"legend",Tpe=xa+"live",Cpe=xa+"inline",Epe=xa+"series",Ape=xa+"marker",rO=xa+"label",Npe=xa+"value",P_="width",D_="height",o_="top",iO="bottom",Fv="left",OA="right",g8="#000",sO=g8+"0",LA="mousemove",oO="mousedown",jA="mouseup",aO="mouseenter",lO="mouseleave",cO="dblclick",kpe="resize",Rpe="scroll",uO="change",Y2="dppxchange",x8="--",Uy=typeof window<"u",Lk=Uy?document:null,k1=Uy?window:null,Ppe=Uy?navigator:null;let Ri,E4;function jk(){let t=devicePixelRatio;Ri!=t&&(Ri=t,E4&&Fk(uO,E4,jk),E4=matchMedia(`(min-resolution: ${Ri-.001}dppx) and (max-resolution: ${Ri+.001}dppx)`),cx(uO,E4,jk),k1.dispatchEvent(new CustomEvent(Y2)))}function eu(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function zk(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function ks(t,e,n){t.style[e]=n+"px"}function $d(t,e,n,r){let i=Lk.createElement(t);return e!=null&&eu(i,e),n!=null&&n.insertBefore(i,r),i}function qu(t,e){return $d("div",t,e)}const dO=new WeakMap;function Lf(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=dO.get(t);s!=o&&(t.style.transform=s,dO.set(t,s),e<0||n<0||e>r||n>i?eu(t,Wg):zk(t,Wg))}const fO=new WeakMap;function hO(t,e,n){let r=e+n,i=fO.get(t);r!=i&&(fO.set(t,r),t.style.background=e,t.style.borderColor=n)}const pO=new WeakMap;function mO(t,e,n,r){let i=e+""+n,s=pO.get(t);i!=s&&(pO.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 v8={passive:!0},Dpe={...v8,capture:!0};function cx(t,e,n,r){e.addEventListener(t,n,r?Dpe:v8)}function Fk(t,e,n,r){e.removeEventListener(t,n,v8)}Uy&&jk();function Kd(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:du((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function ZW(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 QW=t=>t!=null,JW=t=>t!=null&&t>0,oC=ZW(QW),Ipe=ZW(JW);function Ope(t,e,n,r=0,i=!1){let s=i?Ipe:oC,o=i?JW:QW;[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 aC(t,e,n,r){let i=vO(t),s=vO(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?mp:e$,a=i==1?du:Ju,l=s==1?Ju:du,c=a(o(da(t))),d=l(o(da(e))),p=dy(n,c),m=dy(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=i$(t,p),e=lC(e,m)),[t,e]}function y8(t,e,n,r){let i=aC(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const b8=.1,gO={mode:3,pad:b8},q_={pad:0,soft:null,mode:0},Lpe={min:q_,max:q_};function K2(t,e,n,r){return cC(n)?xO(t,e,n):(q_.pad=n,q_.soft=r?0:null,q_.mode=r?3:0,xO(t,e,Lpe))}function Ti(t,e){return t??e}function jpe(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 xO(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=mp(x),_=ql(da(t),da(e)),S=mp(_),M=da(S-b);(x<1e-24||M>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=mp(C),N=dy(10,du(A)),D=C*(x==0?t==0?.1:1:s),R=ns(i$(t-D,N/10),24),L=t>=c&&(p==1||p==3&&R<=c||p==2&&R>=c)?c:ts,k=ql(a,R<L&&t>=L?L:Qd(L,R)),O=C*(x==0?e==0?.1:1:o),F=ns(lC(e+O,N/10),24),B=e<=d&&(m==1||m==3&&F>=d||m==2&&F<=d)?d:-ts,Y=Qd(l,F>B&&e<=B?B:ql(B,F));return k==Y&&k==0&&(Y=100),[k,Y]}const zpe=new Intl.NumberFormat(Uy?Ppe.language:"en-US"),_8=t=>zpe.format(t),bu=Math,s2=bu.PI,da=bu.abs,du=bu.floor,ca=bu.round,Ju=bu.ceil,Qd=bu.min,ql=bu.max,dy=bu.pow,vO=bu.sign,mp=bu.log10,e$=bu.log2,Fpe=(t,e=1)=>bu.sinh(t)*e,zA=(t,e=1)=>bu.asinh(t/e),ts=1/0;function yO(t){return(mp((t^t>>31)-(t>>31))|0)+1}function Uk(t,e,n){return Qd(ql(t,e),n)}function t$(t){return typeof t=="function"}function ai(t){return t$(t)?t:()=>t}const Upe=()=>{},n$=t=>t,r$=(t,e)=>e,Bpe=t=>null,bO=t=>!0,_O=(t,e)=>t==e,Hpe=/\.\d*?(?=9{6,}|0{6,})/gm,yx=t=>{if(o$(t)||fm.has(t))return t;const e=`${t}`,n=e.match(Hpe);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${yx(i)}e${s}`}return ns(t,r)};function Ug(t,e){return yx(ns(yx(t/e))*e)}function lC(t,e){return yx(Ju(yx(t/e))*e)}function i$(t,e){return yx(du(yx(t/e))*e)}function ns(t,e=0){if(o$(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return ca(r)/n}const fm=new Map;function s$(t){return((""+t).split(".")[1]||"").length}function IS(t,e,n,r){let i=[],s=r.map(s$);for(let o=e;o<n;o++){let a=da(o),l=ns(dy(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),fm.set(m,p)}}return i}const X_={},S8=[],fy=[null,null],j0=Array.isArray,o$=Number.isInteger,Vpe=t=>t===void 0;function SO(t){return typeof t=="string"}function cC(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function Gpe(t){return t!=null&&typeof t=="object"}const Wpe=Object.getPrototypeOf(Uint8Array),a$="__proto__";function hy(t,e=cC){let n;if(j0(t)){let r=t.find(i=>i!=null);if(j0(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=hy(t[i],e)}else n=t.slice()}else if(t instanceof Wpe)n=t.slice();else if(e(t)){n={};for(let r in t)r!=a$&&(n[r]=hy(t[r],e))}else n=t;return n}function Xo(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=a$&&(cC(t[i])?Xo(t[i],hy(r[i])):t[i]=hy(r[i]))}return t}const $pe=0,qpe=1,Xpe=2;function Ype(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 Kpe(t,e){if(Jpe(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return e0e(o[0])||(o=Qpe(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]:qpe,x=[];for(let b=0;b<d.length;b++){let _=d[b],S=s.get(l[b]);_===null?m!=$pe&&(p[S]=_,m==Xpe&&x.push(S)):p[S]=_}Ype(p,x,i),r.push(p)}}return r}const Zpe=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function Qpe(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 Jpe(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 e0e(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=ql(1,du((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 l$=["January","February","March","April","May","June","July","August","September","October","November","December"],c$=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function u$(t){return t.slice(0,3)}const t0e=c$.map(u$),n0e=l$.map(u$),r0e={MMMM:l$,MMM:n0e,WWWW:c$,WWW:t0e};function a_(t){return(t<10?"0":"")+t}function i0e(t){return(t<10?"00":t<100?"0":"")+t}const s0e={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=>a_(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>a_(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>a_(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=>a_(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>a_(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>i0e(t.getMilliseconds())};function w8(t,e){e=e||r0e;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?s0e[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 o0e=new Intl.DateTimeFormat().resolvedOptions().timeZone;function a0e(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==o0e?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const d$=t=>t%1==0,Z2=[1,2,2.5,5],l0e=IS(10,-32,0,Z2),f$=IS(10,0,32,Z2),c0e=f$.filter(d$),Bg=l0e.concat(f$),M8=`
`,h$="{YYYY}",wO=M8+h$,p$="{M}/{D}",I_=M8+p$,A4=I_+"/{YY}",m$="{aa}",u0e="{h}:{mm}",p1=u0e+m$,MO=M8+p1,TO=":{ss}",Bi=null;function g$(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?IS(10,0,3,Z2).filter(d$):IS(10,-3,0,Z2)).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,h$,Bi,Bi,Bi,Bi,Bi,Bi,1],[i*28,"{MMM}",wO,Bi,Bi,Bi,Bi,Bi,1],[i,p$,wO,Bi,Bi,Bi,Bi,Bi,1],[r,"{h}"+m$,A4,Bi,I_,Bi,Bi,Bi,1],[n,p1,A4,Bi,I_,Bi,Bi,Bi,1],[e,TO,A4+" "+p1,Bi,I_+" "+p1,Bi,MO,Bi,1],[t,TO+".{fff}",A4+" "+p1,Bi,I_+" "+p1,Bi,MO,Bi,1]];function d(p){return(m,x,b,_,S,M)=>{let C=[],A=S>=o,N=S>=s&&S<o,D=p(b),R=ns(D*t,3),L=FA(D.getFullYear(),A?0:D.getMonth(),N||A?1:D.getDate()),k=ns(L*t,3);if(N||A){let O=N?S/s:0,F=A?S/o:0,B=R==k?R:ns(FA(L.getFullYear()+F,L.getMonth()+O,1)*t,3),Y=new Date(ca(B/t)),V=Y.getFullYear(),q=Y.getMonth();for(let G=0;B<=_;G++){let $=FA(V+F*G,q+O*G,1),Q=$-p(ns($*t,3));B=ns((+$+Q)*t,3),B<=_&&C.push(B)}}else{let O=S>=i?i:S,F=du(b)-du(R),B=k+F+lC(R-k,O);C.push(B);let Y=p(B),V=Y.getHours()+Y.getMinutes()/n+Y.getSeconds()/r,q=S/r,G=m.axes[x]._space,$=M/G;for(;B=ns(B+S,t==1?0:3),!(B>_);)if(q>1){let Q=du(ns(V+q,6))%24,U=p(B).getHours()-Q;U>1&&(U=-1),B-=U*r,V=(V+q)%24;let H=C[C.length-1];ns((B-H)/S,3)*$>=.7&&C.push(B)}else C.push(B)}return C}}return[l,c,d]}const[d0e,f0e,h0e]=g$(1),[p0e,m0e,g0e]=g$(.001);IS(2,-53,53,[1]);function CO(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 EO(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(),M=_.getMonth(),C=_.getDate(),A=_.getHours(),N=_.getMinutes(),D=_.getSeconds(),R=S!=l&&a[2]||M!=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=M,d=C,p=A,m=N,x=D,R(_)})}}function x0e(t,e){let n=w8(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function FA(t,e,n){return new Date(t,e,n)}function AO(t,e){return e(t)}const v0e="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function NO(t,e){return(n,r,i,s)=>s==null?x8:e(t(r))}function y0e(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function b0e(t,e){return t.series[e].fill(t,e)}const _0e={show:!0,live:!0,isolate:!1,mount:Upe,markers:{show:!0,width:2,stroke:y0e,fill:b0e,dash:"solid"},idx:null,idxs:null,values:[]};function S0e(t,e){let n=t.cursor.points,r=qu(),i=n.size(t,e);ks(r,P_,i),ks(r,D_,i);let s=i/-2;ks(r,"marginLeft",s),ks(r,"marginTop",s);let o=n.width(t,e,i);return o&&ks(r,"borderWidth",o),r}function w0e(t,e){let n=t.series[e].points;return n._fill||n._stroke}function M0e(t,e){let n=t.series[e].points;return n._stroke||n._fill}function T0e(t,e){return t.series[e].points.size}const UA=[0,0];function C0e(t,e,n){return UA[0]=e,UA[1]=n,UA}function N4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function BA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const E0e={show:!0,x:!0,y:!0,lock:!1,move:C0e,points:{one:!1,show:S0e,size:T0e,width:0,stroke:M0e,fill:w0e},bind:{mousedown:N4,mouseup:N4,click:N4,dblclick:N4,mousemove:BA,mouseleave:BA,mouseenter:BA},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},x$={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},T8=Xo({},x$,{filter:r$}),v$=Xo({},T8,{size:10}),y$=Xo({},x$,{show:!1}),C8='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"',b$="bold "+C8,_$=1.5,kO={show:!0,scale:"x",stroke:g8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:b$,side:2,grid:T8,ticks:v$,border:y$,font:C8,lineGap:_$,rotate:0},A0e="Value",N0e="Time",RO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function k0e(t,e,n,r,i){return e.map(s=>s==null?"":_8(s))}function R0e(t,e,n,r,i,s,o){let a=[],l=fm.get(i)||0;n=o?n:ns(lC(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 Bk(t,e,n,r,i,s,o){const a=[],l=t.scales[t.axes[e].scale].log,c=l==10?mp:e$,d=du(c(n));i=dy(l,d),l==10&&(i=Bg[Kd(i,Bg)]);let p=n,m=i*l;l==10&&(m=Bg[Kd(m,Bg)]);do a.push(p),p=p+i,l==10&&!fm.has(p)&&(p=ns(p,fm.get(i))),p>=m&&(i=p,m=i*l,l==10&&(m=Bg[Kd(m,Bg)]));while(p<=r);return a}function P0e(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?Bk(t,e,ql(l,n),r,i):[l],d=r>=0&&n<=0?[0]:[];return(n<-l?Bk(t,e,ql(l,-r),-n,i):[l]).reverse().map(m=>-m).concat(d,c)}const S$=/./,D0e=/[12357]/,I0e=/[125]/,PO=/1/,Hk=(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 O0e(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?S$:l(7,o)-d>=c?D0e:l(5,o)-d>=c?I0e:PO;if(p==PO){let m=da(l(1,o)-d);if(m<c)return Hk(e.slice().reverse(),a.distr,p,Ju(c/m)).reverse()}return Hk(e,a.distr,p,1)}function L0e(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=s._space,l=t.valToPos,c=da(l(1,o)-l(2,o));return c<a?Hk(e.slice().reverse(),3,S$,Ju(a/c)).reverse():e}function j0e(t,e,n,r){return r==null?x8:e==null?"":_8(e)}const DO={show:!0,scale:"y",stroke:g8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:b$,side:3,grid:T8,ticks:v$,border:y$,font:C8,lineGap:_$,rotate:0};function z0e(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function F0e(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=da(o-s),l=t.series[e],c=a/(l.points.space*Ri);return r[1]-r[0]<=c}const IO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},w$=(t,e,n,r,i)=>i,OO={show:!0,auto:!0,sorted:0,gaps:w$,alpha:1,facets:[Xo({},IO,{scale:"x"}),Xo({},IO,{scale:"y"})]},LO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:w$,alpha:1,points:{show:F0e,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function U0e(t,e,n,r,i){return n/10}const M$={time:dpe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},B0e=Xo({},M$,{time:!1,ori:1}),jO={};function T$(t,e){let n=jO[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&&(jO[t]=n)),n}const py=1,Vk=2;function Dx(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,M=t.valToPosV;return d.ori==0?n(i,l,c,d,p,S,M,m,x,b,_,dC,By,hC,E$,N$):n(i,l,c,d,p,M,S,x,m,_,b,fC,Hy,N8,A$,k$)}function E8(t,e){let n=0,r=0,i=Ti(t.bands,S8);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 H0e(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 gp(t,e,n,r,i,s){return Dx(t,e,(o,a,l,c,d,p,m,x,b,_,S)=>{let M=o.pxRound;const C=c.dir*(c.ori==0?1:-1),A=c.ori==0?By:Hy;let N,D;C==1?(N=n,D=r):(N=r,D=n);let R=M(p(a[N],c,_,x)),L=M(m(l[N],d,S,b)),k=M(p(a[D],c,_,x)),O=M(m(s==1?d.max:d.min,d,S,b)),F=new Path2D(i);return A(F,k,O),A(F,R,O),A(F,R,L),F})}function uC(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?hC:N8;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 V0e(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function A8(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 M=m+i;b=o>=0&&M>=0&&M<l?s(t[M]):b,b>=x&&a.push([x,b])}return a}function zO(t){return t==0?n$:t==1?ca:e=>Ug(e,t)}function C$(t){let e=t==0?dC:fC,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=Qd(c,a/2,l/2),d=Qd(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 dC=(t,e,n)=>{t.moveTo(e,n)},fC=(t,e,n)=>{t.moveTo(n,e)},By=(t,e,n)=>{t.lineTo(e,n)},Hy=(t,e,n)=>{t.lineTo(n,e)},hC=C$(0),N8=C$(1),E$=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},A$=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},N$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},k$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function R$(t){return(e,n,r,i,s)=>Dx(e,n,(o,a,l,c,d,p,m,x,b,_,S)=>{let{pxRound:M,points:C}=o,A,N;c.ori==0?(A=dC,N=E$):(A=fC,N=A$);const D=ns(C.width*Ri,3);let R=(C.size-C.width)/2*Ri,L=ns(R*2,3),k=new Path2D,O=new Path2D,{left:F,top:B,width:Y,height:V}=e.bbox;hC(O,F-L,B-L,Y+L*2,V+L*2);const q=G=>{if(l[G]!=null){let $=M(p(a[G],c,_,x)),Q=M(m(l[G],d,S,b));A(k,$+R,Q),N(k,$,Q,R,0,s2*2)}};if(s)s.forEach(q);else for(let G=r;G<=i;G++)q(G);return{stroke:D>0?k:null,fill:k,clip:O,flags:py|Vk}})}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 G0e=P$(By),W0e=P$(Hy);function D$(t){const e=Ti(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>Dx(n,r,(o,a,l,c,d,p,m,x,b,_,S)=>{[i,s]=oC(l,i,s);let M=o.pxRound,C=V=>M(p(V,c,_,x)),A=V=>M(m(V,d,S,b)),N,D;c.ori==0?(N=By,D=G0e):(N=Hy,D=W0e);const R=c.dir*(c.ori==0?1:-1),L={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:py},k=L.stroke;let O=!1;if(s-i>=_*4){let V=j=>n.posToVal(j,c.key,!0),q=null,G=null,$,Q,K,re=C(a[R==1?i:s]),U=C(a[i]),H=C(a[s]),X=V(R==1?U+1:H-1);for(let j=R==1?i:s;j>=i&&j<=s;j+=R){let le=a[j],J=(R==1?le<X:le>X)?re:C(le),ee=l[j];J==re?ee!=null?(Q=ee,q==null?(N(k,J,A(Q)),$=q=G=Q):Q<q?q=Q:Q>G&&(G=Q)):ee===null&&(O=!0):(q!=null&&D(k,re,A(q),A(G),A($),A(Q)),ee!=null?(Q=ee,N(k,J,A(Q)),q=G=$=Q):(q=G=null,ee===null&&(O=!0)),re=J,X=V(re+R))}q!=null&&q!=G&&K!=re&&D(k,re,A(q),A(G),A($),A(Q))}else for(let V=R==1?i:s;V>=i&&V<=s;V+=R){let q=l[V];q===null?O=!0:q!=null&&N(k,C(a[V]),A(q))}let[B,Y]=E8(n,r);if(o.fill!=null||B!=0){let V=L.fill=new Path2D(k),q=o.fillTo(n,r,o.min,o.max,B),G=A(q),$=C(a[i]),Q=C(a[s]);R==-1&&([Q,$]=[$,Q]),N(V,Q,G),N(V,$,G)}if(!o.spanGaps){let V=[];O&&V.push(...A8(a,l,i,s,R,C,e)),L.gaps=V=o.gaps(n,r,i,s,V),L.clip=uC(V,c.ori,x,b,_,S)}return Y!=0&&(L.band=Y==2?[gp(n,r,i,s,k,-1),gp(n,r,i,s,k,1)]:gp(n,r,i,s,k,Y)),L})}function $0e(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)=>Dx(s,o,(c,d,p,m,x,b,_,S,M,C,A)=>{[a,l]=oC(p,a,l);let N=c.pxRound,{left:D,width:R}=s.bbox,L=U=>N(b(U,m,C,S)),k=U=>N(_(U,x,A,M)),O=m.ori==0?By:Hy;const F={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:py},B=F.stroke,Y=m.dir*(m.ori==0?1:-1);let V=k(p[Y==1?a:l]),q=L(d[Y==1?a:l]),G=q,$=q;i&&e==-1&&($=D,O(B,$,V)),O(B,q,V);for(let U=Y==1?a:l;U>=a&&U<=l;U+=Y){let H=p[U];if(H==null)continue;let X=L(d[U]),j=k(H);e==1?O(B,X,V):O(B,G,j),O(B,X,j),V=j,G=X}let Q=G;i&&e==1&&(Q=D+R,O(B,Q,V));let[K,re]=E8(s,o);if(c.fill!=null||K!=0){let U=F.fill=new Path2D(B),H=c.fillTo(s,o,c.min,c.max,K),X=k(H);O(U,Q,X),O(U,$,X)}if(!c.spanGaps){let U=[];U.push(...A8(d,p,a,l,Y,L,r));let H=c.width*Ri/2,X=n||e==1?H:-H,j=n||e==-1?-H:H;U.forEach(le=>{le[0]+=X,le[1]+=j}),F.gaps=U=c.gaps(s,o,a,l,U),F.clip=uC(U,m.ori,S,M,C,A)}return re!=0&&(F.band=re==2?[gp(s,o,a,l,B,-1),gp(s,o,a,l,B,1)]:gp(s,o,a,l,B,re)),F})}function FO(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=da(t[l]-t[a]);d<c&&(c=d,o=da(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function q0e(t){t=t||X_;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=ai(i),o=1-e[0],a=Ti(e[1],ts),l=Ti(e[2],1),c=Ti(t.disp,X_),d=Ti(t.each,x=>{}),{fill:p,stroke:m}=c;return(x,b,_,S)=>Dx(x,b,(M,C,A,N,D,R,L,k,O,F,B)=>{let Y=M.pxRound,V=n,q=r*Ri,G=a*Ri,$=l*Ri,Q,K;N.ori==0?[Q,K]=s(x,b):[K,Q]=s(x,b);const re=N.dir*(N.ori==0?1:-1);let U=N.ori==0?hC:N8,H=N.ori==0?d:(he,be,we,ve,Re,Ae,Oe)=>{d(he,be,we,Re,ve,Oe,Ae)},X=Ti(x.bands,S8).find(he=>he.series[0]==b),j=X!=null?X.dir:0,le=M.fillTo(x,b,M.min,M.max,j),se=Y(L(le,D,B,O)),J,ee,ie,oe=F,de=Y(M.width*Ri),ye=!1,ge=null,Me=null,fe=null,Se=null;p!=null&&(de==0||m!=null)&&(ye=!0,ge=p.values(x,b,_,S),Me=new Map,new Set(ge).forEach(he=>{he!=null&&Me.set(he,new Path2D)}),de>0&&(fe=m.values(x,b,_,S),Se=new Map,new Set(fe).forEach(he=>{he!=null&&Se.set(he,new Path2D)})));let{x0:me,size:Pe}=c;if(me!=null&&Pe!=null){V=1,C=me.values(x,b,_,S),me.unit==2&&(C=C.map(we=>x.posToVal(k+we*F,N.key,!0)));let he=Pe.values(x,b,_,S);Pe.unit==2?ee=he[0]*F:ee=R(he[0],N,F,k)-R(0,N,F,k),oe=FO(C,A,R,N,F,k,oe),ie=oe-ee+q}else oe=FO(C,A,R,N,F,k,oe),ie=oe*o+q,ee=oe-ie;ie<1&&(ie=0),de>=ee/2&&(de=0),ie<5&&(Y=n$);let ce=ie>0,He=oe-ie-(ce?de:0);ee=Y(Uk(He,$,G)),J=(V==0?ee/2:V==re?0:ee)-V*re*((V==0?q/2:0)+(ce?de/2:0));const Be={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ge=ye?null:new Path2D;let We=null;if(X!=null)We=x.data[X.series[1]];else{let{y0:he,y1:be}=c;he!=null&&be!=null&&(A=be.values(x,b,_,S),We=he.values(x,b,_,S))}let ae=Q*ee,Z=K*ee;for(let he=re==1?_:S;he>=_&&he<=S;he+=re){let be=A[he];if(be==null)continue;if(We!=null){let Ke=We[he]??0;if(be-Ke==0)continue;se=L(Ke,D,B,O)}let we=N.distr!=2||c!=null?C[he]:he,ve=R(we,N,F,k),Re=L(Ti(be,le),D,B,O),Ae=Y(ve-J),Oe=Y(ql(Re,se)),qe=Y(Qd(Re,se)),Fe=Oe-qe;if(be!=null){let Ke=be<0?Z:ae,je=be<0?ae:Z;ye?(de>0&&fe[he]!=null&&U(Se.get(fe[he]),Ae,qe+du(de/2),ee,ql(0,Fe-de),Ke,je),ge[he]!=null&&U(Me.get(ge[he]),Ae,qe+du(de/2),ee,ql(0,Fe-de),Ke,je)):U(Ge,Ae,qe+du(de/2),ee,ql(0,Fe-de),Ke,je),H(x,b,he,Ae-de/2,qe,ee+de,Fe)}}return de>0?Be.stroke=ye?Se:Ge:ye||(Be._fill=M.width==0?M._fill:M._stroke??M._fill,Be.width=0),Be.fill=ye?Me:Ge,Be})}function X0e(t,e){const n=Ti(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>Dx(r,i,(a,l,c,d,p,m,x,b,_,S,M)=>{[s,o]=oC(c,s,o);let C=a.pxRound,A=Q=>C(m(Q,d,S,b)),N=Q=>C(x(Q,p,M,_)),D,R,L;d.ori==0?(D=dC,L=By,R=N$):(D=fC,L=Hy,R=k$);const k=d.dir*(d.ori==0?1:-1);let O=A(l[k==1?s:o]),F=O,B=[],Y=[];for(let Q=k==1?s:o;Q>=s&&Q<=o;Q+=k)if(c[Q]!=null){let re=l[Q],U=A(re);B.push(F=U),Y.push(N(c[Q]))}const V={stroke:t(B,Y,D,L,R,C),fill:null,clip:null,band:null,gaps:null,flags:py},q=V.stroke;let[G,$]=E8(r,i);if(a.fill!=null||G!=0){let Q=V.fill=new Path2D(q),K=a.fillTo(r,i,a.min,a.max,G),re=N(K);L(Q,F,re),L(Q,O,re)}if(!a.spanGaps){let Q=[];Q.push(...A8(l,c,s,o,k,A,n)),V.gaps=Q=a.gaps(r,i,s,o,Q),V.clip=uC(Q,d.ori,b,_,S,M)}return $!=0&&(V.band=$==2?[gp(r,i,s,o,q,-1),gp(r,i,s,o,q,1)]:gp(r,i,s,o,q,$)),V})}function Y0e(t){return X0e(K0e,t)}function K0e(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 Gk=new Set;function UO(){for(let t of Gk)t.syncRect(!0)}Uy&&(cx(kpe,k1,UO),cx(Rpe,k1,UO,!0),cx(Y2,k1,()=>{ps.pxRatio=Ri}));const Z0e=D$(),Q0e=R$();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)=>Wk(s,o,e,n))}function J0e(t,e){return t.map((n,r)=>r==0?{}:Xo({},e,n))}function Wk(t,e,n,r){return Xo({},e==0?n:r,t)}function I$(t,e,n){return e==null?fy:[e,n]}const eme=I$;function tme(t,e,n){return e==null?fy:K2(e,n,b8,!0)}function O$(t,e,n,r){return e==null?fy:aC(e,n,t.scales[r].log,!1)}const nme=O$;function L$(t,e,n,r){return e==null?fy:y8(e,n,t.scales[r].log,!1)}const rme=L$;function ime(t,e,n,r,i){let s=ql(yO(t),yO(e)),o=e-t,a=Kd(i/r*o,n);do{let l=n[a],c=r*l/o;if(c>=i&&s+(l<5?fm.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function HO(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=ca((n=+i)*Ri))+"px"),[t,e,n]}function sme(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 ps(t,e,n){const r={mode:Ti(t.mode,1)},i=r.mode;function s(xe,Ne,Ye,Qe){let ft=Ne.valToPct(xe);return Qe+Ye*(Ne.dir==-1?1-ft:ft)}function o(xe,Ne,Ye,Qe){let ft=Ne.valToPct(xe);return Qe+Ye*(Ne.dir==-1?ft:1-ft)}function a(xe,Ne,Ye,Qe){return Ne.ori==0?s(xe,Ne,Ye,Qe):o(xe,Ne,Ye,Qe)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=qu(fpe);if(t.id!=null&&(c.id=t.id),eu(c,t.class),t.title){let xe=qu(mpe,c);xe.textContent=t.title}const d=$d("canvas"),p=r.ctx=d.getContext("2d"),m=qu(gpe,c);cx("click",m,xe=>{xe.target===b&&(ii!=bs||Wr!=Ja)&&Sr.click(r,xe)},!0);const x=r.under=qu(xpe,m);m.appendChild(d);const b=r.over=qu(vpe,m);t=hy(t);const _=+Ti(t.pxAlign,1),S=zO(_);(t.plugins||[]).forEach(xe=>{xe.opts&&(t=xe.opts(r,t)||t)});const M=t.ms||.001,C=r.series=i==1?BO(t.series||[],RO,LO,!1):J0e(t.series||[null],OO),A=r.axes=BO(t.axes||[],kO,DO,!0),N=r.scales={},D=r.bands=t.bands||[];D.forEach(xe=>{xe.fill=ai(xe.fill||null),xe.dir=Ti(xe.dir,-1)});const R=i==2?C[1].facets[0].scale:C[0].scale,L={axes:ka,series:ss},k=(t.drawOrder||["axes","series"]).map(xe=>L[xe]);function O(xe){const Ne=xe.distr==3?Ye=>mp(Ye>0?Ye:xe.clamp(r,Ye,xe.min,xe.max,xe.key)):xe.distr==4?Ye=>zA(Ye,xe.asinh):xe.distr==100?Ye=>xe.fwd(Ye):Ye=>Ye;return Ye=>{let Qe=Ne(Ye),{_min:ft,_max:Et}=xe,$t=Et-ft;return(Qe-ft)/$t}}function F(xe){let Ne=N[xe];if(Ne==null){let Ye=(t.scales||X_)[xe]||X_;if(Ye.from!=null){F(Ye.from);let Qe=Xo({},N[Ye.from],Ye,{key:xe});Qe.valToPct=O(Qe),N[xe]=Qe}else{Ne=N[xe]=Xo({},xe==R?M$:B0e,Ye),Ne.key=xe;let Qe=Ne.time,ft=Ne.range,Et=j0(ft);if((xe!=R||i==2&&!Qe)&&(Et&&(ft[0]==null||ft[1]==null)&&(ft={min:ft[0]==null?gO:{mode:1,hard:ft[0],soft:ft[0]},max:ft[1]==null?gO:{mode:1,hard:ft[1],soft:ft[1]}},Et=!1),!Et&&cC(ft))){let $t=ft;ft=(Qt,ln,Mn)=>ln==null?fy:K2(ln,Mn,$t)}Ne.range=ai(ft||(Qe?eme:xe==R?Ne.distr==3?nme:Ne.distr==4?rme:I$:Ne.distr==3?O$:Ne.distr==4?L$:tme)),Ne.auto=ai(Et?!1:Ne.auto),Ne.clamp=ai(Ne.clamp||U0e),Ne._min=Ne._max=null,Ne.valToPct=O(Ne)}}}F("x"),F("y"),i==1&&C.forEach(xe=>{F(xe.scale)}),A.forEach(xe=>{F(xe.scale)});for(let xe in t.scales)F(xe);const B=N[R],Y=B.distr;let V,q;B.ori==0?(eu(c,hpe),V=s,q=o):(eu(c,ppe),V=o,q=s);const G={};for(let xe in N){let Ne=N[xe];(Ne.min!=null||Ne.max!=null)&&(G[xe]={min:Ne.min,max:Ne.max},Ne.min=Ne.max=null)}const $=t.tzDate||(xe=>new Date(ca(xe/M))),Q=t.fmtDate||w8,K=M==1?h0e($):g0e($),re=EO($,CO(M==1?f0e:m0e,Q)),U=NO($,AO(v0e,Q)),H=[],X=r.legend=Xo({},_0e,t.legend),j=r.cursor=Xo({},E0e,{drag:{y:i==2}},t.cursor),le=X.show,se=j.show,J=X.markers;X.idxs=H,J.width=ai(J.width),J.dash=ai(J.dash),J.stroke=ai(J.stroke),J.fill=ai(J.fill);let ee,ie,oe,de=[],ye=[],ge,Me=!1,fe={};if(X.live){const xe=C[1]?C[1].values:null;Me=xe!=null,ge=Me?xe(r,1,0):{_:0};for(let Ne in ge)fe[Ne]=x8}if(le)if(ee=$d("table",Mpe,c),oe=$d("tbody",null,ee),X.mount(r,ee),Me){ie=$d("thead",null,ee,oe);let xe=$d("tr",null,ie);$d("th",null,xe);for(var Se in ge)$d("th",rO,xe).textContent=Se}else eu(ee,Cpe),X.live&&eu(ee,Tpe);const me={show:!0},Pe={show:!1};function ce(xe,Ne){if(Ne==0&&(Me||!X.live||i==2))return fy;let Ye=[],Qe=$d("tr",Epe,oe,oe.childNodes[Ne]);eu(Qe,xe.class),xe.show||eu(Qe,Wg);let ft=$d("th",null,Qe);if(J.show){let Qt=qu(Ape,ft);if(Ne>0){let ln=J.width(r,Ne);ln&&(Qt.style.border=ln+"px "+J.dash(r,Ne)+" "+J.stroke(r,Ne)),Qt.style.background=J.fill(r,Ne)}}let Et=qu(rO,ft);xe.label instanceof HTMLElement?Et.appendChild(xe.label):Et.textContent=xe.label,Ne>0&&(J.show||(Et.style.color=xe.width>0?J.stroke(r,Ne):J.fill(r,Ne)),Be("click",ft,Qt=>{if(j._lock)return;rt(Qt);let ln=C.indexOf(xe);if((Qt.ctrlKey||Qt.metaKey)!=X.isolate){let Mn=C.some((Cn,Pn)=>Pn>0&&Pn!=ln&&Cn.show);C.forEach((Cn,Pn)=>{Pn>0&&gi(Pn,Mn?Pn==ln?me:Pe:me,!0,Ss.setSeries)})}else gi(ln,{show:!xe.show},!0,Ss.setSeries)},!1),Rt&&Be(aO,ft,Qt=>{j._lock||(rt(Qt),gi(C.indexOf(xe),_s,!0,Ss.setSeries))},!1));for(var $t in ge){let Qt=$d("td",Npe,Qe);Qt.textContent="--",Ye.push(Qt)}return[Qe,Ye]}const He=new Map;function Be(xe,Ne,Ye,Qe=!0){const ft=He.get(Ne)||{},Et=j.bind[xe](r,Ne,Ye,Qe);Et&&(cx(xe,Ne,ft[xe]=Et),He.set(Ne,ft))}function Ge(xe,Ne,Ye){const Qe=He.get(Ne)||{};for(let ft in Qe)(xe==null||ft==xe)&&(Fk(ft,Ne,Qe[ft]),delete Qe[ft]);xe==null&&He.delete(Ne)}let We=0,ae=0,Z=0,he=0,be=0,we=0,ve=be,Re=we,Ae=Z,Oe=he,qe=0,Fe=0,Ke=0,je=0;r.bbox={};let Te=!1,Xe=!1,ht=!1,ke=!1,et=!1,ct=!1;function yt(xe,Ne,Ye){(Ye||xe!=r.width||Ne!=r.height)&&lt(xe,Ne),ec(!1),ht=!0,Xe=!0,Qa()}function lt(xe,Ne){r.width=We=Z=xe,r.height=ae=he=Ne,be=we=0,Ie(),Ue();let Ye=r.bbox;qe=Ye.left=Ug(be*Ri,.5),Fe=Ye.top=Ug(we*Ri,.5),Ke=Ye.width=Ug(Z*Ri,.5),je=Ye.height=Ug(he*Ri,.5)}const Je=3;function Ee(){let xe=!1,Ne=0;for(;!xe;){Ne++;let Ye=ea(Ne),Qe=va(Ne);xe=Ne==Je||Ye&&Qe,xe||(lt(r.width,r.height),Xe=!0)}}function Ze({width:xe,height:Ne}){yt(xe,Ne)}r.setSize=Ze;function Ie(){let xe=!1,Ne=!1,Ye=!1,Qe=!1;A.forEach((ft,Et)=>{if(ft.show&&ft._show){let{side:$t,_size:Qt}=ft,ln=$t%2,Mn=ft.label!=null?ft.labelSize:0,Cn=Qt+Mn;Cn>0&&(ln?(Z-=Cn,$t==3?(be+=Cn,Qe=!0):Ye=!0):(he-=Cn,$t==0?(we+=Cn,xe=!0):Ne=!0))}}),Ct[0]=xe,Ct[1]=Ye,Ct[2]=Ne,Ct[3]=Qe,Z-=Lt[1]+Lt[3],be+=Lt[3],he-=Lt[2]+Lt[0],we+=Lt[0]}function Ue(){let xe=be+Z,Ne=we+he,Ye=be,Qe=we;function ft(Et,$t){switch(Et){case 1:return xe+=$t,xe-$t;case 2:return Ne+=$t,Ne-$t;case 3:return Ye-=$t,Ye+$t;case 0:return Qe-=$t,Qe+$t}}A.forEach((Et,$t)=>{if(Et.show&&Et._show){let Qt=Et.side;Et._pos=ft(Qt,Et._size),Et.label!=null&&(Et._lpos=ft(Qt,Et.labelSize))}})}if(j.dataIdx==null){let xe=j.hover,Ne=xe.skip=new Set(xe.skip??[]);Ne.add(void 0);let Ye=xe.prox=ai(xe.prox),Qe=xe.bias??(xe.bias=0);j.dataIdx=(ft,Et,$t,Qt)=>{if(Et==0)return $t;let ln=$t,Mn=Ye(ft,Et,$t,Qt)??ts,Cn=Mn>=0&&Mn<ts,Pn=B.ori==0?Z:he,ar=j.left,Jr=e[0],lr=e[Et];if(Ne.has(lr[$t])){ln=null;let gr=null,$n=null,On;if(Qe==0||Qe==-1)for(On=$t;gr==null&&On-- >0;)Ne.has(lr[On])||(gr=On);if(Qe==0||Qe==1)for(On=$t;$n==null&&On++<lr.length;)Ne.has(lr[On])||($n=On);if(gr!=null||$n!=null)if(Cn){let Zn=gr==null?-1/0:V(Jr[gr],B,Pn,0),Ji=$n==null?1/0:V(Jr[$n],B,Pn,0),Os=ar-Zn,xi=Ji-ar;Os<=xi?Os<=Mn&&(ln=gr):xi<=Mn&&(ln=$n)}else ln=$n==null?gr:gr==null?$n:$t-gr<=$n-$t?gr:$n}else Cn&&da(ar-V(Jr[$t],B,Pn,0))>Mn&&(ln=null);return ln}}const rt=xe=>{j.event=xe};j.idxs=H,j._lock=!1;let ut=j.points;ut.show=ai(ut.show),ut.size=ai(ut.size),ut.stroke=ai(ut.stroke),ut.width=ai(ut.width),ut.fill=ai(ut.fill);const Dt=r.focus=Xo({},t.focus||{alpha:.3},j.focus),Rt=Dt.prox>=0,St=Rt&&ut.one;let Ht=[],en=[],Ut=[];function $e(xe,Ne){let Ye=ut.show(r,Ne);if(Ye instanceof HTMLElement)return eu(Ye,wpe),eu(Ye,xe.class),Lf(Ye,-10,-10,Z,he),b.insertBefore(Ye,Ht[Ne]),Ye}function dt(xe,Ne){if(i==1||Ne>0){let Ye=i==1&&N[xe.scale].time,Qe=xe.value;xe.value=Ye?SO(Qe)?NO($,AO(Qe,Q)):Qe||U:Qe||j0e,xe.label=xe.label||(Ye?N0e:A0e)}if(St||Ne>0){xe.width=xe.width==null?1:xe.width,xe.paths=xe.paths||Z0e||Bpe,xe.fillTo=ai(xe.fillTo||H0e),xe.pxAlign=+Ti(xe.pxAlign,_),xe.pxRound=zO(xe.pxAlign),xe.stroke=ai(xe.stroke||null),xe.fill=ai(xe.fill||null),xe._stroke=xe._fill=xe._paths=xe._focus=null;let Ye=z0e(ql(1,xe.width),1),Qe=xe.points=Xo({},{size:Ye,width:ql(1,Ye*.2),stroke:xe.stroke,space:Ye*2,paths:Q0e,_stroke:null,_fill:null},xe.points);Qe.show=ai(Qe.show),Qe.filter=ai(Qe.filter),Qe.fill=ai(Qe.fill),Qe.stroke=ai(Qe.stroke),Qe.paths=ai(Qe.paths),Qe.pxAlign=xe.pxAlign}if(le){let Ye=ce(xe,Ne);de.splice(Ne,0,Ye[0]),ye.splice(Ne,0,Ye[1]),X.values.push(null)}if(se){H.splice(Ne,0,null);let Ye=null;St?Ne==0&&(Ye=$e(xe,Ne)):Ne>0&&(Ye=$e(xe,Ne)),Ht.splice(Ne,0,Ye),en.splice(Ne,0,0),Ut.splice(Ne,0,0)}Is("addSeries",Ne)}function Tt(xe,Ne){Ne=Ne??C.length,xe=i==1?Wk(xe,Ne,RO,LO):Wk(xe,Ne,{},OO),C.splice(Ne,0,xe),dt(C[Ne],Ne)}r.addSeries=Tt;function Bt(xe){if(C.splice(xe,1),le){X.values.splice(xe,1),ye.splice(xe,1);let Ne=de.splice(xe,1)[0];Ge(null,Ne.firstChild),Ne.remove()}se&&(H.splice(xe,1),Ht.splice(xe,1)[0].remove(),en.splice(xe,1),Ut.splice(xe,1)),Is("delSeries",xe)}r.delSeries=Bt;const Ct=[!1,!1,!1,!1];function At(xe,Ne){if(xe._show=xe.show,xe.show){let Ye=xe.side%2,Qe=N[xe.scale];Qe==null&&(xe.scale=Ye?C[1].scale:R,Qe=N[xe.scale]);let ft=Qe.time;xe.size=ai(xe.size),xe.space=ai(xe.space),xe.rotate=ai(xe.rotate),j0(xe.incrs)&&xe.incrs.forEach($t=>{!fm.has($t)&&fm.set($t,s$($t))}),xe.incrs=ai(xe.incrs||(Qe.distr==2?c0e:ft?M==1?d0e:p0e:Bg)),xe.splits=ai(xe.splits||(ft&&Qe.distr==1?K:Qe.distr==3?Bk:Qe.distr==4?P0e:R0e)),xe.stroke=ai(xe.stroke),xe.grid.stroke=ai(xe.grid.stroke),xe.ticks.stroke=ai(xe.ticks.stroke),xe.border.stroke=ai(xe.border.stroke);let Et=xe.values;xe.values=j0(Et)&&!j0(Et[0])?ai(Et):ft?j0(Et)?EO($,CO(Et,Q)):SO(Et)?x0e($,Et):Et||re:Et||k0e,xe.filter=ai(xe.filter||(Qe.distr>=3&&Qe.log==10?O0e:Qe.distr==3&&Qe.log==2?L0e:r$)),xe.font=HO(xe.font),xe.labelFont=HO(xe.labelFont),xe._size=xe.size(r,null,Ne,0),xe._space=xe._rotate=xe._incrs=xe._found=xe._splits=xe._values=null,xe._size>0&&(Ct[Ne]=!0,xe._el=qu(ype,m))}}function Ot(xe,Ne,Ye,Qe){let[ft,Et,$t,Qt]=Ye,ln=Ne%2,Mn=0;return ln==0&&(Qt||Et)&&(Mn=Ne==0&&!ft||Ne==2&&!$t?ca(kO.size/3):0),ln==1&&(ft||$t)&&(Mn=Ne==1&&!Et||Ne==3&&!Qt?ca(DO.size/2):0),Mn}const cn=r.padding=(t.padding||[Ot,Ot,Ot,Ot]).map(xe=>ai(Ti(xe,Ot))),Lt=r._padding=cn.map((xe,Ne)=>xe(r,Ne,Ct,0));let wt,Zt=null,Jt=null;const vn=i==1?C[0].idxs:null;let Fn=null,_e=!1;function nt(xe,Ne){if(e=xe??[],r.data=r._data=e,i==2){wt=0;for(let Ye=1;Ye<C.length;Ye++)wt+=e[Ye][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),Fn=e[0],wt=Fn.length;let Ye=e;if(Y==2){Ye=e.slice();let Qe=Ye[0]=Array(wt);for(let ft=0;ft<wt;ft++)Qe[ft]=ft}r._data=e=Ye}if(ec(!0),Is("setData"),Y==2&&(ht=!0),Ne!==!1){let Ye=B;Ye.auto(r,_e)?mt():_o(R,Ye.min,Ye.max),ke=ke||j.left>=0,ct=!0,Qa()}}r.setData=nt;function mt(){_e=!0;let xe,Ne;i==1&&(wt>0?(Zt=vn[0]=0,Jt=vn[1]=wt-1,xe=e[0][Zt],Ne=e[0][Jt],Y==2?(xe=Zt,Ne=Jt):xe==Ne&&(Y==3?[xe,Ne]=aC(xe,xe,B.log,!1):Y==4?[xe,Ne]=y8(xe,xe,B.log,!1):B.time?Ne=xe+ca(86400/M):[xe,Ne]=K2(xe,Ne,b8,!0))):(Zt=vn[0]=xe=null,Jt=vn[1]=Ne=null)),_o(R,xe,Ne)}let xt,vt,qt,tn,Kt,Vt,dn,_n,An,rn;function Gn(xe,Ne,Ye,Qe,ft,Et){xe??(xe=sO),Ye??(Ye=S8),Qe??(Qe="butt"),ft??(ft=sO),Et??(Et="round"),xe!=xt&&(p.strokeStyle=xt=xe),ft!=vt&&(p.fillStyle=vt=ft),Ne!=qt&&(p.lineWidth=qt=Ne),Et!=Kt&&(p.lineJoin=Kt=Et),Qe!=Vt&&(p.lineCap=Vt=Qe),Ye!=tn&&p.setLineDash(tn=Ye)}function xr(xe,Ne,Ye,Qe){Ne!=vt&&(p.fillStyle=vt=Ne),xe!=dn&&(p.font=dn=xe),Ye!=_n&&(p.textAlign=_n=Ye),Qe!=An&&(p.textBaseline=An=Qe)}function sr(xe,Ne,Ye,Qe,ft=0){if(Qe.length>0&&xe.auto(r,_e)&&(Ne==null||Ne.min==null)){let Et=Ti(Zt,0),$t=Ti(Jt,Qe.length-1),Qt=Ye.min==null?Ope(Qe,Et,$t,ft,xe.distr==3):[Ye.min,Ye.max];xe.min=Qd(xe.min,Ye.min=Qt[0]),xe.max=ql(xe.max,Ye.max=Qt[1])}}const Xn={min:null,max:null};function dr(){for(let Qe in N){let ft=N[Qe];G[Qe]==null&&(ft.min==null||G[R]!=null&&ft.auto(r,_e))&&(G[Qe]=Xn)}for(let Qe in N){let ft=N[Qe];G[Qe]==null&&ft.from!=null&&G[ft.from]!=null&&(G[Qe]=Xn)}G[R]!=null&&ec(!0);let xe={};for(let Qe in G){let ft=G[Qe];if(ft!=null){let Et=xe[Qe]=hy(N[Qe],Gpe);if(ft.min!=null)Xo(Et,ft);else if(Qe!=R||i==2)if(wt==0&&Et.from==null){let $t=Et.range(r,null,null,Qe);Et.min=$t[0],Et.max=$t[1]}else Et.min=ts,Et.max=-ts}}if(wt>0){C.forEach((Qe,ft)=>{if(i==1){let Et=Qe.scale,$t=G[Et];if($t==null)return;let Qt=xe[Et];if(ft==0){let ln=Qt.range(r,Qt.min,Qt.max,Et);Qt.min=ln[0],Qt.max=ln[1],Zt=Kd(Qt.min,e[0]),Jt=Kd(Qt.max,e[0]),Jt-Zt>1&&(e[0][Zt]<Qt.min&&Zt++,e[0][Jt]>Qt.max&&Jt--),Qe.min=Fn[Zt],Qe.max=Fn[Jt]}else Qe.show&&Qe.auto&&sr(Qt,$t,Qe,e[ft],Qe.sorted);Qe.idxs[0]=Zt,Qe.idxs[1]=Jt}else if(ft>0&&Qe.show&&Qe.auto){let[Et,$t]=Qe.facets,Qt=Et.scale,ln=$t.scale,[Mn,Cn]=e[ft],Pn=xe[Qt],ar=xe[ln];Pn!=null&&sr(Pn,G[Qt],Et,Mn,Et.sorted),ar!=null&&sr(ar,G[ln],$t,Cn,$t.sorted),Qe.min=$t.min,Qe.max=$t.max}});for(let Qe in xe){let ft=xe[Qe],Et=G[Qe];if(ft.from==null&&(Et==null||Et.min==null)){let $t=ft.range(r,ft.min==ts?null:ft.min,ft.max==-ts?null:ft.max,Qe);ft.min=$t[0],ft.max=$t[1]}}}for(let Qe in xe){let ft=xe[Qe];if(ft.from!=null){let Et=xe[ft.from];if(Et.min==null)ft.min=ft.max=null;else{let $t=ft.range(r,Et.min,Et.max,Qe);ft.min=$t[0],ft.max=$t[1]}}}let Ne={},Ye=!1;for(let Qe in xe){let ft=xe[Qe],Et=N[Qe];if(Et.min!=ft.min||Et.max!=ft.max){Et.min=ft.min,Et.max=ft.max;let $t=Et.distr;Et._min=$t==3?mp(Et.min):$t==4?zA(Et.min,Et.asinh):$t==100?Et.fwd(Et.min):Et.min,Et._max=$t==3?mp(Et.max):$t==4?zA(Et.max,Et.asinh):$t==100?Et.fwd(Et.max):Et.max,Ne[Qe]=Ye=!0}}if(Ye){C.forEach((Qe,ft)=>{i==2?ft>0&&Ne.y&&(Qe._paths=null):Ne[Qe.scale]&&(Qe._paths=null)});for(let Qe in Ne)ht=!0,Is("setScale",Qe);se&&j.left>=0&&(ke=ct=!0)}for(let Qe in G)G[Qe]=null}function un(xe){let Ne=Uk(Zt-1,0,wt-1),Ye=Uk(Jt+1,0,wt-1);for(;xe[Ne]==null&&Ne>0;)Ne--;for(;xe[Ye]==null&&Ye<wt-1;)Ye++;return[Ne,Ye]}function ss(){if(wt>0){let xe=C.some(Ne=>Ne._focus)&&rn!=Dt.alpha;xe&&(p.globalAlpha=rn=Dt.alpha),C.forEach((Ne,Ye)=>{if(Ye>0&&Ne.show&&(Ln(Ye,!1),Ln(Ye,!0),Ne._paths==null)){let Qe=rn;rn!=Ne.alpha&&(p.globalAlpha=rn=Ne.alpha);let ft=i==2?[0,e[Ye][0].length-1]:un(e[Ye]);Ne._paths=Ne.paths(r,Ye,ft[0],ft[1]),rn!=Qe&&(p.globalAlpha=rn=Qe)}}),C.forEach((Ne,Ye)=>{if(Ye>0&&Ne.show){let Qe=rn;rn!=Ne.alpha&&(p.globalAlpha=rn=Ne.alpha),Ne._paths!=null&&vs(Ye,!1);{let ft=Ne._paths!=null?Ne._paths.gaps:null,Et=Ne.points.show(r,Ye,Zt,Jt,ft),$t=Ne.points.filter(r,Ye,Et,ft);(Et||$t)&&(Ne.points._paths=Ne.points.paths(r,Ye,Zt,Jt,$t),vs(Ye,!0))}rn!=Qe&&(p.globalAlpha=rn=Qe),Is("drawSeries",Ye)}}),xe&&(p.globalAlpha=rn=1)}}function Ln(xe,Ne){let Ye=Ne?C[xe].points:C[xe];Ye._stroke=Ye.stroke(r,xe),Ye._fill=Ye.fill(r,xe)}function vs(xe,Ne){let Ye=Ne?C[xe].points:C[xe],{stroke:Qe,fill:ft,clip:Et,flags:$t,_stroke:Qt=Ye._stroke,_fill:ln=Ye._fill,_width:Mn=Ye.width}=Ye._paths;Mn=ns(Mn*Ri,3);let Cn=null,Pn=Mn%2/2;Ne&&ln==null&&(ln=Mn>0?"#fff":Qt);let ar=Ye.pxAlign==1&&Pn>0;if(ar&&p.translate(Pn,Pn),!Ne){let Jr=qe-Mn/2,lr=Fe-Mn/2,gr=Ke+Mn,$n=je+Mn;Cn=new Path2D,Cn.rect(Jr,lr,gr,$n)}Ne?ys(Qt,Mn,Ye.dash,Ye.cap,ln,Qe,ft,$t,Et):Rs(xe,Qt,Mn,Ye.dash,Ye.cap,ln,Qe,ft,$t,Cn,Et),ar&&p.translate(-Pn,-Pn)}function Rs(xe,Ne,Ye,Qe,ft,Et,$t,Qt,ln,Mn,Cn){let Pn=!1;ln!=0&&D.forEach((ar,Jr)=>{if(ar.series[0]==xe){let lr=C[ar.series[1]],gr=e[ar.series[1]],$n=(lr._paths||X_).band;j0($n)&&($n=ar.dir==1?$n[0]:$n[1]);let On,Zn=null;lr.show&&$n&&jpe(gr,Zt,Jt)?(Zn=ar.fill(r,Jr)||Et,On=lr._paths.clip):$n=null,ys(Ne,Ye,Qe,ft,Zn,$t,Qt,ln,Mn,Cn,On,$n),Pn=!0}}),Pn||ys(Ne,Ye,Qe,ft,Et,$t,Qt,ln,Mn,Cn)}const Li=py|Vk;function ys(xe,Ne,Ye,Qe,ft,Et,$t,Qt,ln,Mn,Cn,Pn){Gn(xe,Ne,Ye,Qe,ft),(ln||Mn||Pn)&&(p.save(),ln&&p.clip(ln),Mn&&p.clip(Mn)),Pn?(Qt&Li)==Li?(p.clip(Pn),Cn&&p.clip(Cn),pi(ft,$t),_r(xe,Et,Ne)):Qt&Vk?(pi(ft,$t),p.clip(Pn),_r(xe,Et,Ne)):Qt&py&&(p.save(),p.clip(Pn),Cn&&p.clip(Cn),pi(ft,$t),p.restore(),_r(xe,Et,Ne)):(pi(ft,$t),_r(xe,Et,Ne)),(ln||Mn||Pn)&&p.restore()}function _r(xe,Ne,Ye){Ye>0&&(Ne instanceof Map?Ne.forEach((Qe,ft)=>{p.strokeStyle=xt=ft,p.stroke(Qe)}):Ne!=null&&xe&&p.stroke(Ne))}function pi(xe,Ne){Ne instanceof Map?Ne.forEach((Ye,Qe)=>{p.fillStyle=vt=Qe,p.fill(Ye)}):Ne!=null&&xe&&p.fill(Ne)}function Ps(xe,Ne,Ye,Qe){let ft=A[xe],Et;if(Qe<=0)Et=[0,0];else{let $t=ft._space=ft.space(r,xe,Ne,Ye,Qe),Qt=ft._incrs=ft.incrs(r,xe,Ne,Ye,Qe,$t);Et=ime(Ne,Ye,Qt,Qe,$t)}return ft._found=Et}function ji(xe,Ne,Ye,Qe,ft,Et,$t,Qt,ln,Mn){let Cn=$t%2/2;_==1&&p.translate(Cn,Cn),Gn(Qt,$t,ln,Mn,Qt),p.beginPath();let Pn,ar,Jr,lr,gr=ft+(Qe==0||Qe==3?-Et:Et);Ye==0?(ar=ft,lr=gr):(Pn=ft,Jr=gr);for(let $n=0;$n<xe.length;$n++)Ne[$n]!=null&&(Ye==0?Pn=Jr=xe[$n]:ar=lr=xe[$n],p.moveTo(Pn,ar),p.lineTo(Jr,lr));p.stroke(),_==1&&p.translate(-Cn,-Cn)}function ea(xe){let Ne=!0;return A.forEach((Ye,Qe)=>{if(!Ye.show)return;let ft=N[Ye.scale];if(ft.min==null){Ye._show&&(Ne=!1,Ye._show=!1,ec(!1));return}else Ye._show||(Ne=!1,Ye._show=!0,ec(!1));let Et=Ye.side,$t=Et%2,{min:Qt,max:ln}=ft,[Mn,Cn]=Ps(Qe,Qt,ln,$t==0?Z:he);if(Cn==0)return;let Pn=ft.distr==2,ar=Ye._splits=Ye.splits(r,Qe,Qt,ln,Mn,Cn,Pn),Jr=ft.distr==2?ar.map(On=>Fn[On]):ar,lr=ft.distr==2?Fn[ar[1]]-Fn[ar[0]]:Mn,gr=Ye._values=Ye.values(r,Ye.filter(r,Jr,Qe,Cn,lr),Qe,Cn,lr);Ye._rotate=Et==2?Ye.rotate(r,gr,Qe,Cn):0;let $n=Ye._size;Ye._size=Ju(Ye.size(r,gr,Qe,xe)),$n!=null&&Ye._size!=$n&&(Ne=!1)}),Ne}function va(xe){let Ne=!0;return cn.forEach((Ye,Qe)=>{let ft=Ye(r,Qe,Ct,xe);ft!=Lt[Qe]&&(Ne=!1),Lt[Qe]=ft}),Ne}function ka(){for(let xe=0;xe<A.length;xe++){let Ne=A[xe];if(!Ne.show||!Ne._show)continue;let Ye=Ne.side,Qe=Ye%2,ft,Et,$t=Ne.stroke(r,xe),Qt=Ye==0||Ye==3?-1:1,[ln,Mn]=Ne._found;if(Ne.label!=null){let fo=Ne.labelGap*Qt,wo=ca((Ne._lpos+fo)*Ri);xr(Ne.labelFont[0],$t,"center",Ye==2?o_:iO),p.save(),Qe==1?(ft=Et=0,p.translate(wo,ca(Fe+je/2)),p.rotate((Ye==3?-s2:s2)/2)):(ft=ca(qe+Ke/2),Et=wo);let Wc=t$(Ne.label)?Ne.label(r,xe,ln,Mn):Ne.label;p.fillText(Wc,ft,Et),p.restore()}if(Mn==0)continue;let Cn=N[Ne.scale],Pn=Qe==0?Ke:je,ar=Qe==0?qe:Fe,Jr=Ne._splits,lr=Cn.distr==2?Jr.map(fo=>Fn[fo]):Jr,gr=Cn.distr==2?Fn[Jr[1]]-Fn[Jr[0]]:ln,$n=Ne.ticks,On=Ne.border,Zn=$n.show?$n.size:0,Ji=ca(Zn*Ri),Os=ca((Ne.alignTo==2?Ne._size-Zn-Ne.gap:Ne.gap)*Ri),xi=Ne._rotate*-s2/180,ci=S(Ne._pos*Ri),os=(Ji+Os)*Qt,Ls=ci+os;Et=Qe==0?Ls:0,ft=Qe==1?Ls:0;let ra=Ne.font[0],jo=Ne.align==1?Fv:Ne.align==2?OA:xi>0?Fv:xi<0?OA:Qe==0?"center":Ye==3?OA:Fv,Wi=xi||Qe==1?"middle":Ye==2?o_:iO;xr(ra,$t,jo,Wi);let $s=Ne.font[1]*Ne.lineGap,zo=Jr.map(fo=>S(a(fo,Cn,Pn,ar))),Ia=Ne._values;for(let fo=0;fo<Ia.length;fo++){let wo=Ia[fo];if(wo!=null){Qe==0?ft=zo[fo]:Et=zo[fo],wo=""+wo;let Wc=wo.indexOf(`
`)==-1?[wo]:wo.split(/\n/gm);for(let Fo=0;Fo<Wc.length;Fo++){let Gx=Wc[Fo];xi?(p.save(),p.translate(ft,Et+Fo*$s),p.rotate(xi),p.fillText(Gx,0,0),p.restore()):p.fillText(Gx,ft,Et+Fo*$s)}}}$n.show&&ji(zo,$n.filter(r,lr,xe,Mn,gr),Qe,Ye,ci,Ji,ns($n.width*Ri,3),$n.stroke(r,xe),$n.dash,$n.cap);let uo=Ne.grid;uo.show&&ji(zo,uo.filter(r,lr,xe,Mn,gr),Qe,Qe==0?2:1,Qe==0?Fe:qe,Qe==0?je:Ke,ns(uo.width*Ri,3),uo.stroke(r,xe),uo.dash,uo.cap),On.show&&ji([ci],[1],Qe==0?1:0,Qe==0?1:2,Qe==1?Fe:qe,Qe==1?je:Ke,ns(On.width*Ri,3),On.stroke(r,xe),On.dash,On.cap)}Is("drawAxes")}function ec(xe){C.forEach((Ne,Ye)=>{Ye>0&&(Ne._paths=null,xe&&(i==1?(Ne.min=null,Ne.max=null):Ne.facets.forEach(Qe=>{Qe.min=null,Qe.max=null})))})}let Ml=!1,ya=!1,Ds=[];function tc(){ya=!1;for(let xe=0;xe<Ds.length;xe++)Is(...Ds[xe]);Ds.length=0}function Qa(){Ml||(Zpe(Pa),Ml=!0)}function Ra(xe,Ne=!1){Ml=!0,ya=Ne,xe(r),Pa(),Ne&&Ds.length>0&&queueMicrotask(tc)}r.batch=Ra;function Pa(){if(Te&&(dr(),Te=!1),ht&&(Ee(),ht=!1),Xe){if(ks(x,Fv,be),ks(x,o_,we),ks(x,P_,Z),ks(x,D_,he),ks(b,Fv,be),ks(b,o_,we),ks(b,P_,Z),ks(b,D_,he),ks(m,P_,We),ks(m,D_,ae),d.width=ca(We*Ri),d.height=ca(ae*Ri),A.forEach(({_el:xe,_show:Ne,_size:Ye,_pos:Qe,side:ft})=>{if(xe!=null)if(Ne){let Et=ft===3||ft===0?Ye:0,$t=ft%2==1;ks(xe,$t?"left":"top",Qe-Et),ks(xe,$t?"width":"height",Ye),ks(xe,$t?"top":"left",$t?we:be),ks(xe,$t?"height":"width",$t?he:Z),zk(xe,Wg)}else eu(xe,Wg)}),xt=vt=qt=Kt=Vt=dn=_n=An=tn=null,rn=1,Sd(!0),be!=ve||we!=Re||Z!=Ae||he!=Oe){ec(!1);let xe=Z/Ae,Ne=he/Oe;if(se&&!ke&&j.left>=0){j.left*=xe,j.top*=Ne,ta&&Lf(ta,ca(j.left),0,Z,he),co&&Lf(co,0,ca(j.top),Z,he);for(let Ye=0;Ye<Ht.length;Ye++){let Qe=Ht[Ye];Qe!=null&&(en[Ye]*=xe,Ut[Ye]*=Ne,Lf(Qe,Ju(en[Ye]),Ju(Ut[Ye]),Z,he))}}if(Kr.show&&!et&&Kr.left>=0&&Kr.width>0){Kr.left*=xe,Kr.width*=xe,Kr.top*=Ne,Kr.height*=Ne;for(let Ye in Fm)ks(Da,Ye,Kr[Ye])}ve=be,Re=we,Ae=Z,Oe=he}Is("setSize"),Xe=!1}We>0&&ae>0&&(p.clearRect(0,0,d.width,d.height),Is("drawClear"),k.forEach(xe=>xe()),Is("draw")),Kr.show&&et&&(Cl(Kr),et=!1),se&&ke&&(ic(null,!0,!1),ke=!1),X.show&&X.live&&ct&&(jp(),ct=!1),l||(l=!0,r.status=1,Is("ready")),_e=!1,Ml=!1}r.redraw=(xe,Ne)=>{ht=Ne||!1,xe!==!1?_o(R,B.min,B.max):Qa()};function Bc(xe,Ne){let Ye=N[xe];if(Ye.from==null){if(wt==0){let Qe=Ye.range(r,Ne.min,Ne.max,xe);Ne.min=Qe[0],Ne.max=Qe[1]}if(Ne.min>Ne.max){let Qe=Ne.min;Ne.min=Ne.max,Ne.max=Qe}if(wt>1&&Ne.min!=null&&Ne.max!=null&&Ne.max-Ne.min<1e-16)return;xe==R&&Ye.distr==2&&wt>0&&(Ne.min=Kd(Ne.min,e[0]),Ne.max=Kd(Ne.max,e[0]),Ne.min==Ne.max&&Ne.max++),G[xe]=Ne,Te=!0,Qa()}}r.setScale=Bc;let Hc,nc,ta,co,Lo,Tl,bs,Ja,el,Vc,ii,Wr,na=!1;const Sr=j.drag;let Si=Sr.x,zi=Sr.y;se&&(j.x&&(Hc=qu(_pe,b)),j.y&&(nc=qu(Spe,b)),B.ori==0?(ta=Hc,co=nc):(ta=nc,co=Hc),ii=j.left,Wr=j.top);const Kr=r.select=Xo({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Da=Kr.show?qu(bpe,Kr.over?b:x):null;function Cl(xe,Ne){if(Kr.show){for(let Ye in xe)Kr[Ye]=xe[Ye],Ye in Fm&&ks(Da,Ye,xe[Ye]);Ne!==!1&&Is("setSelect")}}r.setSelect=Cl;function rc(xe){if(C[xe].show)le&&zk(de[xe],Wg);else if(le&&eu(de[xe],Wg),se){let Ye=St?Ht[0]:Ht[xe];Ye!=null&&Lf(Ye,-10,-10,Z,he)}}function _o(xe,Ne,Ye){Bc(xe,{min:Ne,max:Ye})}function gi(xe,Ne,Ye,Qe){Ne.focus!=null&&El(xe),Ne.show!=null&&C.forEach((ft,Et)=>{Et>0&&(xe==Et||xe==null)&&(ft.show=Ne.show,rc(Et),i==2?(_o(ft.facets[0].scale,null,null),_o(ft.facets[1].scale,null,null)):_o(ft.scale,null,null),Qa())}),Ye!==!1&&Is("setSeries",xe,Ne),Qe&&Td("setSeries",r,xe,Ne)}r.setSeries=gi;function Ch(xe,Ne){Xo(D[xe],Ne)}function vd(xe,Ne){xe.fill=ai(xe.fill||null),xe.dir=Ti(xe.dir,-1),Ne=Ne??D.length,D.splice(Ne,0,xe)}function yd(xe){xe==null?D.length=0:D.splice(xe,1)}r.addBand=vd,r.setBand=Ch,r.delBand=yd;function cf(xe,Ne){C[xe].alpha=Ne,se&&Ht[xe]!=null&&(Ht[xe].style.opacity=Ne),le&&de[xe]&&(de[xe].style.opacity=Ne)}let ba,qi,Gs;const _s={focus:!0};function El(xe){if(xe!=Gs){let Ne=xe==null,Ye=Dt.alpha!=1;C.forEach((Qe,ft)=>{if(i==1||ft>0){let Et=Ne||ft==0||ft==xe;Qe._focus=Ne?null:Et,Ye&&cf(ft,Et?1:Dt.alpha)}}),Gs=xe,Ye&&Qa()}}le&&Rt&&Be(lO,ee,xe=>{j._lock||(rt(xe),Gs!=null&&gi(null,_s,!0,Ss.setSeries))});function So(xe,Ne,Ye){let Qe=N[Ne];Ye&&(xe=xe/Ri-(Qe.ori==1?we:be));let ft=Z;Qe.ori==1&&(ft=he,xe=ft-xe),Qe.dir==-1&&(xe=ft-xe);let Et=Qe._min,$t=Qe._max,Qt=xe/ft,ln=Et+($t-Et)*Qt,Mn=Qe.distr;return Mn==3?dy(10,ln):Mn==4?Fpe(ln,Qe.asinh):Mn==100?Qe.bwd(ln):ln}function Op(xe,Ne){let Ye=So(xe,R,Ne);return Kd(Ye,e[0],Zt,Jt)}r.valToIdx=xe=>Kd(xe,e[0]),r.posToIdx=Op,r.posToVal=So,r.valToPos=(xe,Ne,Ye)=>N[Ne].ori==0?s(xe,N[Ne],Ye?Ke:Z,Ye?qe:0):o(xe,N[Ne],Ye?je:he,Ye?Fe:0),r.setCursor=(xe,Ne,Ye)=>{ii=xe.left,Wr=xe.top,ic(null,Ne,Ye)};function Eh(xe,Ne){ks(Da,Fv,Kr.left=xe),ks(Da,P_,Kr.width=Ne)}function jm(xe,Ne){ks(Da,o_,Kr.top=xe),ks(Da,D_,Kr.height=Ne)}let uf=B.ori==0?Eh:jm,bd=B.ori==1?Eh:jm;function Lp(){if(le&&X.live)for(let xe=i==2?1:0;xe<C.length;xe++){if(xe==0&&Me)continue;let Ne=X.values[xe],Ye=0;for(let Qe in Ne)ye[xe][Ye++].firstChild.nodeValue=Ne[Qe]}}function jp(xe,Ne){if(xe!=null&&(xe.idxs?xe.idxs.forEach((Ye,Qe)=>{H[Qe]=Ye}):Vpe(xe.idx)||H.fill(xe.idx),X.idx=H[0]),le&&X.live){for(let Ye=0;Ye<C.length;Ye++)(Ye>0||i==1&&!Me)&&_d(Ye,H[Ye]);Lp()}ct=!1,Ne!==!1&&Is("setLegend")}r.setLegend=jp;function _d(xe,Ne){let Ye=C[xe],Qe=xe==0&&Y==2?Fn:e[xe],ft;Me?ft=Ye.values(r,xe,Ne)??fe:(ft=Ye.value(r,Ne==null?null:Qe[Ne],xe,Ne),ft=ft==null?fe:{_:ft}),X.values[xe]=ft}function ic(xe,Ne,Ye){el=ii,Vc=Wr,[ii,Wr]=j.move(r,ii,Wr),j.left=ii,j.top=Wr,se&&(ta&&Lf(ta,ca(ii),0,Z,he),co&&Lf(co,0,ca(Wr),Z,he));let Qe,ft=Zt>Jt;ba=ts,qi=null;let Et=B.ori==0?Z:he,$t=B.ori==1?Z:he;if(ii<0||wt==0||ft){Qe=j.idx=null;for(let Qt=0;Qt<C.length;Qt++){let ln=Ht[Qt];ln!=null&&Lf(ln,-10,-10,Z,he)}Rt&&gi(null,_s,!0,xe==null&&Ss.setSeries),X.live&&(H.fill(Qe),ct=!0)}else{let Qt,ln,Mn;i==1&&(Qt=B.ori==0?ii:Wr,ln=So(Qt,R),Qe=j.idx=Kd(ln,e[0],Zt,Jt),Mn=V(e[0][Qe],B,Et,0));let Cn=-10,Pn=-10,ar=0,Jr=0,lr=!0,gr="",$n="";for(let On=i==2?1:0;On<C.length;On++){let Zn=C[On],Ji=H[On],Os=Ji==null?null:i==1?e[On][Ji]:e[On][1][Ji],xi=j.dataIdx(r,On,Qe,ln),ci=xi==null?null:i==1?e[On][xi]:e[On][1][xi];if(ct=ct||ci!=Os||xi!=Ji,H[On]=xi,On>0&&Zn.show){let os=xi==null?-10:xi==Qe?Mn:V(i==1?e[0][xi]:e[On][0][xi],B,Et,0),Ls=ci==null?-10:q(ci,i==1?N[Zn.scale]:N[Zn.facets[1].scale],$t,0);if(Rt&&ci!=null){let ra=B.ori==1?ii:Wr,jo=da(Dt.dist(r,On,xi,Ls,ra));if(jo<ba){let Wi=Dt.bias;if(Wi!=0){let $s=So(ra,Zn.scale),zo=ci>=0?1:-1,Ia=$s>=0?1:-1;Ia==zo&&(Ia==1?Wi==1?ci>=$s:ci<=$s:Wi==1?ci<=$s:ci>=$s)&&(ba=jo,qi=On)}else ba=jo,qi=On}}if(ct||St){let ra,jo;B.ori==0?(ra=os,jo=Ls):(ra=Ls,jo=os);let Wi,$s,zo,Ia,uo,fo,wo=!0,Wc=ut.bbox;if(Wc!=null){wo=!1;let Fo=Wc(r,On);zo=Fo.left,Ia=Fo.top,Wi=Fo.width,$s=Fo.height}else zo=ra,Ia=jo,Wi=$s=ut.size(r,On);if(fo=ut.fill(r,On),uo=ut.stroke(r,On),St)On==qi&&ba<=Dt.prox&&(Cn=zo,Pn=Ia,ar=Wi,Jr=$s,lr=wo,gr=fo,$n=uo);else{let Fo=Ht[On];Fo!=null&&(en[On]=zo,Ut[On]=Ia,mO(Fo,Wi,$s,wo),hO(Fo,fo,uo),Lf(Fo,Ju(zo),Ju(Ia),Z,he))}}}}if(St){let On=Dt.prox,Zn=Gs==null?ba<=On:ba>On||qi!=Gs;if(ct||Zn){let Ji=Ht[0];Ji!=null&&(en[0]=Cn,Ut[0]=Pn,mO(Ji,ar,Jr,lr),hO(Ji,gr,$n),Lf(Ji,Ju(Cn),Ju(Pn),Z,he))}}}if(Kr.show&&na)if(xe!=null){let[Qt,ln]=Ss.scales,[Mn,Cn]=Ss.match,[Pn,ar]=xe.cursor.sync.scales,Jr=xe.cursor.drag;if(Si=Jr._x,zi=Jr._y,Si||zi){let{left:lr,top:gr,width:$n,height:On}=xe.select,Zn=xe.scales[Pn].ori,Ji=xe.posToVal,Os,xi,ci,os,Ls,ra=Qt!=null&&Mn(Qt,Pn),jo=ln!=null&&Cn(ln,ar);ra&&Si?(Zn==0?(Os=lr,xi=$n):(Os=gr,xi=On),ci=N[Qt],os=V(Ji(Os,Pn),ci,Et,0),Ls=V(Ji(Os+xi,Pn),ci,Et,0),uf(Qd(os,Ls),da(Ls-os))):uf(0,Et),jo&&zi?(Zn==1?(Os=lr,xi=$n):(Os=gr,xi=On),ci=N[ln],os=q(Ji(Os,ar),ci,$t,0),Ls=q(Ji(Os+xi,ar),ci,$t,0),bd(Qd(os,Ls),da(Ls-os))):bd(0,$t)}else Ws()}else{let Qt=da(el-Lo),ln=da(Vc-Tl);if(B.ori==1){let ar=Qt;Qt=ln,ln=ar}Si=Sr.x&&Qt>=Sr.dist,zi=Sr.y&&ln>=Sr.dist;let Mn=Sr.uni;Mn!=null?Si&&zi&&(Si=Qt>=Mn,zi=ln>=Mn,!Si&&!zi&&(ln>Qt?zi=!0:Si=!0)):Sr.x&&Sr.y&&(Si||zi)&&(Si=zi=!0);let Cn,Pn;Si&&(B.ori==0?(Cn=bs,Pn=ii):(Cn=Ja,Pn=Wr),uf(Qd(Cn,Pn),da(Pn-Cn)),zi||bd(0,$t)),zi&&(B.ori==1?(Cn=bs,Pn=ii):(Cn=Ja,Pn=Wr),bd(Qd(Cn,Pn),da(Pn-Cn)),Si||uf(0,Et)),!Si&&!zi&&(uf(0,0),bd(0,0))}if(Sr._x=Si,Sr._y=zi,xe==null){if(Ye){if(Bp!=null){let[Qt,ln]=Ss.scales;Ss.values[0]=Qt!=null?So(B.ori==0?ii:Wr,Qt):null,Ss.values[1]=ln!=null?So(B.ori==1?ii:Wr,ln):null}Td(LA,r,ii,Wr,Z,he,Qe)}if(Rt){let Qt=Ye&&Ss.setSeries,ln=Dt.prox;Gs==null?ba<=ln&&gi(qi,_s,!0,Qt):ba>ln?gi(null,_s,!0,Qt):qi!=Gs&&gi(qi,_s,!0,Qt)}}ct&&(X.idx=Qe,jp()),Ne!==!1&&Is("setCursor")}let sc=null;Object.defineProperty(r,"rect",{get(){return sc==null&&Sd(!1),sc}});function Sd(xe=!1){xe?sc=null:(sc=b.getBoundingClientRect(),Is("syncRect",sc))}function zm(xe,Ne,Ye,Qe,ft,Et,$t){j._lock||na&&xe!=null&&xe.movementX==0&&xe.movementY==0||(zp(xe,Ne,Ye,Qe,ft,Et,$t,!1,xe!=null),xe!=null?ic(null,!0,!0):ic(Ne,!0,!1))}function zp(xe,Ne,Ye,Qe,ft,Et,$t,Qt,ln){if(sc==null&&Sd(!1),rt(xe),xe!=null)Ye=xe.clientX-sc.left,Qe=xe.clientY-sc.top;else{if(Ye<0||Qe<0){ii=-10,Wr=-10;return}let[Mn,Cn]=Ss.scales,Pn=Ne.cursor.sync,[ar,Jr]=Pn.values,[lr,gr]=Pn.scales,[$n,On]=Ss.match,Zn=Ne.axes[0].side%2==1,Ji=B.ori==0?Z:he,Os=B.ori==1?Z:he,xi=Zn?Et:ft,ci=Zn?ft:Et,os=Zn?Qe:Ye,Ls=Zn?Ye:Qe;if(lr!=null?Ye=$n(Mn,lr)?a(ar,N[Mn],Ji,0):-10:Ye=Ji*(os/xi),gr!=null?Qe=On(Cn,gr)?a(Jr,N[Cn],Os,0):-10:Qe=Os*(Ls/ci),B.ori==1){let ra=Ye;Ye=Qe,Qe=ra}}ln&&(Ne==null||Ne.cursor.event.type==LA)&&((Ye<=1||Ye>=Z-1)&&(Ye=Ug(Ye,Z)),(Qe<=1||Qe>=he-1)&&(Qe=Ug(Qe,he))),Qt?(Lo=Ye,Tl=Qe,[bs,Ja]=j.move(r,Ye,Qe)):(ii=Ye,Wr=Qe)}const Fm={width:0,height:0,left:0,top:0};function Ws(){Cl(Fm,!1)}let Um,Bm,Hm,Vm;function wu(xe,Ne,Ye,Qe,ft,Et,$t){na=!0,Si=zi=Sr._x=Sr._y=!1,zp(xe,Ne,Ye,Qe,ft,Et,$t,!0,!1),xe!=null&&(Be(jA,Lk,wd,!1),Td(oO,r,bs,Ja,Z,he,null));let{left:Qt,top:ln,width:Mn,height:Cn}=Kr;Um=Qt,Bm=ln,Hm=Mn,Vm=Cn}function wd(xe,Ne,Ye,Qe,ft,Et,$t){na=Sr._x=Sr._y=!1,zp(xe,Ne,Ye,Qe,ft,Et,$t,!1,!0);let{left:Qt,top:ln,width:Mn,height:Cn}=Kr,Pn=Mn>0||Cn>0,ar=Um!=Qt||Bm!=ln||Hm!=Mn||Vm!=Cn;if(Pn&&ar&&Cl(Kr),Sr.setScale&&Pn&&ar){let Jr=Qt,lr=Mn,gr=ln,$n=Cn;if(B.ori==1&&(Jr=ln,lr=Cn,gr=Qt,$n=Mn),Si&&_o(R,So(Jr,R),So(Jr+lr,R)),zi)for(let On in N){let Zn=N[On];On!=R&&Zn.from==null&&Zn.min!=ts&&_o(On,So(gr+$n,On),So(gr,On))}Ws()}else j.lock&&(j._lock=!j._lock,ic(Ne,!0,xe!=null));xe!=null&&(Ge(jA,Lk),Td(jA,r,ii,Wr,Z,he,null))}function Fp(xe,Ne,Ye,Qe,ft,Et,$t){if(j._lock)return;rt(xe);let Qt=na;if(na){let ln=!0,Mn=!0,Cn=10,Pn,ar;B.ori==0?(Pn=Si,ar=zi):(Pn=zi,ar=Si),Pn&&ar&&(ln=ii<=Cn||ii>=Z-Cn,Mn=Wr<=Cn||Wr>=he-Cn),Pn&&ln&&(ii=ii<bs?0:Z),ar&&Mn&&(Wr=Wr<Ja?0:he),ic(null,!0,!0),na=!1}ii=-10,Wr=-10,H.fill(null),ic(null,!0,!0),Qt&&(na=Qt)}function Up(xe,Ne,Ye,Qe,ft,Et,$t){j._lock||(rt(xe),mt(),Ws(),xe!=null&&Td(cO,r,ii,Wr,Z,he,null))}function Gm(){A.forEach(sme),yt(r.width,r.height,!0)}cx(Y2,k1,Gm);const oc={};oc.mousedown=wu,oc.mousemove=zm,oc.mouseup=wd,oc.dblclick=Up,oc.setSeries=(xe,Ne,Ye,Qe)=>{let ft=Ss.match[2];Ye=ft(r,Ne,Ye),Ye!=-1&&gi(Ye,Qe,!0,!1)},se&&(Be(oO,b,wu),Be(LA,b,zm),Be(aO,b,xe=>{rt(xe),Sd(!1)}),Be(lO,b,Fp),Be(cO,b,Up),Gk.add(r),r.syncRect=Sd);const Md=r.hooks=t.hooks||{};function Is(xe,Ne,Ye){ya?Ds.push([xe,Ne,Ye]):xe in Md&&Md[xe].forEach(Qe=>{Qe.call(null,r,Ne,Ye)})}(t.plugins||[]).forEach(xe=>{for(let Ne in xe.hooks)Md[Ne]=(Md[Ne]||[]).concat(xe.hooks[Ne])});const Mu=(xe,Ne,Ye)=>Ye,Ss=Xo({key:null,setSeries:!1,filters:{pub:bO,sub:bO},scales:[R,C[1]?C[1].scale:null],match:[_O,_O,Mu],values:[null,null]},j.sync);Ss.match.length==2&&Ss.match.push(Mu),j.sync=Ss;const Bp=Ss.key,Ah=T$(Bp);function Td(xe,Ne,Ye,Qe,ft,Et,$t){Ss.filters.pub(xe,Ne,Ye,Qe,ft,Et,$t)&&Ah.pub(xe,Ne,Ye,Qe,ft,Et,$t)}Ah.sub(r);function Hp(xe,Ne,Ye,Qe,ft,Et,$t){Ss.filters.sub(xe,Ne,Ye,Qe,ft,Et,$t)&&oc[xe](null,Ne,Ye,Qe,ft,Et,$t)}r.pub=Hp;function Tu(){Ah.unsub(r),Gk.delete(r),He.clear(),Fk(Y2,k1,Gm),c.remove(),ee==null||ee.remove(),Is("destroy")}r.destroy=Tu;function Gc(){Is("init",t,e),nt(e||t.data,!1),G[R]?Bc(R,G[R]):mt(),et=Kr.show&&(Kr.width>0||Kr.height>0),ke=ct=!0,yt(t.width,t.height)}return C.forEach(dt),A.forEach(At),n?n instanceof HTMLElement?(n.appendChild(c),Gc()):n(r,Gc):Gc(),r}ps.assign=Xo;ps.fmtNum=_8;ps.rangeNum=K2;ps.rangeLog=aC;ps.rangeAsinh=y8;ps.orient=Dx;ps.pxRatio=Ri;ps.join=Kpe;ps.fmtDate=w8,ps.tzDate=a0e;ps.sync=T$;{ps.addGap=V0e,ps.clipGaps=uC;let t=ps.paths={points:R$};t.linear=D$,t.stepped=$0e,t.bars=q0e,t.spline=Y0e}const ome=new Set(["timing_save_batch_total","timing_avg_inference_time","timing_avg_compute_reward_time","timing_compute_reward_normal_pct","timing_compute_reward_discarded_pct","timing_compute_reward_canceled_pct","timing_compute_reward_all_pct"]),k8=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 ko({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(qa,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ix(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?$l.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function Ox({isFullscreen:t,onClick:e}){return f.jsx("button",{onClick:e,className:bt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?f.jsx($T,{className:"h-3 w-3"}):f.jsx(WT,{className:"h-3 w-3"})})}function pC(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 j$(t){return t.split("/").pop()||t}function Sp(t){var n;return((n=t.runName)==null?void 0:n.trim())||j$(t.runPath)}const ame=C1-1,VO="max-w-[190px]";function O_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function lme(t){const e=O_(t),{isTruncated:n,prefix:r,suffix:i}=mW(t,ame);return n?`<span class="inline-flex ${VO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${O_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${O_(i)}</span></span>`:`<span class="inline-block ${VO} truncate align-bottom" title="${e}">${O_(r)}</span>`}function Iw(t){const e=lme(Sp(t)),n=O_(j$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function z$(t){const e=Math.abs(t);if(e>=60)return eC(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 ud(t)}const cme=28;function ume(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 k4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const dme={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 fme(t){const e={...dme};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:hme(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function hme(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const F$=["mean","std","min","max"],U$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function Lx(t,e){const n=typeof IntersectionObserver>"u",[r,i]=w.useState(n),[s,o]=w.useState(n),a=w.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 w.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 pme({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:o=null,availableRewardNames:a=[],availableSampleTags:l,availableEnvs:c,customMetricSections:d={},xAxisMode:p="step",scrollRoot:m=null,evalsList:x=[]}){var Fe,Ke,je,Te,Xe,ht,ke,et,ct,yt,lt,Je,Ee,Ze,Ie,Ue,rt,ut,Dt,Rt;const[b,_]=w.useState({}),[S,M]=w.useState(!0),[C,A]=w.useState(!0),[N,D]=w.useState(!0),[R,L]=w.useState(!0),[k,O]=w.useState({}),[F,B]=w.useState(!0),[Y,V]=w.useState(!0),[q,G]=w.useState(!0),[$,Q]=w.useState(!0),[K,re]=w.useState(!0),[U,H]=w.useState(!0),X=w.useMemo(()=>fme(a),[a]),j=p==="time",le=Vr(((Fe=t[0])==null?void 0:Fe.runPath)||"",j&&!!t[0],e),se=Vr(((Ke=t[1])==null?void 0:Ke.runPath)||"",j&&!!t[1],e),J=Vr(((je=t[2])==null?void 0:je.runPath)||"",j&&!!t[2],e),ee=Vr(((Te=t[3])==null?void 0:Te.runPath)||"",j&&!!t[3],e),ie=Vr(((Xe=t[4])==null?void 0:Xe.runPath)||"",j&&!!t[4],e),oe=Vr(((ht=t[5])==null?void 0:ht.runPath)||"",j&&!!t[5],e),de=Vr(((ke=t[6])==null?void 0:ke.runPath)||"",j&&!!t[6],e),ye=Vr(((et=t[7])==null?void 0:et.runPath)||"",j&&!!t[7],e),ge=Vr(((ct=t[8])==null?void 0:ct.runPath)||"",j&&!!t[8],e),Me=Vr(((yt=t[9])==null?void 0:yt.runPath)||"",j&&!!t[9],e),fe=Vr(((lt=t[10])==null?void 0:lt.runPath)||"",j&&!!t[10],e),Se=Vr(((Je=t[11])==null?void 0:Je.runPath)||"",j&&!!t[11],e),me=Vr(((Ee=t[12])==null?void 0:Ee.runPath)||"",j&&!!t[12],e),Pe=Vr(((Ze=t[13])==null?void 0:Ze.runPath)||"",j&&!!t[13],e),ce=Vr(((Ie=t[14])==null?void 0:Ie.runPath)||"",j&&!!t[14],e),He=Vr(((Ue=t[15])==null?void 0:Ue.runPath)||"",j&&!!t[15],e),Be=Vr(((rt=t[16])==null?void 0:rt.runPath)||"",j&&!!t[16],e),Ge=Vr(((ut=t[17])==null?void 0:ut.runPath)||"",j&&!!t[17],e),We=Vr(((Dt=t[18])==null?void 0:Dt.runPath)||"",j&&!!t[18],e),ae=Vr(((Rt=t[19])==null?void 0:Rt.runPath)||"",j&&!!t[19],e),{isStepTimesFetching:Z,isStepTimesRefetching:he}=w.useMemo(()=>{if(!j)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const St=[le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae],Ht=St.some($e=>$e.isFetching),en=St.filter($e=>$e.isFetching),Ut=Ht&&en.length>0&&en.every($e=>!!$e.data);return{isStepTimesFetching:Ht,isStepTimesRefetching:Ut}},[j,le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae]),{stepTimesByRun:be,firstStepTimesByRun:we}=w.useMemo(()=>{if(!j)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const St=[le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae],Ht=new Map,en=new Map;return t.forEach((Ut,$e)=>{if($e>=20)return;const Tt=St[$e].data;if(!Tt||Tt.first_step_time===null||Tt.first_step_time===void 0||!Tt.step_times||Tt.step_times.length===0)return;const Bt=new Map;Tt.step_times.forEach(Ct=>{typeof Ct.time=="number"&&Bt.set(Ct.step,Ct.time)}),Bt.size>0&&(Ht.set(Ut.runPath,Bt),en.set(Ut.runPath,Tt.first_step_time))}),{stepTimesByRun:Ht,firstStepTimesByRun:en}},[t,j,le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae]),ve={xAxisMode:p,stepTimesByRun:be,firstStepTimesByRun:we,isStepTimesFetching:Z,isStepTimesRefetching:he,scrollRoot:m,maxStepLimit:n,maxTimeLimit:r},Re=w.useMemo(()=>Object.keys(d),[d]),Ae=w.useCallback(St=>{_(Ht=>({...Ht,[St]:!(Ht[St]??!0)}))},[]),Oe=w.useCallback(St=>{O(Ht=>({...Ht,[St]:!(Ht[St]??!0)}))},[]),qe=x.length>0;return f.jsxs("div",{className:"-mt-3",children:[Re.map((St,Ht)=>{const en=b[St]??!0,Ut=d[St]??{},$e=Object.entries(Ut);return f.jsxs("div",{children:[Ht>0&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:en,onOpenChange:()=>Ae(St),children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!en&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:k4(St)})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-4 mt-3 mb-4",children:$e.map(([dt,Tt])=>f.jsxs("div",{children:[dt&&f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:k4(dt)}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Tt.map(Bt=>f.jsx(Jn,{runs:t,shouldPoll:e,metricName:Bt,label:k4(Bt),showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve},Bt))})]},dt))})})]})]},St)}),Re.length>0&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:S,onOpenChange:M,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:X.reward.title})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.reward.prefixes.map(St=>f.jsx(yg,{runs:t,shouldPoll:e,prefix:St.prefix,label:St.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve,extraCharts:St.prefix==="reward_sum"?f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${St.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve}):void 0},St.prefix))})})]}),X.samples_metrics&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:C,onOpenChange:A,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!C&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:X.samples_metrics.title})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.samples_metrics.prefixes.map(St=>f.jsx(yg,{runs:t,shouldPoll:e,prefix:St.prefix,label:St.label,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve,extraCharts:f.jsx(Jn,{runs:t,shouldPoll:e,metricName:`${St.prefix}_gini_mean`,label:`${St.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve})},St.prefix))})})]})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:N,onOpenChange:D,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!N&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:X.advantage.title})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.advantage.prefixes.map(St=>f.jsx(yg,{runs:t,shouldPoll:e,prefix:St.prefix,label:St.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve},St.prefix))})})]}),qe&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:R,onOpenChange:L,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!R&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"mt-3 mb-4 space-y-4",children:x.map((St,Ht)=>{const en=St.eval_name,Ut=St.available_rollout_metric_names,$e=k[en]??!0;return f.jsxs("div",{children:[Ht>0&&f.jsx("div",{className:"border-t border-gray-100 my-3"}),f.jsxs(Pi,{open:$e,onOpenChange:()=>Oe(en),children:[f.jsx(Di,{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(kr,{className:bt("h-3.5 w-3.5 text-muted-foreground transition-transform",!$e&&"-rotate-90")}),f.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:en})]})})}),f.jsx(Ii,{children:f.jsxs("div",{className:"space-y-6 mt-3",children:[Ut.map(dt=>f.jsx(R4,{runs:t,shouldPoll:e,evalName:en,prefix:`reward_${dt}`,label:k4(dt),showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:p,stepTimesByRun:ve.stepTimesByRun,firstStepTimesByRun:ve.firstStepTimesByRun,isStepTimesFetching:ve.isStepTimesFetching,isStepTimesRefetching:ve.isStepTimesRefetching,maxStepLimit:ve.maxStepLimit,maxTimeLimit:ve.maxTimeLimit,availableEnvs:c},`${en}-reward_${dt}`)),f.jsx(R4,{runs:t,shouldPoll:e,evalName:en,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:p,stepTimesByRun:ve.stepTimesByRun,firstStepTimesByRun:ve.firstStepTimesByRun,isStepTimesFetching:ve.isStepTimesFetching,isStepTimesRefetching:ve.isStepTimesRefetching,maxStepLimit:ve.maxStepLimit,maxTimeLimit:ve.maxTimeLimit}),f.jsx(R4,{runs:t,shouldPoll:e,evalName:en,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:p,stepTimesByRun:ve.stepTimesByRun,firstStepTimesByRun:ve.firstStepTimesByRun,isStepTimesFetching:ve.isStepTimesFetching,isStepTimesRefetching:ve.isStepTimesRefetching,maxStepLimit:ve.maxStepLimit,maxTimeLimit:ve.maxTimeLimit}),f.jsx(R4,{runs:t,shouldPoll:e,evalName:en,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:p,stepTimesByRun:ve.stepTimesByRun,firstStepTimesByRun:ve.firstStepTimesByRun,isStepTimesFetching:ve.isStepTimesFetching,isStepTimesRefetching:ve.isStepTimesRefetching,maxStepLimit:ve.maxStepLimit,maxTimeLimit:ve.maxTimeLimit})]})})]})]},en)})})})]})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:F,onOpenChange:B,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!F&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:X.rollouts.title})]})})}),f.jsx(Ii,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[X.rollouts.prefixes.map(St=>f.jsx(yg,{runs:t,shouldPoll:e,prefix:St.prefix,label:St.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve},St.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(Jn,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve}),f.jsx(Jn,{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,availableEnvs:c,...ve})]})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"off_policy_steps_mean",label:"Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"off_policy_steps_std",label:"Off-Policy Steps (Std)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),(()=>{const St=t.find(Ht=>Ht.isSelected)??t[0];return St?f.jsx(J2,{runPath:St.runPath,metricType:"off_policy_steps",label:"Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:Y,onOpenChange:V,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!Y&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),f.jsx(Ii,{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(Jn,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Max Async %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),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(Jn,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),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(Jn,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:o,...ve})})]}),f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_mean",label:"Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_std",label:"Off-Policy Steps (Std)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),(()=>{const St=t.find(Ht=>Ht.isSelected)??t[0];return St?f.jsx(J2,{runPath:St.runPath,metricType:"discarded_off_policy_steps",label:"Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]}),f.jsx(yg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(yg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(yg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:q,onOpenChange:G,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Trainer"})]})})}),f.jsx(Ii,{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(Jn,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),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(Jn,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:$,onOpenChange:Q,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!$&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Inference"})]})})}),f.jsx(Ii,{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(Jn,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_avg_inference_time",label:"Avg Generation Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),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(Jn,{runs:t,shouldPoll:e,metricName:"timing_generation_normal_pct",label:"Generation Normal",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_generation_discarded_pct",label:"Generation Discarded",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_generation_canceled_pct",label:"Generation Canceled",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_generation_all_pct",label:"Generation All",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_normal_pct",label:"Compute Reward Normal",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_discarded_pct",label:"Compute Reward Discarded",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_canceled_pct",label:"Compute Reward Canceled",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_all_pct",label:"Compute Reward All",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),f.jsx(Jn,{runs:t,shouldPoll:e,metricName:"timing_idle_pct",label:"Idle Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]})]})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:K,onOpenChange:re,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Inference Performance"})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"mt-3 mb-4",children:t[0]&&f.jsx(yme,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]}),f.jsx("div",{className:"border-t border-border my-3"}),f.jsxs(Pi,{open:U,onOpenChange:H,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"Trainer Performance"})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"mt-3 mb-4",children:t[0]&&f.jsx(wme,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]})]})}const Q2=100;function mme(t,e,n){const r=t.length;if(r<=Q2)return{steps:t,counts:e};const i=Math.ceil(r/Q2),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 J2({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:o=null,headerPrefix:a,headerSuffix:l}){const c=qn(gs),{isFullscreen:d,toggleFullscreen:p,fullscreenPortal:m}=Ix(),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),S=w.useRef(null),M=w.useRef(null),[C,A]=w.useState(0),D=Lx(x,{root:o,threshold:0})||d,{data:R,isFetching:L,isRefetching:k}=fW(t,e,D&&!!t&&!!e,s),O=R&&R.steps.length>0&&R.bin_edges.length>0,F=O&&R.steps.length>Q2,B=w.useMemo(()=>!O||!R?null:F?mme(R.steps,R.counts,R.bin_edges):{steps:R.steps,counts:R.counts},[O,R,F]),Y=w.useCallback(K=>K==null?"N/A":i?Math.round(K).toLocaleString():gu(K),[i]),V=w.useCallback(K=>Math.abs(K)>=1e3?`${parseFloat((K/1e3).toFixed(1))}k`:i?Math.round(K).toString():Number.isInteger(K)?K.toLocaleString():Math.abs(K)<.01&&K!==0?K.toExponential(1):String(parseFloat(K.toFixed(2))),[i]),q=w.useCallback(()=>{const K={top:8,right:8,bottom:24,left:40};if(!_.current||!R)return K;const re=_.current.getContext("2d");if(!re)return K;const U="10px system-ui, sans-serif",H=5;let X=0;re.save(),re.setTransform(1,0,0,1,0,0),re.font=U;for(let j=0;j<H;j++){const le=(R.global_min??0)+j/(H-1)*((R.global_max??0)-(R.global_min??0)),se=V(le);X=Math.max(X,re.measureText(se).width)}return re.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(X)+12)}},[R,V]);w.useEffect(()=>{if(!b.current||!_.current||!O||!R||!B)return;const K=b.current,re=_.current,U=re.getContext("2d");if(!U)return;const H=K.clientWidth,X=K.clientHeight||200,j=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",le=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",se="10px system-ui, sans-serif",J=window.devicePixelRatio||1;re.width=H*J,re.height=X*J,re.style.width=`${H}px`,re.style.height=`${X}px`,U.scale(J,J),U.font=se,U.clearRect(0,0,H,X);const ee=q(),ie=H-ee.left-ee.right,oe=X-ee.top-ee.bottom,de=B.steps,ye=R.bin_edges,ge=B.counts,Me=de.length,fe=ye.length-1;if(Me===0||fe===0)return;let Se=0;for(const ae of ge)for(const Z of ae)Z>Se&&(Se=Z);const me=Math.min(5,Me),Pe=5,ce=ie/Math.max(Me,1),He=ae=>ee.left+(ae+.5)*ce,Be=ae=>{const Z=(R.global_max??1)-(R.global_min??0),he=(ae-(R.global_min??0))/(Z||1);return ee.top+oe-he*oe},Ge=ae=>ae===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(ae/Se)*.75})`;U.strokeStyle=le,U.lineWidth=1;for(let ae=0;ae<me;ae++){const Z=Math.floor(ae/Math.max(me-1,1)*(Me-1)),he=He(Z);U.beginPath(),U.moveTo(he,ee.top),U.lineTo(he,X-ee.bottom),U.stroke()}for(let ae=0;ae<Pe;ae++){const Z=(R.global_min??0)+ae/(Pe-1)*((R.global_max??0)-(R.global_min??0)),he=Be(Z);U.beginPath(),U.moveTo(ee.left,he),U.lineTo(H-ee.right,he),U.stroke()}const We=ce;for(let ae=0;ae<Me;ae++){const Z=ee.left+ae*ce,he=ge[ae];for(let be=0;be<fe;be++){const we=he[be];if(we===0)continue;const ve=ye[be+1],Re=ye[be],Ae=Be(ve),Oe=Be(Re),qe=Math.max(1,Oe-Ae);U.fillStyle=Ge(we),U.fillRect(Z,Ae,We,qe)}}if(r&&(R.global_min??0)<0&&(R.global_max??0)>0){const ae=Be(0);U.strokeStyle=c?"rgba(255, 255, 255, 0.3)":"rgba(128, 128, 128, 0.5)",U.lineWidth=1,U.setLineDash([5,5]),U.beginPath(),U.moveTo(ee.left,ae),U.lineTo(H-ee.right,ae),U.stroke(),U.setLineDash([])}U.strokeStyle=j,U.lineWidth=1,U.beginPath(),U.moveTo(ee.left,X-ee.bottom),U.lineTo(H-ee.right,X-ee.bottom),U.stroke(),U.beginPath(),U.moveTo(ee.left,ee.top),U.lineTo(ee.left,X-ee.bottom),U.stroke(),U.fillStyle=j,U.font=se,U.textAlign="center";for(let ae=0;ae<me;ae++){const Z=Math.floor(ae/Math.max(me-1,1)*(Me-1)),he=de[Z],be=He(Z),we=he>=1e3?`${(he/1e3).toFixed(0)}k`:he.toString();U.fillText(we,be,X-6)}U.textAlign="right",U.textBaseline="middle";for(let ae=0;ae<Pe;ae++){const Z=(R.global_min??0)+ae/(Pe-1)*((R.global_max??0)-(R.global_min??0)),he=Be(Z);U.fillText(V(Z),ee.left-4,he)}},[R,B,O,r,V,q,c,C,d]),w.useEffect(()=>{if(!b.current)return;const K=b.current,re=new ResizeObserver(()=>{A(U=>U+1)});return re.observe(K),()=>{re.disconnect()}},[]);const G=w.useCallback(K=>{var we;if(!R||!B||!S.current||!_.current||!b.current)return;const re=_.current.getBoundingClientRect(),U=K.clientX-re.left,H=K.clientY-re.top,X=b.current.clientWidth,j=b.current.clientHeight||200,le=q(),se=X-le.left-le.right,J=j-le.top-le.bottom;if(se<=0||J<=0){M.current&&(M.current.style.display="none");return}if(U<le.left||U>X-le.right||H<le.top||H>j-le.bottom){S.current.style.display="none",M.current&&(M.current.style.display="none");return}const ee=(U-le.left)/se,ie=Math.min(B.steps.length-1,Math.max(0,Math.round(ee*(B.steps.length-1)))),oe=B.steps[ie];if(M.current){const ve=se/Math.max(B.steps.length,1),Re=le.left+(ie+.5)*ve;M.current.style.display="block",M.current.style.left=`${Re}px`,M.current.style.top=`${le.top}px`,M.current.style.bottom=`${le.bottom}px`}const de=1-(H-le.top)/J,ye=R.bin_edges.length-1,ge=Math.min(ye-1,Math.max(0,Math.floor(de*ye))),Me=R.bin_edges[ge],fe=R.bin_edges[ge+1],Se=((we=B.counts[ie])==null?void 0:we[ge])??0,Pe=(B.counts[ie]??[]).reduce((ve,Re)=>ve+Re,0),ce=Pe>0?(Se/Pe*100).toFixed(1):"0.0",Be=F&&R.steps.length>Q2?" (aggregated)":"";S.current.innerHTML=`
        <div class="font-medium mb-1">Step ${oe.toLocaleString()}${Be}</div>
        <div class="text-muted-foreground">Range: ${Y(Me)} to ${Y(fe)}</div>
        <div class="text-muted-foreground">Count: ${Se.toLocaleString()} (${ce}%)</div>
      `,S.current.style.display="block",S.current.style.left="0px",S.current.style.top="0px";const Ge=S.current.getBoundingClientRect(),We=K.clientX;let ae=We;ae+Ge.width+20>window.innerWidth&&(ae=We-Ge.width);const Z=Math.max(4,window.innerWidth-Ge.width-4);ae=Math.min(Math.max(4,ae),Z);const he=b.current.getBoundingClientRect();let be=he.top-Ge.height+20;be<4&&(be=he.top+8),S.current.style.left=`${ae-Ge.left}px`,S.current.style.top=`${be-Ge.top}px`},[R,B,Y,q,F]),$=w.useCallback(()=>{S.current&&(S.current.style.display="none"),M.current&&(M.current.style.display="none")},[]),Q=L&&!k;return m(f.jsxs("div",{ref:x,className:bt("group/chart bg-background",d?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!d&&Q&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[!d&&a,f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",d?"text-sm":"text-xs"),title:n,children:n})}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsx(Ox,{isFullscreen:d,onClick:p}),!d&&l]})]}),O?f.jsxs("div",{className:bt("relative bg-background rounded",d?"flex-1 min-h-0":"h-[200px]"),ref:b,children:[f.jsx("canvas",{className:"block w-full h-full max-w-full",ref:_,onMouseMove:G,onMouseLeave:$}),f.jsx("div",{ref:M,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),f.jsx("div",{ref:S,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"}}),k&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",d?"flex-1 min-h-0":"h-[200px]"),children:L?"Loading...":"No data"})]}))}function gme(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(c=>c.runPath).filter(Boolean),[t]),a=Dde(o,e,n?[n]:[],i&&o.length>0&&!!n,r,s);return{metricsByRunPath:w.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 B$({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:M=null,maxStepLimit:C,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,availableEnvs:R,filterKey:L}){const k=qn(gs),{isFullscreen:O,toggleFullscreen:F,fullscreenPortal:B}=Ix(),Y=w.useRef(null),V=w.useRef(null),q=w.useRef(null),G=w.useRef(null),[$,Q]=hn(iW),K=w.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),re=w.useRef(!1),U=w.useRef(!1);w.useEffect(()=>{const Ee=Ie=>{(Ie.key==="Control"||Ie.key==="Meta")&&(U.current=!0)},Ze=Ie=>{(Ie.key==="Control"||Ie.key==="Meta")&&(U.current=!1,Q(null))};return window.addEventListener("keydown",Ee),window.addEventListener("keyup",Ze),()=>{window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",Ze)}},[Q]);const H=L??`eval/${n}/${r}`,[X,j]=hn(Z7),se=k8.has(r),J=X[H],ee=(J==null?void 0:J.ignoreOutliers)??!1,ie=(J==null?void 0:J.ignoreFirstStep)??se,oe=(J==null?void 0:J.minY)??null,de=(J==null?void 0:J.maxY)??null,ye=(J==null?void 0:J.tagFilters)??{},ge=(J==null?void 0:J.envFilters)??[],Me=Object.keys(ye).length>0,fe=ge.length>0,Se=w.useCallback(Ee=>{j(Ze=>{const Ie={ignoreOutliers:!1,ignoreFirstStep:se,minY:null,maxY:null,tagFilters:{},envFilters:[]},Ue=Ze[H]??Ie,rt=Ee(Ue);if(rt.ignoreOutliers===Ie.ignoreOutliers&&rt.ignoreFirstStep===Ie.ignoreFirstStep&&rt.minY===Ie.minY&&rt.maxY===Ie.maxY&&Object.keys(rt.tagFilters??{}).length===0&&(rt.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(Ze,H))return Ze;const Dt={...Ze};return delete Dt[H],Dt}return{...Ze,[H]:rt}})},[H,j,se]),me=w.useCallback(Ee=>{Se(Ze=>({...Ze,ignoreOutliers:Ee}))},[Se]),Pe=w.useCallback(Ee=>{Se(Ze=>({...Ze,ignoreFirstStep:Ee}))},[Se]),ce=w.useCallback(Ee=>{Se(Ze=>({...Ze,minY:Ee}))},[Se]),He=w.useCallback(Ee=>{Se(Ze=>({...Ze,maxY:Ee}))},[Se]),Be=w.useCallback((Ee,Ze)=>{Se(Ie=>{const Ue={...Ie.tagFilters??{}},rt=Ue[Ee]??[];if(rt.includes(Ze)){const ut=rt.filter(Dt=>Dt!==Ze);ut.length===0?delete Ue[Ee]:Ue[Ee]=ut}else Ue[Ee]=[...rt,Ze];return{...Ie,tagFilters:Ue}})},[Se]),Ge=w.useCallback(Ee=>{Se(Ze=>{const Ie=[...Ze.envFilters??[]],Ue=Ie.indexOf(Ee);return Ue>=0?Ie.splice(Ue,1):Ie.push(Ee),{...Ze,envFilters:Ie}})},[Se]),ae=Lx(Y,{root:M,threshold:0})||O,Z=w.useMemo(()=>{const Ee=t.filter(Ie=>!Ie.isSelected),Ze=t.filter(Ie=>Ie.isSelected);return[...Ee,...Ze]},[t]),he=w.useMemo(()=>Z.slice(0,20),[Z]),be=w.useMemo(()=>{const Ee=new Map;return he.forEach((Ze,Ie)=>{Ee.set(Ze.runPath,Ie)}),Ee},[he]),{metricsByRunPath:we,isFetching:ve,isRefetching:Re}=gme(t,n,r,e,ae,ge),{uplotData:Ae,seriesConfig:Oe,isFetching:qe,isRefetching:Fe,hasData:Ke,timeToStepByRun:je,outlierBounds:Te}=w.useMemo(()=>{const Ee=new Set,Ze=new Map,Ie=new Map,Ue=new Map,rt=m==="time"&&!!x&&!!b,ut=ve;Z.forEach((dt,Tt)=>{if(Tt>=20)return;const Bt=we.get(dt.runPath)??[],Ct=new Map;if(Bt.forEach(At=>{Ee.add(At.step),Ct.set(At.step,At.value)}),Ze.set(Tt,Ct),rt){const At=x==null?void 0:x.get(dt.runPath),Ot=b==null?void 0:b.get(dt.runPath);if(At&&Ot!==void 0){const cn=new Map,Lt=new Map;At.forEach((wt,Zt)=>{const Jt=wt-Ot;cn.set(Zt,Jt),Lt.set(Jt,Zt)}),Ie.set(Tt,cn),Ue.set(Tt,Lt)}}});const Dt=()=>!(!ut&&!_||ut&&!Re||_&&!S);if(Ee.size===0)return{uplotData:null,seriesConfig:[],isFetching:ut||_,isRefetching:Dt(),hasData:!1,timeToStepByRun:Ue,outlierBounds:null};let Rt=Array.from(Ee).sort((dt,Tt)=>dt-Tt);C!=null&&!rt&&(Rt=Rt.filter(dt=>dt<=C));let St=Rt;if(rt){const dt=new Set;if(Ze.forEach((Bt,Ct)=>{const At=Ie.get(Ct);At&&Bt.forEach((Ot,cn)=>{const Lt=At.get(cn);Lt!==void 0&&dt.add(Lt)})}),dt.size===0)return{uplotData:null,seriesConfig:[],isFetching:ut||_,isRefetching:Dt(),hasData:!1,timeToStepByRun:Ue,outlierBounds:null};let Tt=Array.from(dt).sort((Bt,Ct)=>Bt-Ct);A!=null&&(Tt=Tt.filter(Bt=>Bt<=A)),St=Tt}let Ht=null;if(ee){const dt=[];Ze.forEach(Tt=>{Tt.forEach(Bt=>{dt.push(Bt)})}),Ht=pC(dt)}const en=new Float64Array(St),Ut=[{label:rt?"Time (s)":"Step"}],$e=[en];return Z.forEach((dt,Tt)=>{if(Tt>=20)return;const Bt=Ze.get(Tt)||new Map;let Ct;if(rt){const Lt=Ie.get(Tt),wt=new Map;Lt&&Bt.forEach((Zt,Jt)=>{const vn=Lt.get(Jt);vn!==void 0&&wt.set(vn,Zt)}),Ct=St.map(Zt=>wt.get(Zt)??null)}else Ct=Rt.map(Lt=>Bt.get(Lt)??null);const At=p===dt.runPath,cn=p!==null&&!At?.1:c?.3:1;$e.push(Ct),Ut.push({label:Sp(dt),stroke:dt.color,width:1,alpha:cn,spanGaps:!0,points:{show:!1}})}),c&&Z.forEach((dt,Tt)=>{if(Tt>=20)return;const Bt=Ze.get(Tt)||new Map,Ct=2/(d+1);let At=null,Ot;if(rt){const Zt=Ie.get(Tt),Jt=new Map;Rt.forEach(vn=>{const Fn=Bt.get(vn);if(Fn!==void 0){At=At===null?Fn:Ct*Fn+(1-Ct)*At;const _e=Zt==null?void 0:Zt.get(vn);_e!==void 0&&At!==null&&Jt.set(_e,At)}}),Ot=St.map(vn=>Jt.get(vn)??null)}else{const Zt=[];Rt.forEach(Jt=>{const vn=Bt.get(Jt);vn!==void 0?(At=At===null?vn:Ct*vn+(1-Ct)*At,Zt.push(At)):Zt.push(null)}),Ot=Zt}const cn=p===dt.runPath,wt=p!==null&&!cn?.1:1;$e.push(Ot),Ut.push({label:`${Sp(dt)} (EMA)`,stroke:dt.color,width:1.5,alpha:wt,spanGaps:!0,points:{show:!1}})}),{uplotData:$e,seriesConfig:Ut,isFetching:ut||_,isRefetching:Dt(),hasData:!0,timeToStepByRun:Ue,outlierBounds:Ht}},[Z,we,ve,Re,c,d,p,m,x,b,_,S,C,A,ee]),Xe=a||r.split("_").pop()||"",ht=m==="time",ke=w.useCallback(Ee=>Ee==null?"N/A":l&&(Xe==="min"||Xe==="max")?Math.round(Ee).toLocaleString():gu(Ee),[l,Xe]),et=w.useCallback(Ee=>Math.abs(Ee)>=1e3?`${parseFloat((Ee/1e3).toFixed(1))}k`:l?Xe==="min"||Xe==="max"?Math.round(Ee).toString():String(parseFloat(Ee.toFixed(1))):Number.isInteger(Ee)?Ee.toLocaleString():Math.abs(Ee)<.01&&Ee!==0?Ee.toExponential(1):String(parseFloat(Ee.toFixed(2))),[l,Xe]),ct=w.useCallback(Ee=>ht?ud(Ee):Ee>=1e3?`${(Ee/1e3).toFixed(0)}k`:Ee.toString(),[ht]);w.useEffect(()=>{if(!V.current||!Ae||!Ke)return;const Ee=V.current,Ze=Ee.clientWidth,Ie=Ee.clientHeight||200;let Ue=1/0,rt=-1/0;for(let At=1;At<Ae.length;At++){const Ot=Ae[At];for(let cn=0;cn<Ot.length;cn++){if(ie&&cn===0)continue;const Lt=Ot[cn];Lt!=null&&(ee&&Te?Lt>=Te.lower&&Lt<=Te.upper&&(Lt<Ue&&(Ue=Lt),Lt>rt&&(rt=Lt)):(Lt<Ue&&(Ue=Lt),Lt>rt&&(rt=Lt)))}}Ue===1/0&&Te&&(Ue=Te.lower,rt=Te.upper);const ut=rt-Ue,Dt=Math.max(Math.abs(rt),Math.abs(Ue)),Rt=Math.max(Dt*.05,1e-10),St=Math.max(ut*.1,Rt);let Ht,en;o?(Ht=Math.min(Ue-St,0),en=Math.max(rt+St,0)):(Ht=Ue-St,en=rt+St),oe!==null&&(Ht=oe),de!==null&&(en=de);const Ut=k?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",$e=k?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Tt={width:Ze,height:Ie,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Ht,en]}},axes:[{stroke:$e,grid:{stroke:Ut,width:1},ticks:{stroke:Ut,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(At,Ot)=>Ot.map(ct)},{stroke:$e,grid:{stroke:Ut,width:1},ticks:{stroke:Ut,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(At,Ot)=>{if(!Ot||Ot.length===0)return 40;const cn=Math.max(...Ot.map(Lt=>Lt.length));return Math.max(40,cn*7+14)},values:(At,Ot)=>Ot.map(et)}],series:Oe,hooks:{draw:[At=>{var Zt,Jt;if(!Ae)return;const Ot=Ae[0],cn=Math.min(Z.length,20),Lt=At.series.length,wt=At.ctx;wt.save();for(let vn=1;vn<Lt;vn++){const Fn=Ae[vn];if(!Fn)continue;let _e=-1;for(let Vt=Fn.length-1;Vt>=0;Vt--)if(Fn[Vt]!==null&&Fn[Vt]!==void 0){_e=Vt;break}if(_e===-1)continue;const nt=Ot[_e],mt=Fn[_e];if(nt===void 0||mt===void 0||mt===null)continue;const xt=At.valToPos(Number(nt),"x",!0),vt=At.valToPos(Number(mt),"y",!0);if(!Number.isFinite(xt)||!Number.isFinite(vt))continue;const qt=At.series[vn],tn=typeof(qt==null?void 0:qt.alpha)=="number"?qt.alpha:1;let Kt=typeof(qt==null?void 0:qt.stroke)=="string"?qt.stroke:void 0;if(!Kt){const Vt=vn-1;if(Vt<cn)Kt=(Zt=Z[Vt])==null?void 0:Zt.color;else if(c){const dn=Vt-cn;dn>=0&&dn<cn&&(Kt=(Jt=Z[dn])==null?void 0:Jt.color)}}Kt&&(wt.globalAlpha=tn,wt.fillStyle=Kt,wt.beginPath(),wt.arc(xt,vt,4,0,Math.PI*2),wt.fill())}wt.restore()}],setCursor:[At=>{if(!G.current)return;const{left:Ot,top:cn,idx:Lt}=At.cursor;if(Lt==null||Ot===void 0||cn===void 0||Ot<0){G.current.style.display="none";return}const wt=Ae[0][Lt];if(wt===void 0){G.current.style.display="none";return}U.current&&!re.current&&Q({xValue:Number(wt),sourceChartId:K});let Jt=`<div class="font-medium mb-1">${ht?`Time ${z$(Number(wt))}`:`Step ${Number(wt).toLocaleString()}`}</div>`;const vn=he.length;t.forEach(xt=>{var dn;const vt=be.get(xt.runPath);if(vt===void 0)return;const qt=vt+1,tn=Ae[qt];if(!tn)return;const Kt=tn[Lt];let Vt;if(c){const _n=vn+vt+1;Vt=(dn=Ae[_n])==null?void 0:dn[Lt]}Kt!=null&&(Jt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${xt.color}"></div>
                    <span>${Iw(xt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${ke(Kt)}${s?` ${s}`:""}</span>
                    ${c&&Vt!==void 0&&Vt!==null?`<span class="text-muted-foreground">(EMA: ${ke(Vt)})</span>`:""}
                  </div>
                </div>
              `)}),G.current.innerHTML=Jt,G.current.style.display="block";const Fn=V.current.getBoundingClientRect(),_e=G.current.getBoundingClientRect();let nt=Fn.left+Ot+15;nt+_e.width+20>window.innerWidth&&(nt=Fn.left+Ot-_e.width-15+At.bbox.left),nt=Math.max(4,nt);let mt=Fn.top-_e.height+20;mt<4&&(mt=Fn.top+8),G.current.style.left=`${nt}px`,G.current.style.top=`${mt}px`}]}};q.current&&q.current.destroy();const Bt=new ps(Tt,Ae,Ee);q.current=Bt;const Ct=new ResizeObserver(At=>{for(const Ot of At){const{width:cn,height:Lt}=Ot.contentRect;Bt&&cn>0&&Lt>0&&Bt.setSize({width:cn,height:Lt})}});return Ct.observe(Ee),()=>{Ct.disconnect(),Bt.destroy(),q.current=null}},[Ae,Oe,Ke,ct,et,ke,ht,je,Z,p,c,o,s,t,he,be,K,Q,ee,ie,Te,oe,de,k,O]),w.useEffect(()=>{if(!$){G.current&&(G.current.style.display="none");return}if($.sourceChartId===K||!q.current||!Ae)return;const Ee=q.current,Ze=Ae[0];if(!Ze||Ze.length===0)return;const Ie=$.xValue;let Ue=0,rt=1/0;for(let Dt=0;Dt<Ze.length;Dt++){const Rt=Math.abs(Number(Ze[Dt])-Ie);Rt<rt&&(rt=Rt,Ue=Dt)}const ut=Ee.valToPos(Number(Ze[Ue]),"x");ut>=0&&ut<=Ee.width&&(re.current=!0,Ee.setCursor({left:ut,top:0}),re.current=!1)},[$,K,Ae]);const yt=w.useCallback(()=>{G.current&&(G.current.style.display="none"),($==null?void 0:$.sourceChartId)===K&&Q(null)},[$,K,Q]),lt=qe&&!Fe,Je=i||(Xe?`${Xe.charAt(0).toUpperCase()}${Xe.slice(1)}`:r);return B(f.jsxs("div",{ref:Y,className:bt("group/chart flex flex-col bg-background",O?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!O&&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:[!O&&N,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",O?"text-sm":"text-xs"),title:r,children:Je})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:ee,onCheckedChange:me,children:"Ignore Outliers"}),f.jsx(Er,{checked:ie,onCheckedChange:Pe,children:"Ignore First Step"}),f.jsx(Bs,{}),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:oe??"",onChange:Ee=>{const Ze=Ee.target.value;ce(Ze===""?null:Number(Ze))},onClick:Ee=>Ee.stopPropagation(),onKeyDown:Ee=>Ee.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:de??"",onChange:Ee=>{const Ze=Ee.target.value;He(Ze===""?null:Number(Ze))},onClick:Ee=>Ee.stopPropagation(),onKeyDown:Ee=>Ee.stopPropagation()})]}),R&&R.length>1&&f.jsxs(f.Fragment,{children:[f.jsx(Bs,{}),f.jsx(om,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),R.map(Ee=>f.jsx(Er,{checked:ge.includes(Ee),onCheckedChange:()=>Ge(Ee),children:Ee},Ee))]})]})]}),f.jsx(Ox,{isFullscreen:O,onClick:F}),!O&&D]})]}),(ee||ie||oe!==null||de!==null||Me||fe)&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[ee&&f.jsx(ko,{label:"Ignore Outliers",onRemove:()=>me(!1)}),ie&&f.jsx(ko,{label:"Ignore First Step",onRemove:()=>Pe(!1)}),oe!==null&&f.jsx(ko,{label:`Min Y: ${oe}`,onRemove:()=>ce(null)}),de!==null&&f.jsx(ko,{label:`Max Y: ${de}`,onRemove:()=>He(null)}),ge.map(Ee=>f.jsx(ko,{label:`env: ${Ee}`,onRemove:()=>Ge(Ee)},`env:${Ee}`)),Object.entries(ye).map(([Ee,Ze])=>Ze.map(Ie=>f.jsx(ko,{label:`${Ee}: ${Ie}`,onRemove:()=>Be(Ee,Ie)},`${Ee}:${Ie}`)))]})]}),Ke?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:V,onMouseLeave:yt,children:[f.jsx("div",{ref:G,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(Zl,{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:qe?"Loading...":"No data"})]}))}function R4({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:M,maxTimeLimit:C,availableEnvs:A}){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:F$.map(N=>f.jsx(B$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${N}`,label:`${i} ${U$[N]}`,unit:s,showZeroLine:o,statType:N,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:p,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:M,maxTimeLimit:C,availableEnvs:A},`${n}-${r}_${N}`))})]})}function yg({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:M,extraCharts:C,hideGroupLabel:A,availableSampleTags:N,availableEnvs:D}){const R=t.find(L=>L.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:[F$.map(L=>f.jsx(Jn,{runs:t,shouldPoll:e,metricName:`${n}_${L}`,label:`${r} ${U$[L]}`,unit:i,showZeroLine:s,statType:L,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:p,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:M,availableSampleTags:N,availableEnvs:D},`${n}_${L}`)),C,R&&f.jsx(J2,{runPath:R.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:o,shouldPoll:e,scrollRoot:_})]})]})}function xme(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(d=>d.runPath).filter(Boolean),[t]),a=w.useMemo(()=>e?[e]:[],[e]),l=Rde(o,a,r&&o.length>0&&a.length>0,n,i,s);return{metricsByRunPath:w.useMemo(()=>{var p,m;const d=new Map;return(m=(p=l.data)==null?void 0:p.runs)==null||m.forEach(x=>{d.set(x.run_path,x.metrics??[])}),d},[l.data]),isFetching:l.isFetching,isRefetching:l.isFetching&&!!l.data}}function Jn({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:M,maxStepLimit:C,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,availableSampleTags:R,availableEnvs:L,filterKey:k}){const O=qn(gs),{isFullscreen:F,toggleFullscreen:B,fullscreenPortal:Y}=Ix(),V=w.useRef(null),q=w.useRef(null),G=w.useRef(null),$=w.useRef(null),[Q,K]=hn(iW),[re,U]=hn(Z7),H=w.useMemo(()=>`metric-${n}`,[n]),X=w.useRef(!1),j=w.useRef(!1);w.useEffect(()=>{const Ue=ut=>{(ut.key==="Control"||ut.key==="Meta")&&(j.current=!0)},rt=ut=>{(ut.key==="Control"||ut.key==="Meta")&&(j.current=!1,K(null))};return window.addEventListener("keydown",Ue),window.addEventListener("keyup",rt),()=>{window.removeEventListener("keydown",Ue),window.removeEventListener("keyup",rt)}},[K]);const le=k??n,se=M??!1,ee=k8.has(n),ie=re[le],oe=(ie==null?void 0:ie.ignoreOutliers)??se,de=(ie==null?void 0:ie.ignoreFirstStep)??ee,ye=(ie==null?void 0:ie.minY)??null,ge=(ie==null?void 0:ie.maxY)??null,Me=(ie==null?void 0:ie.tagFilters)??{},fe=(ie==null?void 0:ie.envFilters)??[],Se=w.useCallback(Ue=>{U(rt=>{const ut={ignoreOutliers:se,ignoreFirstStep:ee,minY:null,maxY:null,tagFilters:{},envFilters:[]},Dt=rt[le]??ut,Rt=Ue(Dt);if(Rt.ignoreOutliers===ut.ignoreOutliers&&Rt.ignoreFirstStep===ut.ignoreFirstStep&&Rt.minY===ut.minY&&Rt.maxY===ut.maxY&&Object.keys(Rt.tagFilters??{}).length===0&&(Rt.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(rt,le))return rt;const Ht={...rt};return delete Ht[le],Ht}return{...rt,[le]:Rt}})},[le,U,se,ee]),me=w.useCallback(Ue=>{Se(rt=>({...rt,ignoreOutliers:Ue}))},[Se]),Pe=w.useCallback(Ue=>{Se(rt=>({...rt,ignoreFirstStep:Ue}))},[Se]),ce=w.useCallback(Ue=>{Se(rt=>({...rt,minY:Ue}))},[Se]),He=w.useCallback(Ue=>{Se(rt=>({...rt,maxY:Ue}))},[Se]),Be=w.useCallback((Ue,rt)=>{Se(ut=>{const Dt={...ut.tagFilters??{}},Rt=Dt[Ue]??[];if(Rt.includes(rt)){const St=Rt.filter(Ht=>Ht!==rt);St.length===0?delete Dt[Ue]:Dt[Ue]=St}else Dt[Ue]=[...Rt,rt];return{...ut,tagFilters:Dt}})},[Se]),Ge=w.useCallback(Ue=>{Se(rt=>{const ut=[...rt.envFilters??[]],Dt=ut.indexOf(Ue);return Dt>=0?ut.splice(Dt,1):ut.push(Ue),{...rt,envFilters:ut}})},[Se]),We=Object.keys(Me).length>0,ae=fe.length>0,he=Lx(V,{root:S,threshold:0})||F,be=w.useMemo(()=>{const Ue=t.filter(ut=>!ut.isSelected),rt=t.filter(ut=>ut.isSelected);return[...Ue,...rt]},[t]),we=w.useMemo(()=>be.slice(0,20),[be]),ve=w.useMemo(()=>{const Ue=new Map;return we.forEach((rt,ut)=>{Ue.set(rt.runPath,ut)}),Ue},[we]),{metricsByRunPath:Re,isFetching:Ae,isRefetching:Oe}=xme(t,n,e,he,Me,fe),{uplotData:qe,seriesConfig:Fe,isFetching:Ke,isRefetching:je,hasData:Te,timeToStepByRun:Xe,outlierBounds:ht}=w.useMemo(()=>{const Ue=new Set,rt=new Map,ut=new Map,Dt=new Map,Rt=p==="time"&&!!m&&!!x,St=Ae;be.forEach((At,Ot)=>{if(Ot>=20)return;const cn=Re.get(At.runPath)??[],Lt=new Map,wt=ome.has(n);if(cn.forEach(Zt=>{wt&&Zt.value===0||(Ue.add(Zt.step),Lt.set(Zt.step,Zt.value))}),rt.set(Ot,Lt),Rt){const Zt=m==null?void 0:m.get(At.runPath),Jt=x==null?void 0:x.get(At.runPath);if(Zt&&Jt!==void 0){const vn=new Map,Fn=new Map;Zt.forEach((_e,nt)=>{const mt=_e-Jt;vn.set(nt,mt),Fn.set(mt,nt)}),ut.set(Ot,vn),Dt.set(Ot,Fn)}}});const Ht=()=>!(!St&&!b||St&&!Oe||b&&!_);if(Ue.size===0)return{uplotData:null,seriesConfig:[],isFetching:St||b,isRefetching:Ht(),hasData:!1,timeToStepByRun:Dt,outlierBounds:null,minStep:null};const en=Math.min(...Array.from(Ue));let Ut=Array.from(Ue).sort((At,Ot)=>At-Ot);C!=null&&!Rt&&(Ut=Ut.filter(At=>At<=C));let $e=Ut;if(Rt){const At=new Set;if(rt.forEach((cn,Lt)=>{const wt=ut.get(Lt);wt&&cn.forEach((Zt,Jt)=>{const vn=wt.get(Jt);vn!==void 0&&At.add(vn)})}),At.size===0)return{uplotData:null,seriesConfig:[],isFetching:St||b,isRefetching:Ht(),hasData:!1,timeToStepByRun:Dt,outlierBounds:null,minStep:null};let Ot=Array.from(At).sort((cn,Lt)=>cn-Lt);A!=null&&(Ot=Ot.filter(cn=>cn<=A)),$e=Ot}let dt=null;if(oe){const At=[];rt.forEach(Ot=>{Ot.forEach(cn=>{At.push(cn)})}),dt=pC(At)}const Tt=new Float64Array($e),Bt=[{label:Rt?"Time (s)":"Step"}],Ct=[Tt];return be.forEach((At,Ot)=>{if(Ot>=20)return;const cn=rt.get(Ot)||new Map;let Lt;if(Rt){const vn=ut.get(Ot),Fn=new Map;vn&&cn.forEach((_e,nt)=>{const mt=vn.get(nt);mt!==void 0&&Fn.set(mt,_e)}),Lt=$e.map(_e=>Fn.get(_e)??null)}else Lt=Ut.map(vn=>cn.get(vn)??null);const wt=d===At.runPath,Zt=d!==null;let Jt;Zt&&!wt?Jt=.1:Jt=l?.3:1,Ct.push(Lt),Bt.push({label:Sp(At),stroke:At.color,width:1,alpha:Jt,spanGaps:!0,points:{show:!1}})}),l&&be.forEach((At,Ot)=>{if(Ot>=20)return;const cn=rt.get(Ot)||new Map,Lt=2/(c+1);let wt=null,Zt;if(Rt){const _e=ut.get(Ot),nt=new Map;Ut.forEach(mt=>{const xt=cn.get(mt);if(xt!==void 0){!(dt&&(xt<dt.lower||xt>dt.upper))&&!(de&&mt===en)&&(wt=wt===null?xt:Lt*xt+(1-Lt)*wt);const tn=_e==null?void 0:_e.get(mt);tn!==void 0&&wt!==null&&nt.set(tn,wt)}}),Zt=$e.map(mt=>nt.get(mt)??null)}else{const _e=[];Ut.forEach(nt=>{const mt=cn.get(nt);mt!==void 0?(!(dt&&(mt<dt.lower||mt>dt.upper))&&!(de&&nt===en)&&(wt===null?wt=mt:wt=Lt*mt+(1-Lt)*wt),_e.push(wt)):_e.push(null)}),Zt=_e}const Jt=d===At.runPath,vn=d!==null;let Fn;vn&&!Jt?Fn=.1:Fn=1,Ct.push(Zt),Bt.push({label:`${Sp(At)} (EMA)`,stroke:At.color,width:1.5,alpha:Fn,spanGaps:!0,points:{show:!1}})}),{uplotData:Ct,seriesConfig:Bt,isFetching:St||b,isRefetching:Ht(),hasData:!0,timeToStepByRun:Dt,outlierBounds:dt,minStep:en}},[be,Re,Ae,Oe,l,c,d,p,m,x,b,_,oe,de,C,A]),ke=o||n.split("_").pop()||"",et=p==="time",ct=n.startsWith("timing_")&&n!=="timing_microbatch_count"&&!n.endsWith("_pct"),yt=w.useCallback(Ue=>Ue==null?"N/A":a&&(ke==="min"||ke==="max")?Math.round(Ue).toLocaleString():gu(Ue),[a,ke]),lt=w.useCallback(Ue=>ct?ud(Ue):Math.abs(Ue)>=1e3?`${parseFloat((Ue/1e3).toFixed(1))}k`:a?ke==="min"||ke==="max"?Math.round(Ue).toString():String(parseFloat(Ue.toFixed(1))):Number.isInteger(Ue)?Ue.toLocaleString():Math.abs(Ue)<.01&&Ue!==0?Ue.toExponential(1):String(parseFloat(Ue.toFixed(2))),[a,ct,ke]),Je=w.useCallback(Ue=>et?ud(Ue):Ue>=1e3?`${(Ue/1e3).toFixed(0)}k`:Ue.toString(),[et]);w.useEffect(()=>{if(!q.current||!qe||!Te)return;const Ue=q.current,rt=Ue.clientWidth,ut=Ue.clientHeight||200;let Dt=1/0,Rt=-1/0;for(let Lt=1;Lt<qe.length;Lt++){const wt=qe[Lt];for(let Zt=0;Zt<wt.length;Zt++){if(de&&Zt===0)continue;const Jt=wt[Zt];Jt!=null&&(oe&&ht?Jt>=ht.lower&&Jt<=ht.upper&&(Jt<Dt&&(Dt=Jt),Jt>Rt&&(Rt=Jt)):(Jt<Dt&&(Dt=Jt),Jt>Rt&&(Rt=Jt)))}}Dt===1/0&&ht&&(Dt=ht.lower,Rt=ht.upper);const St=Rt-Dt,Ht=Math.max(Math.abs(Rt),Math.abs(Dt)),en=Math.max(Ht*.05,1e-10),Ut=Math.max(St*.1,en);let $e,dt;s?($e=Math.min(Dt-Ut,0),dt=Math.max(Rt+Ut,0)):($e=Dt-Ut,dt=Rt+Ut),ye!==null&&($e=ye),ge!==null&&(dt=ge);const Tt=O?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Bt=O?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",At={width:rt,height:ut,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[$e,dt]}},axes:[{stroke:Bt,grid:{stroke:Tt,width:1},ticks:{stroke:Tt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Lt,wt)=>wt.map(Je)},{stroke:Bt,grid:{stroke:Tt,width:1},ticks:{stroke:Tt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Lt,wt)=>{if(!wt||wt.length===0)return 40;const Zt=Math.max(...wt.map(Jt=>Jt.length));return Math.max(40,Zt*7+14)},values:(Lt,wt)=>wt.map(lt)}],series:Fe,hooks:{draw:[Lt=>{var Fn,_e;if(!qe)return;const wt=qe[0],Zt=Math.min(be.length,20),Jt=Lt.series.length,vn=Lt.ctx;vn.save();for(let nt=1;nt<Jt;nt++){const mt=qe[nt];if(!mt)continue;let xt=-1;for(let An=mt.length-1;An>=0;An--){const rn=mt[An];if(rn!=null){xt=An;break}}if(xt===-1)continue;const vt=wt[xt],qt=mt[xt];if(vt===void 0||qt===void 0||qt===null)continue;const tn=Lt.valToPos(Number(vt),"x",!0),Kt=Lt.valToPos(Number(qt),"y",!0);if(!Number.isFinite(tn)||!Number.isFinite(Kt))continue;const Vt=Lt.series[nt],dn=typeof(Vt==null?void 0:Vt.alpha)=="number"?Vt.alpha:1;let _n=typeof(Vt==null?void 0:Vt.stroke)=="string"?Vt.stroke:void 0;if(!_n){const An=nt-1;if(An<Zt)_n=(Fn=be[An])==null?void 0:Fn.color;else if(l){const rn=An-Zt;rn>=0&&rn<Zt&&(_n=(_e=be[rn])==null?void 0:_e.color)}}_n&&(vn.globalAlpha=dn,vn.fillStyle=_n,vn.beginPath(),vn.arc(tn,Kt,4,0,Math.PI*2),vn.fill())}vn.restore()}],setCursor:[Lt=>{if(!$.current)return;const{left:wt,top:Zt,idx:Jt}=Lt.cursor;if(Jt==null||wt===void 0||Zt===void 0||wt<0){$.current.style.display="none";return}const vn=qe[0][Jt];if(vn===void 0){$.current.style.display="none";return}j.current&&!X.current&&K({xValue:Number(vn),sourceChartId:H});const Fn=(()=>{var Gn,xr;if(!et||!Xe)return null;const dn=Number(vn);if(d){const sr=be.findIndex(Xn=>Xn.runPath===d);if(sr>=0){const Xn=(Gn=Xe.get(sr))==null?void 0:Gn.get(dn);if(Xn!==void 0)return Xn}}const _n=be.findIndex(sr=>sr.isSelected);if(_n>=0){const sr=(xr=Xe.get(_n))==null?void 0:xr.get(dn);if(sr!==void 0)return sr}let An=null;const rn=new Set;return be.forEach((sr,Xn)=>{var un;const dr=(un=Xe.get(Xn))==null?void 0:un.get(dn);dr!==void 0&&(rn.add(dr),An===null&&(An=dr))}),rn.size===1,An})();let nt=`<div class="font-medium mb-1">${et?`Time ${z$(Number(vn))}${Fn!==null?` <span class="text-muted-foreground">(Step ${Number(Fn).toLocaleString()})</span>`:""}`:`Step ${Number(vn).toLocaleString()}`}</div>`;const mt=we.length,xt=qe[0],vt=(()=>{if(!et)return null;const dn=Lt.scales.x,_n=Number(dn.min),An=Number(dn.max);if(!Number.isFinite(_n)||!Number.isFinite(An))return null;const rn=Math.abs(An-_n);if(rn<=0)return null;const Gn=Math.max(1,Lt.bbox.width);return rn*cme/Gn})();t.forEach(dn=>{const _n=ve.get(dn.runPath);if(_n===void 0)return;const An=_n+1,rn=qe[An];if(!rn)return;const Gn=et?ume(rn,xt,Jt,vt):Jt;if(Gn===null)return;const xr=rn[Gn];let sr;if(l){const Xn=mt+_n+1,dr=qe[Xn];sr=dr==null?void 0:dr[Gn]}xr!=null&&(nt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${dn.color}"></div>
                    <span>${Iw(dn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${ct?Ak(xr):`${yt(xr)}${i?` ${i}`:""}`}</span>
                    ${l&&sr!==void 0&&sr!==null?`<span class="text-muted-foreground">(EMA: ${ct?Ak(sr):yt(sr)})</span>`:""}
                  </div>
                </div>
              `)}),$.current.innerHTML=nt,$.current.style.display="block";const qt=q.current.getBoundingClientRect(),tn=$.current.getBoundingClientRect();let Kt=qt.left+wt+15;Kt+tn.width+20>window.innerWidth&&(Kt=qt.left+wt-tn.width-15+Lt.bbox.left),Kt=Math.max(4,Kt);let Vt=qt.top-tn.height+20;Vt<4&&(Vt=qt.top+8),$.current.style.left=`${Kt}px`,$.current.style.top=`${Vt}px`}]}};G.current&&G.current.destroy();const Ot=new ps(At,qe,Ue);G.current=Ot;const cn=new ResizeObserver(Lt=>{for(const wt of Lt){const{width:Zt,height:Jt}=wt.contentRect;Ot&&Zt>0&&Jt>0&&Ot.setSize({width:Zt,height:Jt})}});return cn.observe(Ue),()=>{cn.disconnect(),Ot.destroy(),G.current=null}},[qe,Fe,Te,Je,lt,yt,et,Xe,be,d,l,s,i,oe,ht,de,ye,ge,t,we,ve,H,ct,K,O,F]),w.useEffect(()=>{if(!Q){$.current&&($.current.style.display="none");return}if(Q.sourceChartId===H||!G.current||!qe)return;const Ue=G.current,rt=qe[0];if(!rt||rt.length===0)return;const ut=Q.xValue;let Dt=0,Rt=1/0;for(let Ht=0;Ht<rt.length;Ht++){const en=Math.abs(Number(rt[Ht])-ut);en<Rt&&(Rt=en,Dt=Ht)}const St=Ue.valToPos(Number(rt[Dt]),"x");St>=0&&St<=Ue.width&&(X.current=!0,Ue.setCursor({left:St,top:0}),X.current=!1)},[Q,H,qe]);const Ee=w.useCallback(()=>{$.current&&($.current.style.display="none"),(Q==null?void 0:Q.sourceChartId)===H&&K(null)},[Q,H,K]),Ze=Ke&&!je,Ie=r||(ke?`${ke.charAt(0).toUpperCase()}${ke.slice(1)}`:n);return Y(f.jsxs("div",{ref:V,className:bt("group/chart flex flex-col bg-background",F?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!F&&Ze&&"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:[!F&&N,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",F?"text-sm":"text-xs"),title:n,children:Ie})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:oe,onCheckedChange:me,children:"Ignore Outliers"}),f.jsx(Er,{checked:de,onCheckedChange:Pe,children:"Ignore First Step"}),f.jsx(Bs,{}),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:ye??"",onChange:Ue=>{const rt=Ue.target.value;ce(rt===""?null:Number(rt))},onClick:Ue=>Ue.stopPropagation(),onKeyDown:Ue=>Ue.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:ge??"",onChange:Ue=>{const rt=Ue.target.value;He(rt===""?null:Number(rt))},onClick:Ue=>Ue.stopPropagation(),onKeyDown:Ue=>Ue.stopPropagation()})]}),L&&L.length>1&&f.jsxs(f.Fragment,{children:[f.jsx(Bs,{}),f.jsx(om,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),L.map(Ue=>f.jsx(Er,{checked:fe.includes(Ue),onCheckedChange:()=>Ge(Ue),children:Ue},Ue))]}),R&&Object.keys(R).length>0&&f.jsxs(f.Fragment,{children:[f.jsx(Bs,{}),f.jsx(om,{className:"text-[10px] text-muted-foreground",children:"Filter by Tag"}),Object.entries(R).map(([Ue,rt])=>{var ut;return f.jsxs(ade,{children:[f.jsxs(lde,{className:"text-xs",children:[Ue,(ut=Me[Ue])!=null&&ut.length?f.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",Me[Ue].length,")"]}):null]}),f.jsx(cde,{className:"max-h-[300px] overflow-y-auto",children:rt.map(Dt=>f.jsx(Er,{checked:(Me[Ue]??[]).includes(Dt),onCheckedChange:()=>Be(Ue,Dt),children:Dt},Dt))})]},Ue)})]})]})]}),f.jsx(Ox,{isFullscreen:F,onClick:B}),!F&&D]})]}),(oe||de||ye!==null||ge!==null||We||ae)&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[oe&&f.jsx(ko,{label:"Ignore Outliers",onRemove:()=>me(!1)}),de&&f.jsx(ko,{label:"Ignore First Step",onRemove:()=>Pe(!1)}),ye!==null&&f.jsx(ko,{label:`Min Y: ${ye}`,onRemove:()=>ce(null)}),ge!==null&&f.jsx(ko,{label:`Max Y: ${ge}`,onRemove:()=>He(null)}),fe.map(Ue=>f.jsx(ko,{label:`env: ${Ue}`,onRemove:()=>Ge(Ue)},`env:${Ue}`)),Object.entries(Me).map(([Ue,rt])=>rt.map(ut=>f.jsx(ko,{label:`${Ue}: ${ut}`,onRemove:()=>Be(Ue,ut)},`${Ue}:${ut}`)))]})]}),Te?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:q,onMouseLeave:Ee,children:[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"}}),je&&f.jsx(Zl,{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:Ke?"Loading...":"No data"})]}))}function mC(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}const vme=new Set(["avg_time_prefill","avg_time_decode","avg_time_compute_reward","avg_time_queue","avg_time_ttft","avg_time_inference","avg_time_e2e","avg_time_generation"]);function Fl({runs:t,shouldPoll:e,inferenceMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var Se,me,Pe,ce,He,Be,Ge,We,ae,Z;const l=qn(gs),{isFullscreen:c,toggleFullscreen:d,fullscreenPortal:p}=Ix(),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),[S,M]=w.useState(!1),[C,A]=w.useState(!0),[N,D]=w.useState(60),[R,L]=w.useState(Ko(60)),k=w.useCallback(he=>{const be=mC(he);be!==null&&be>=1?(D(be),L(Ko(be))):L(Ko(N))},[N]),F=Lx(m,{root:s,threshold:0})||c,B=vme.has(n),Y=w.useMemo(()=>{const he=t.filter(we=>!we.isSelected),be=t.filter(we=>we.isSelected);return[...he,...be]},[t]),V=w.useMemo(()=>Y.slice(0,20),[Y]),q=Wd(((Se=V[0])==null?void 0:Se.runPath)??"",F&&!!V[0],e,N),G=Wd(((me=V[1])==null?void 0:me.runPath)??"",F&&!!V[1],e,N),$=Wd(((Pe=V[2])==null?void 0:Pe.runPath)??"",F&&!!V[2],e,N),Q=Wd(((ce=V[3])==null?void 0:ce.runPath)??"",F&&!!V[3],e,N),K=Wd(((He=V[4])==null?void 0:He.runPath)??"",F&&!!V[4],e,N),re=Wd(((Be=V[5])==null?void 0:Be.runPath)??"",F&&!!V[5],e,N),U=Wd(((Ge=V[6])==null?void 0:Ge.runPath)??"",F&&!!V[6],e,N),H=Wd(((We=V[7])==null?void 0:We.runPath)??"",F&&!!V[7],e,N),X=Wd(((ae=V[8])==null?void 0:ae.runPath)??"",F&&!!V[8],e,N),j=Wd(((Z=V[9])==null?void 0:Z.runPath)??"",F&&!!V[9],e,N),le=w.useMemo(()=>[q,G,$,Q,K,re,U,H,X,j],[q,G,$,Q,K,re,U,H,X,j]),se=le.some((he,be)=>be<V.length&&he.isFetching),J=se&&le.filter((he,be)=>be<V.length&&he.isFetching).every(he=>!!he.data),{uplotData:ee,seriesConfig:ie,hasData:oe,outlierBounds:de}=w.useMemo(()=>{const he=new Map,be=new Set;let we=!1;if(V.forEach((Fe,Ke)=>{if(Ke>=10)return;const je=le[Ke].data;if(!je||je.first_time===null)return;const Te=je.first_time,Xe=je[n];if(!Xe||Xe.length===0)return;let ht=null;if(C){const et=je.step_times??[];et.length>0&&(ht=et[0].time-Te)}we=!0;const ke=new Map;if(Xe.forEach(et=>{const ct=B?et.value:et.count;if(ct!=null){if(B&&ct===0)return;const yt=et.time-Te;if(C&&ht!==null&&yt<ht)return;ke.set(yt,ct),be.add(yt)}}),!B&&ke.size>0){const et=Array.from(ke.keys()),ct=Math.min(...et),yt=Math.max(...et);for(let lt=ct+N;lt<yt;lt+=N)ke.has(lt)||(ke.set(lt,0),be.add(lt))}he.set(Ke,ke)}),!we||be.size===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};let ve=null;if(S){const Fe=[];he.forEach(Ke=>{Ke.forEach(je=>Fe.push(je))}),ve=pC(Fe)}const Re=Array.from(be).sort((Fe,Ke)=>Fe-Ke),Ae=new Float64Array(Re),Oe=[{label:"Time (s)"}],qe=[Ae];return V.forEach((Fe,Ke)=>{if(Ke>=10)return;const je=he.get(Ke),Te=Re.map(et=>(je==null?void 0:je.get(et))??null),Xe=i===Fe.runPath,ke=i!==null&&!Xe?.1:1;qe.push(Te),Oe.push({label:Sp(Fe),stroke:Fe.color,width:1,alpha:ke,spanGaps:!0,points:{show:!1}})}),{uplotData:qe,seriesConfig:Oe,hasData:!0,outlierBounds:ve}},[V,le,n,i,B,S,C,N]),ye=w.useCallback(he=>he==null?"N/A":B?Ak(he):gu(he),[B]),ge=w.useCallback(he=>B?ud(he):Math.abs(he)>=1e3?`${parseFloat((he/1e3).toFixed(1))}k`:Number.isInteger(he)?he.toLocaleString():String(parseFloat(he.toFixed(2))),[B]);w.useEffect(()=>{if(!x.current||!ee||!oe)return;const he=x.current,be=he.clientWidth,we=he.clientHeight||200;let ve=1/0,Re=-1/0;for(let yt=1;yt<ee.length;yt++){const lt=ee[yt];for(let Je=0;Je<lt.length;Je++){const Ee=lt[Je];Ee!=null&&Number.isFinite(Ee)&&(S&&de?Ee>=de.lower&&Ee<=de.upper&&(Ee<ve&&(ve=Ee),Ee>Re&&(Re=Ee)):(Ee<ve&&(ve=Ee),Ee>Re&&(Re=Ee)))}}ve===1/0&&de&&(ve=de.lower,Re=de.upper),ve===1/0&&(ve=0,Re=1);const Ae=Re-ve,Oe=Math.max(Math.abs(Re),Math.abs(ve)),qe=Math.max(Oe*.05,1e-10),Fe=Math.max(Ae*.1,qe),Ke=ve-Fe,je=Re+Fe,Te=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Xe=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ke={width:be,height:we,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Ke,je]}},axes:[{stroke:Xe,grid:{stroke:Te,width:1},ticks:{stroke:Te,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(yt,lt)=>lt.map(Je=>ud(Je))},{stroke:Xe,grid:{stroke:Te,width:1},ticks:{stroke:Te,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(yt,lt)=>{if(!lt||lt.length===0)return 40;const Je=Math.max(...lt.map(Ee=>Ee.length));return Math.max(40,Je*7+14)},values:(yt,lt)=>lt.map(ge)}],series:ie,hooks:{draw:[yt=>{var Je;if(!ee)return;const lt=yt.ctx;lt.save();for(let Ee=1;Ee<yt.series.length;Ee++){const Ze=ee[Ee];if(!Ze)continue;let Ie=-1;for(let en=Ze.length-1;en>=0;en--)if(Ze[en]!==null&&Ze[en]!==void 0){Ie=en;break}if(Ie===-1)continue;const Ue=ee[0][Ie],rt=Ze[Ie];if(Ue===void 0||rt===void 0||rt===null)continue;const ut=yt.valToPos(Number(Ue),"x",!0),Dt=yt.valToPos(Number(rt),"y",!0);if(!Number.isFinite(ut)||!Number.isFinite(Dt))continue;const Rt=yt.series[Ee],St=typeof(Rt==null?void 0:Rt.alpha)=="number"?Rt.alpha:1,Ht=typeof(Rt==null?void 0:Rt.stroke)=="string"?Rt.stroke:(Je=Y[Ee-1])==null?void 0:Je.color;Ht&&(lt.globalAlpha=St,lt.fillStyle=Ht,lt.beginPath(),lt.arc(ut,Dt,4,0,Math.PI*2),lt.fill())}lt.restore()}],setCursor:[yt=>{if(!_.current||!ee)return;const{left:lt,top:Je,idx:Ee}=yt.cursor;if(Ee==null||lt===void 0||Je===void 0||lt<0){_.current.style.display="none";return}const Ze=ee[0][Ee];if(Ze===void 0){_.current.style.display="none";return}let Ue=`<div class="font-medium mb-1">${`Time ${Ko(Number(Ze))}`}</div>`;t.forEach(St=>{const Ht=V.findIndex(dt=>dt.runPath===St.runPath);if(Ht===-1)return;const en=Ht+1,Ut=ee[en];if(!Ut)return;const $e=Ut[Ee];$e!=null&&(Ue+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${St.color}"></div>
                    <span>${Iw(St)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${ye($e)}</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=Ue,_.current.style.display="block";const rt=x.current.getBoundingClientRect(),ut=_.current.getBoundingClientRect();let Dt=rt.left+lt+15;Dt+ut.width+20>window.innerWidth&&(Dt=rt.left+lt-ut.width-15+yt.bbox.left),Dt=Math.max(4,Dt);let Rt=rt.top-ut.height+20;Rt<4&&(Rt=rt.top+8),_.current.style.left=`${Dt}px`,_.current.style.top=`${Rt}px`}]}};b.current&&b.current.destroy();const et=new ps(ke,ee,he);b.current=et;const ct=new ResizeObserver(yt=>{for(const lt of yt){const{width:Je,height:Ee}=lt.contentRect;et&&Je>0&&Ee>0&&et.setSize({width:Je,height:Ee})}});return ct.observe(he),()=>{ct.disconnect(),et.destroy(),b.current=null}},[ee,ie,oe,S,de,l,Y,t,V,i,ye,ge,N,c]);const Me=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),fe=se&&!J;return p(f.jsxs("div",{ref:m,className:bt("group/chart flex flex-col bg-background",c?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!c&&fe&&"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:[!c&&o,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:S,onCheckedChange:M,children:"Ignore Outliers"}),f.jsx(Er,{checked:C,onCheckedChange:A,children:"Ignore First Step"}),f.jsx(Bs,{}),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:R,onChange:he=>L(he.target.value),onBlur:he=>k(he.target.value),onKeyDown:he=>{he.stopPropagation(),he.key==="Enter"&&k(he.currentTarget.value)},onClick:he=>he.stopPropagation()})]})]})]}),f.jsx(Ox,{isFullscreen:c,onClick:d}),!c&&a]})]}),(S||C)&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[S&&f.jsx(ko,{label:"Ignoring Outliers",onRemove:()=>M(!1)}),C&&f.jsx(ko,{label:"Ignoring First Step",onRemove:()=>A(!1)})]})]}),oe?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:Me,children:[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"}}),J&&f.jsx(Zl,{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 yme({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null}){const i={runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r};return f.jsxs("div",{children:[f.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Breakdown (Area)"}),f.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:f.jsx(W$,{runs:t,shouldPoll:e,scrollRoot:r,label:"Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]})}),f.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Requests Count"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(Fl,{inferenceMetricType:"inference_calls",label:"Inference Calls",...i}),f.jsx(Fl,{inferenceMetricType:"requests_done",label:"Requests Done",...i}),f.jsx(Fl,{inferenceMetricType:"rollouts_group_done",label:"Rollouts Group Done",...i}),f.jsx(Fl,{inferenceMetricType:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",...i}),f.jsx(Fl,{inferenceMetricType:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",...i}),f.jsx(Fl,{inferenceMetricType:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",...i})]}),f.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Latency"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(Fl,{inferenceMetricType:"avg_time_queue",label:"Avg Queue Time",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_ttft",label:"Avg Time to First Token",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_prefill",label:"Avg Prefill Time",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_decode",label:"Avg Decode Time",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_inference",label:"Avg Inference Time",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_e2e",label:"Avg E2E Latency",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_generation",label:"Avg Generation Duration",...i}),f.jsx(Fl,{inferenceMetricType:"avg_time_compute_reward",label:"Avg Compute Reward Time",...i})]})]})}function H$({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return f.jsx(Fl,{runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a})}const V$=[{key:"inference_area_kept_vs_discarded_vs_canceled",label:"Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]}];function G$({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return f.jsx(W$,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const bme={idle:"Idle",working:"Working",working_except_weight_sync:"Working (excl. Weight Sync)",training:"Training",forward:"Forward",forward_backward:"Forward+Backward",backward:"Backward",optimizer:"Optimizer",loss:"Loss",loss_computation:"Loss Computation",weight_broadcast:"Weight Sync",data_wait:"Data Wait",grad_clip:"Grad Clip",grad_norm:"Grad Norm",data_to_device:"Data to Device",prepare_tensors:"Prepare Tensors",compute_entropy:"Compute Entropy",compute_kl:"Compute KL",finalize_model_grads:"Finalize Model Grads",checkpoint:"Checkpoint"};function o2(t){return bme[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function L_({runs:t,shouldPoll:e,trainerMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var oe,de,ye,ge,Me,fe,Se,me,Pe,ce;const l=qn(gs),{isFullscreen:c,toggleFullscreen:d,fullscreenPortal:p}=Ix(),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),[S,M]=w.useState(!0),[C,A]=w.useState(60),[N,D]=w.useState(Ko(60)),R=w.useCallback(He=>{const Be=mC(He);Be!==null&&Be>=1?(A(Be),D(Ko(Be))):D(Ko(C))},[C]),k=Lx(m,{root:s,threshold:0})||c,O=w.useMemo(()=>{const He=t.filter(Ge=>!Ge.isSelected),Be=t.filter(Ge=>Ge.isSelected);return[...He,...Be]},[t]),F=w.useMemo(()=>O.slice(0,20),[O]),B=Xu(((oe=F[0])==null?void 0:oe.runPath)??"",k&&!!F[0],e,C),Y=Xu(((de=F[1])==null?void 0:de.runPath)??"",k&&!!F[1],e,C),V=Xu(((ye=F[2])==null?void 0:ye.runPath)??"",k&&!!F[2],e,C),q=Xu(((ge=F[3])==null?void 0:ge.runPath)??"",k&&!!F[3],e,C),G=Xu(((Me=F[4])==null?void 0:Me.runPath)??"",k&&!!F[4],e,C),$=Xu(((fe=F[5])==null?void 0:fe.runPath)??"",k&&!!F[5],e,C),Q=Xu(((Se=F[6])==null?void 0:Se.runPath)??"",k&&!!F[6],e,C),K=Xu(((me=F[7])==null?void 0:me.runPath)??"",k&&!!F[7],e,C),re=Xu(((Pe=F[8])==null?void 0:Pe.runPath)??"",k&&!!F[8],e,C),U=Xu(((ce=F[9])==null?void 0:ce.runPath)??"",k&&!!F[9],e,C),H=w.useMemo(()=>[B,Y,V,q,G,$,Q,K,re,U],[B,Y,V,q,G,$,Q,K,re,U]),X=H.some((He,Be)=>Be<F.length&&He.isFetching),j=X&&H.filter((He,Be)=>Be<F.length&&He.isFetching).every(He=>!!He.data),{uplotData:le,seriesConfig:se,hasData:J}=w.useMemo(()=>{const He=new Map,Be=new Set;let Ge=!1;if(F.forEach((be,we)=>{if(we>=10)return;const ve=H[we].data;if(!ve||ve.first_time===null)return;const Re=ve.first_time,Ae=ve.buckets;if(!Ae||Ae.length===0)return;let Oe=null;if(S){const Fe=ve.step_times??[];Fe.length>0&&(Oe=Fe[0].time-Re)}Ge=!0;const qe=new Map;Ae.forEach(Fe=>{const Ke=Fe[n];if(Ke!=null){const je=Fe.time-Re;if(S&&Oe!==null&&je<Oe)return;qe.set(je,Ke),Be.add(je)}}),He.set(we,qe)}),!Ge||Be.size===0)return{uplotData:null,seriesConfig:[],hasData:!1};const We=Array.from(Be).sort((be,we)=>be-we),ae=new Float64Array(We),Z=[{label:"Time (s)"}],he=[ae];return F.forEach((be,we)=>{if(we>=10)return;const ve=He.get(we),Re=We.map(Fe=>(ve==null?void 0:ve.get(Fe))??null),Ae=i===be.runPath,qe=i!==null&&!Ae?.1:1;he.push(Re),Z.push({label:Sp(be),stroke:be.color,width:1,alpha:qe,spanGaps:!0,points:{show:!1}})}),{uplotData:he,seriesConfig:Z,hasData:!0}},[F,H,n,i,S]);w.useEffect(()=>{if(!x.current||!le||!J)return;const He=x.current,Be=He.clientWidth,Ge=He.clientHeight||200,We=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ae=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Z={width:Be,height:Ge,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,105]}},axes:[{stroke:ae,grid:{stroke:We,width:1},ticks:{stroke:We,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(we,ve)=>ve.map(Re=>ud(Re))},{stroke:ae,grid:{stroke:We,width:1},ticks:{stroke:We,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(we,ve)=>ve.map(Re=>`${parseFloat(Re.toFixed(1))}%`)}],series:se,hooks:{draw:[we=>{var Re;if(!le)return;const ve=we.ctx;ve.save();for(let Ae=1;Ae<we.series.length;Ae++){const Oe=le[Ae];if(!Oe)continue;let qe=-1;for(let et=Oe.length-1;et>=0;et--)if(Oe[et]!==null&&Oe[et]!==void 0){qe=et;break}if(qe===-1)continue;const Fe=le[0][qe],Ke=Oe[qe];if(Fe===void 0||Ke===void 0||Ke===null)continue;const je=we.valToPos(Number(Fe),"x",!0),Te=we.valToPos(Number(Ke),"y",!0);if(!Number.isFinite(je)||!Number.isFinite(Te))continue;const Xe=we.series[Ae],ht=typeof(Xe==null?void 0:Xe.alpha)=="number"?Xe.alpha:1,ke=typeof(Xe==null?void 0:Xe.stroke)=="string"?Xe.stroke:(Re=O[Ae-1])==null?void 0:Re.color;ke&&(ve.globalAlpha=ht,ve.fillStyle=ke,ve.beginPath(),ve.arc(je,Te,4,0,Math.PI*2),ve.fill())}ve.restore()}],setCursor:[we=>{if(!_.current||!le)return;const{left:ve,top:Re,idx:Ae}=we.cursor;if(Ae==null||ve===void 0||Re===void 0||ve<0){_.current.style.display="none";return}const Oe=le[0][Ae];if(Oe===void 0){_.current.style.display="none";return}let Fe=`<div class="font-medium mb-1">${`Time ${Ko(Number(Oe))}`}</div>`;t.forEach(ht=>{const ke=F.findIndex(lt=>lt.runPath===ht.runPath);if(ke===-1)return;const et=ke+1,ct=le[et];if(!ct)return;const yt=ct[Ae];yt!=null&&(Fe+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${ht.color}"></div>
                    <span>${Iw(ht)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${parseFloat(yt.toFixed(2))}%</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=Fe,_.current.style.display="block";const Ke=x.current.getBoundingClientRect(),je=_.current.getBoundingClientRect();let Te=Ke.left+ve+15;Te+je.width+20>window.innerWidth&&(Te=Ke.left+ve-je.width-15+we.bbox.left),Te=Math.max(4,Te);let Xe=Ke.top-je.height+20;Xe<4&&(Xe=Ke.top+8),_.current.style.left=`${Te}px`,_.current.style.top=`${Xe}px`}]}};b.current&&b.current.destroy();const he=new ps(Z,le,He);b.current=he;const be=new ResizeObserver(we=>{for(const ve of we){const{width:Re,height:Ae}=ve.contentRect;he&&Re>0&&Ae>0&&he.setSize({width:Re,height:Ae})}});return be.observe(He),()=>{be.disconnect(),he.destroy(),b.current=null}},[le,se,J,l,O,t,F,i,C,c]);const ee=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),ie=X&&!j;return p(f.jsxs("div",{ref:m,className:bt("group/chart flex flex-col bg-background",c?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!c&&ie&&"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:[!c&&o,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:S,onCheckedChange:M,children:"Ignore First Step"}),f.jsx(Bs,{}),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:N,onChange:He=>D(He.target.value),onBlur:He=>R(He.target.value),onKeyDown:He=>{He.stopPropagation(),He.key==="Enter"&&R(He.currentTarget.value)},onClick:He=>He.stopPropagation()})]})]})]}),f.jsx(Ox,{isFullscreen:c,onClick:d}),!c&&a]})]}),S&&f.jsx("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:f.jsx(ko,{label:"Ignoring First Step",onRemove:()=>M(!1)})})]}),J?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:ee,children:[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"}}),j&&f.jsx(Zl,{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:X?"Loading...":"No data"})]}))}const $k=["idle","data_wait","forward","forward_backward","loss","loss_computation","backward","optimizer","grad_clip","grad_norm","weight_broadcast","data_to_device","prepare_tensors","compute_entropy","compute_kl","finalize_model_grads","checkpoint"];function HA(t,e){return t==="idle"?e?n8:MS:t==="working"?"#3b82f6":t==="working_except_weight_sync"||t==="training"?"#6366f1":R_[t]||"#6b7280"}function Y0(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}const _me={kept:"Kept",discarded:"Discarded",canceled:"Canceled"};function VA(t){return _me[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function GA(t,e){return t==="kept"?H_:t==="discarded"?e?SS:_S:t==="canceled"?e?wS:QT:JT}const Sme={kept:"rollouts_group_done_kept",discarded:"rollouts_group_done_discarded",canceled:"rollouts_group_done_canceled"};function W$({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=qn(gs),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:d}=Ix(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,C]=w.useState(60),[A,N]=w.useState(Ko(60)),[D,R]=w.useState(null),[L,k]=w.useState([]),O=w.useCallback(ee=>{k(ie=>ie.includes(ee)?ie.filter(de=>de!==ee):[...ie,ee])},[]),F=w.useCallback(ee=>{const ie=mC(ee);ie!==null&&ie>=1?(C(ie),N(Ko(ie))):N(Ko(M))},[M]),Y=Lx(p,{root:i,threshold:0})||l,V=t.find(ee=>ee.isSelected)??t[0],q=Wd((V==null?void 0:V.runPath)??"",Y&&!!V,e,M),G=q.isFetching,$=G&&!!q.data,{filteredBuckets:Q,activeCategories:K,runFirstTime:re}=w.useMemo(()=>{const ee=q.data;if(!ee||ee.first_time===null)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const ie=ee.first_time,oe=new Map;for(const ge of r){const Me=Sme[ge];if(!Me)continue;const fe=ee[Me];if(fe)for(const Se of fe)oe.has(Se.time)||oe.set(Se.time,{time:Se.time}),oe.get(Se.time)[ge]=Se.count}let de=[...oe.values()].sort((ge,Me)=>ge.time-Me.time).map(ge=>{const Me=r.reduce((Se,me)=>Se+(ge[me]??0),0),fe={time:ge.time};for(const Se of r)fe[Se]=Me>0?(ge[Se]??0)/Me*100:0;return fe});if(_){const ge=ee.step_times??[];if(ge.length>0){const Me=ge[0].time-ie;de=de.filter(fe=>fe.time-ie>=Me)}}const ye=r.filter(ge=>de.some(Me=>Me[ge]!==void 0&&Me[ge]>0));return{filteredBuckets:de,activeCategories:ye,runFirstTime:ie}},[q.data,r,_]),U=w.useMemo(()=>{const ee=L.filter(ie=>K.includes(ie));return ee.length>0&&ee.length<K.length?new Set(ee):D&&K.includes(D)?new Set([D]):null},[L,D,K]),{uplotData:H,seriesConfig:X,bandsConfig:j,hasData:le}=w.useMemo(()=>{if(Q.length===0||K.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const ee=new Float64Array(Q.map(ge=>ge.time-re)),ie=[{label:"Time (s)"}],oe=[ee],de=[],ye=new Array(Q.length).fill(0);return K.forEach((ge,Me)=>{const fe=Q.map((He,Be)=>{const Ge=He[ge]??0;return ye[Be]+=Ge,ye[Be]}),Se=U!==null&&!U.has(ge),me=GA(ge,a),Pe=Se?Y0(me,.15):Y0(me,.6),ce=Se?Y0(me,.25):me;oe.push(fe),ie.push({label:VA(ge),stroke:ce,width:0,fill:Me===0?Pe:void 0,points:{show:!1}}),Me>0&&de.push({series:[Me+1,Me],fill:Pe})}),{uplotData:oe,seriesConfig:ie,bandsConfig:de,hasData:!0}},[Q,K,re,U,a]);w.useEffect(()=>{if(!m.current||!H||!le)return;const ee=m.current,ie=ee.clientWidth,oe=ee.clientHeight||200,de=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ye=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ge={width:ie,height:oe,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,105]}},axes:[{stroke:ye,grid:{stroke:de,width:1},ticks:{stroke:de,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Se,me)=>me.map(Pe=>ud(Pe))},{stroke:ye,grid:{stroke:de,width:1},ticks:{stroke:de,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Se,me)=>me.map(Pe=>`${parseFloat(Pe.toFixed(0))}%`)}],series:X,bands:j,hooks:{setCursor:[Se=>{if(!b.current||!H)return;const{left:me,top:Pe,idx:ce}=Se.cursor;if(ce==null||me===void 0||Pe===void 0||me<0){b.current.style.display="none";return}const He=H[0][ce];if(He===void 0){b.current.style.display="none";return}let Ge=`<div class="font-medium mb-1">${`Time ${Ko(Number(He))}`}</div>`,We=0;K.forEach((we,ve)=>{const Re=H[ve+1][ce],Ae=Re-We;if(We=Re,Ae<=0)return;const Oe=GA(we,a);Ge+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Oe}"></div>
                  <span>${VA(we)}</span>
                  <span class="font-medium ml-auto">${parseFloat(Ae.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=Ge,b.current.style.display="block";const ae=m.current.getBoundingClientRect(),Z=b.current.getBoundingClientRect();let he=ae.left+me+15;he+Z.width+20>window.innerWidth&&(he=ae.left+me-Z.width-15+Se.bbox.left),he=Math.max(4,he);let be=ae.top-Z.height+20;be<4&&(be=ae.top+8),b.current.style.left=`${he}px`,b.current.style.top=`${be}px`}]}};x.current&&x.current.destroy();const Me=new ps(ge,H,ee);x.current=Me;const fe=new ResizeObserver(Se=>{for(const me of Se){const{width:Pe,height:ce}=me.contentRect;Me&&Pe>0&&ce>0&&Me.setSize({width:Pe,height:ce})}});return fe.observe(ee),()=>{fe.disconnect(),Me.destroy(),x.current=null}},[H,X,j,le,a,K,M,l]);const se=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),J=G&&!$;return d(f.jsxs("div",{ref:p,className:bt("group/chart flex flex-col bg-background",l?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!l&&J&&"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:[!l&&s,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),f.jsx(Bs,{}),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:A,onChange:ee=>N(ee.target.value),onBlur:ee=>F(ee.target.value),onKeyDown:ee=>{ee.stopPropagation(),ee.key==="Enter"&&F(ee.currentTarget.value)},onClick:ee=>ee.stopPropagation()})]})]})]}),f.jsx(Ox,{isFullscreen:l,onClick:c}),!l&&o]})]}),_&&f.jsx("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:f.jsx(ko,{label:"Ignoring First Step",onRemove:()=>S(!1)})}),le&&K.length>0&&f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:K.map(ee=>{const ie=!!(U!=null&&U.has(ee)),oe=!!U&&U.size>0&&!ie,de=GA(ee,a);return f.jsxs("div",{className:bt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",ie&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:oe?.3:1},onPointerEnter:()=>R(ee),onPointerLeave:()=>R(null),onClick:()=>O(ee),children:[f.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:oe?Y0(de,.25):de}}),f.jsx("span",{className:"text-[10px] text-muted-foreground",children:VA(ee)})]},ee)})})]}),le?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:se,children:[f.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[400px] 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(Zl,{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:G?"Loading...":"No data"})]}))}function a2({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=qn(gs),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:d}=Ix(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,C]=w.useState(60),[A,N]=w.useState(Ko(60)),[D,R]=w.useState(null),[L,k]=w.useState([]),O=w.useCallback(ee=>{k(ie=>ie.includes(ee)?ie.filter(ye=>ye!==ee):[...ie,ee])},[]),F=w.useCallback(ee=>{const ie=mC(ee);ie!==null&&ie>=1?(C(ie),N(Ko(ie))):N(Ko(M))},[M]),Y=Lx(p,{root:i,threshold:0})||l,V=t.find(ee=>ee.isSelected)??t[0],q=Xu((V==null?void 0:V.runPath)??"",Y&&!!V,e,M),G=q.isFetching,$=G&&!!q.data,{filteredBuckets:Q,activeCategories:K,runFirstTime:re}=w.useMemo(()=>{const ee=q.data;if(!ee||ee.first_time===null||!ee.buckets||ee.buckets.length===0)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const ie=ee.first_time;let oe=ee.buckets;if(_){const ye=ee.step_times??[];if(ye.length>0){const ge=ye[0].time-ie;oe=oe.filter(Me=>Me.time-ie>=ge)}}const de=r.filter(ye=>oe.some(ge=>{const Me=ge[ye];return Me!==void 0&&Me>0}));return{filteredBuckets:oe,activeCategories:de,runFirstTime:ie}},[q.data,r,_]),U=w.useMemo(()=>{const ee=L.filter(ie=>K.includes(ie));return ee.length>0&&ee.length<K.length?new Set(ee):D&&K.includes(D)?new Set([D]):null},[L,D,K]),{uplotData:H,seriesConfig:X,bandsConfig:j,hasData:le}=w.useMemo(()=>{if(Q.length===0||K.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const ee=new Float64Array(Q.map(ge=>ge.time-re)),ie=[{label:"Time (s)"}],oe=[ee],de=[],ye=new Array(Q.length).fill(0);return K.forEach((ge,Me)=>{const fe=Q.map((He,Be)=>{const Ge=He[ge]??0;return ye[Be]+=Ge,ye[Be]}),Se=U!==null&&!U.has(ge),me=HA(ge,a),Pe=Se?Y0(me,.15):Y0(me,.6),ce=Se?Y0(me,.25):me;oe.push(fe),ie.push({label:o2(ge),stroke:ce,width:0,fill:Me===0?Pe:void 0,points:{show:!1}}),Me>0&&de.push({series:[Me+1,Me],fill:Pe})}),{uplotData:oe,seriesConfig:ie,bandsConfig:de,hasData:!0}},[Q,K,re,U,a]);w.useEffect(()=>{if(!m.current||!H||!le)return;const ee=m.current,ie=ee.clientWidth,oe=ee.clientHeight||200,de=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ye=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ge={width:ie,height:oe,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,105]}},axes:[{stroke:ye,grid:{stroke:de,width:1},ticks:{stroke:de,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Se,me)=>me.map(Pe=>ud(Pe))},{stroke:ye,grid:{stroke:de,width:1},ticks:{stroke:de,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Se,me)=>me.map(Pe=>`${parseFloat(Pe.toFixed(0))}%`)}],series:X,bands:j,hooks:{setCursor:[Se=>{if(!b.current||!H)return;const{left:me,top:Pe,idx:ce}=Se.cursor;if(ce==null||me===void 0||Pe===void 0||me<0){b.current.style.display="none";return}const He=H[0][ce];if(He===void 0){b.current.style.display="none";return}let Ge=`<div class="font-medium mb-1">${`Time ${Ko(Number(He))}`}</div>`,We=0;K.forEach((we,ve)=>{const Re=H[ve+1][ce],Ae=Re-We;if(We=Re,Ae<=0)return;const Oe=HA(we,a);Ge+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Oe}"></div>
                  <span>${o2(we)}</span>
                  <span class="font-medium ml-auto">${parseFloat(Ae.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=Ge,b.current.style.display="block";const ae=m.current.getBoundingClientRect(),Z=b.current.getBoundingClientRect();let he=ae.left+me+15;he+Z.width+20>window.innerWidth&&(he=ae.left+me-Z.width-15+Se.bbox.left),he=Math.max(4,he);let be=ae.top-Z.height+20;be<4&&(be=ae.top+8),b.current.style.left=`${he}px`,b.current.style.top=`${be}px`}]}};x.current&&x.current.destroy();const Me=new ps(ge,H,ee);x.current=Me;const fe=new ResizeObserver(Se=>{for(const me of Se){const{width:Pe,height:ce}=me.contentRect;Me&&Pe>0&&ce>0&&Me.setSize({width:Pe,height:ce})}});return fe.observe(ee),()=>{fe.disconnect(),Me.destroy(),x.current=null}},[H,X,j,le,a,K,M,l]);const se=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),J=G&&!$;return d(f.jsxs("div",{ref:p,className:bt("group/chart flex flex-col bg-background",l?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!l&&J&&"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:[!l&&s,f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),f.jsx(Bs,{}),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:A,onChange:ee=>N(ee.target.value),onBlur:ee=>F(ee.target.value),onKeyDown:ee=>{ee.stopPropagation(),ee.key==="Enter"&&F(ee.currentTarget.value)},onClick:ee=>ee.stopPropagation()})]})]})]}),f.jsx(Ox,{isFullscreen:l,onClick:c}),!l&&o]})]}),_&&f.jsx("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:f.jsx(ko,{label:"Ignoring First Step",onRemove:()=>S(!1)})}),le&&K.length>0&&f.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:K.map(ee=>{const ie=!!(U!=null&&U.has(ee)),oe=!!U&&U.size>0&&!ie,de=HA(ee,a);return f.jsxs("div",{className:bt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",ie&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:oe?.3:1},onPointerEnter:()=>R(ee),onPointerLeave:()=>R(null),onClick:()=>O(ee),children:[f.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:oe?Y0(de,.25):de}}),f.jsx("span",{className:"text-[10px] text-muted-foreground",children:o2(ee)})]},ee)})})]}),le?f.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:se,children:[f.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[400px] 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(Zl,{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:G?"Loading...":"No data"})]}))}function wme({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null}){var c;const i={runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r},s=t.find(d=>d.isSelected)??t[0],a=((c=Xu((s==null?void 0:s.runPath)??"",!!s,e).data)==null?void 0:c.event_types)??[],l=w.useMemo(()=>{const d=$k.filter(m=>a.includes(m)||m==="idle"),p=a.filter(m=>!$k.includes(m));return[...d,...p]},[a]);return f.jsxs("div",{children:[f.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Time Breakdown (Area)"}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[f.jsx(a2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Idle vs Working",categories:["idle","working"]}),f.jsx(a2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]}),f.jsx(a2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Detailed Breakdown",categories:l})]}),f.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"% Time per Category"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[f.jsx(L_,{trainerMetricType:"idle",label:"Idle",...i}),f.jsx(L_,{trainerMetricType:"working",label:"Working",...i}),f.jsx(L_,{trainerMetricType:"working_except_weight_sync",label:"Working (excl. Weight Sync)",...i}),a.map(d=>f.jsx(L_,{trainerMetricType:d,label:o2(d),...i},d))]})]})}function $$({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,trainerMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return f.jsx(L_,{runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r,trainerMetricType:i,label:s,headerPrefix:o,headerSuffix:a})}const q$=[{key:"trainer_area_idle_vs_working",label:"Idle vs Working",categories:["idle","working"]},{key:"trainer_area_idle_vs_training_vs_weight_sync",label:"Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]},{key:"trainer_area_detailed",label:"Detailed Breakdown",categories:[...$k]}];function X$({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return f.jsx(a2,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const bg=["mean","std","min","max"],_g={mean:"Mean",std:"Std",min:"Min",max:"Max"};function e5(){return Math.random().toString(36).slice(2,10)}function m1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Y$(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const o=m1(i);for(const[a,l]of Object.entries(s)){const c=a?m1(a):void 0;for(const d of l)r.push({section:o,group:c,metricKey:d,label:m1(d),plotType:"step_metric",simple:!0})}}for(const i of bg)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${_g[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=m1(i);for(const o of bg)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${o}`,label:`${s} ${_g[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 bg)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${_g[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=m1(o);for(const l of bg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`reward_${o}_${l}`,label:`${s} ${a} ${_g[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 bg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`${o}_${l}`,label:`${s} ${a} ${_g[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 bg)r.push({section:"Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${_g[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});r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_mean",label:"Off-Policy Steps (Mean)",plotType:"step_metric",simple:!0}),r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_std",label:"Off-Policy Steps (Std)",plotType:"step_metric",simple:!0}),r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_distribution_over_time",label:"Off-Policy Steps Dist. Over Time",plotType:"distribution_over_time",distMetricType:"off_policy_steps"});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:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_mean",label:"Off-Policy Steps (Mean)",plotType:"step_metric",simple:!0}),r.push({section:"Discarded Rollouts",group:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_std",label:"Off-Policy Steps (Std)",plotType:"step_metric",simple:!0}),r.push({section:"Discarded Rollouts",group:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_distribution_over_time",label:"Off-Policy Steps Dist. Over Time",plotType:"distribution_over_time",distMetricType:"discarded_off_policy_steps"}),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 bg)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${_g[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",group:"Requests Count",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of[{key:"avg_time_queue",label:"Avg Queue Time",inferenceMetricType:"avg_time_queue"},{key:"avg_time_ttft",label:"Avg Time to First Token",inferenceMetricType:"avg_time_ttft"},{key:"avg_time_prefill",label:"Avg Prefill Time",inferenceMetricType:"avg_time_prefill"},{key:"avg_time_decode",label:"Avg Decode Time",inferenceMetricType:"avg_time_decode"},{key:"avg_time_inference",label:"Avg Inference Time",inferenceMetricType:"avg_time_inference"},{key:"avg_time_e2e",label:"Avg E2E Latency",inferenceMetricType:"avg_time_e2e"},{key:"avg_time_generation",label:"Avg Generation Duration",inferenceMetricType:"avg_time_generation"},{key:"avg_time_compute_reward",label:"Avg Compute Reward Time",inferenceMetricType:"avg_time_compute_reward"}])r.push({section:"Inference Performance",group:"Latency",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of V$)r.push({section:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"inference_performance_area",inferenceAreaCategories:[...i.categories]});for(const i of q$)r.push({section:"Trainer Performance",group:"Time Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"trainer_performance_area",trainerAreaCategories:[...i.categories]});for(const i of[{key:"trainer_perf_idle",label:"Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Working (excl. Weight Sync)",trainerMetricType:"working_except_weight_sync"}])r.push({section:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,plotType:"trainer_performance",trainerMetricType:i.trainerMetricType});for(const i of[{key:"trainer_perf_forward",label:"Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_data_to_device",label:"Data to Device",trainerMetricType:"data_to_device"},{key:"trainer_perf_prepare_tensors",label:"Prepare Tensors",trainerMetricType:"prepare_tensors"},{key:"trainer_perf_compute_entropy",label:"Compute Entropy",trainerMetricType:"compute_entropy"},{key:"trainer_perf_compute_kl",label:"Compute KL",trainerMetricType:"compute_kl"},{key:"trainer_perf_checkpoint",label:"Checkpoint",trainerMetricType:"checkpoint"}])r.push({section:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,plotType:"trainer_performance",trainerMetricType:i.trainerMetricType});return r}async function GO(t){await fetch(`${rr}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}async function WO(t,e){await fetch(`${rr}/custom-metrics-templates/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}function t5({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[o,a]=w.useState(i),[l,c]=w.useState(""),d=w.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(nd,{open:t,onOpenChange:p,children:f.jsxs(rd,{className:"sm:max-w-[340px]",children:[f.jsx(iu,{children:f.jsx(su,{children:n})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(ah,{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(XT,{children:f.jsx(En,{size:"sm",onClick:m,children:i?"Rename":"Create"})})]})})}function $O(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function my({catalog:t,onSelect:e,onDeselect:n,existingPlots:r,children:i,allowDuplicates:s=!1}){const o=w.useMemo(()=>{const m=new Map;for(const x of r??[]){const b=$O(x);m.set(b,(m.get(b)??0)+1)}return m},[r]),[a,l]=w.useState(!1),[c,d]=w.useState(""),p=w.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 M=_.group||"";let C=S.groups.find(A=>A.group===M);C||(C={group:M,items:[]},S.groups.push(C)),C.items.push(_)}return b},[t,c]);return f.jsxs(YT,{open:a,onOpenChange:l,children:[f.jsx(KT,{asChild:!0,children:i}),f.jsxs(ZT,{align:"start",className:"w-[320px] p-0",onClick:m=>m.stopPropagation(),children:[f.jsx("div",{className:"p-2 border-b",children:f.jsx(ah,{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($O(b))??0,S=_>0;return f.jsxs("button",{type:"button",className:bt("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(Nm,{className:"h-3 w-3 text-muted-foreground shrink-0"})]},`${b.plotType}-${b.evalName||""}-${b.metricKey}`)})]},`${m.section}-${x.group}`))]},m.section))]})]})]})}function K$({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return f.jsx(O2,{open:t,onOpenChange:e,children:f.jsxs(L2,{children:[f.jsxs(j2,{children:[f.jsx(F2,{children:n}),f.jsx(U2,{children:r})]}),f.jsxs(z2,{children:[f.jsx(H2,{children:"Cancel"}),f.jsx(B2,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function R8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:o,transition:a,isDragging:l}=sC({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||m1(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(GT,{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(qa,{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(J2,{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?f.jsx(H$,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,inferenceMetricType:t.inferenceMetricType,label:d,headerPrefix:p,headerSuffix:m}):t.plotType==="inference_performance_area"&&t.inferenceAreaCategories?f.jsx(G$,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:d,categories:t.inferenceAreaCategories,headerPrefix:p,headerSuffix:m}):t.plotType==="trainer_performance"&&t.trainerMetricType?f.jsx($$,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,trainerMetricType:t.trainerMetricType,label:d,headerPrefix:p,headerSuffix:m}):t.plotType==="trainer_performance_area"&&t.trainerAreaCategories?f.jsx(X$,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:d,categories:t.trainerAreaCategories,headerPrefix:p,headerSuffix:m}):t.plotType==="eval_metric"&&t.evalName?f.jsx(B$,{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,availableEnvs:n.availableEnvs,headerPrefix:p,headerSuffix:m,filterKey:t.id}):f.jsx(Jn,{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,availableEnvs:n.availableEnvs,headerPrefix:p,headerSuffix:m,filterKey:t.id})})}function Mme({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[d,p]=w.useState(!1),[m,x]=w.useState(!1),{attributes:b,listeners:_,setNodeRef:S,transform:M,transition:C,isDragging:A}=sC({id:t.id}),N={transform:iy.Transform.toString(M),transition:C,opacity:A?.4:1},D=F=>{const B={id:e5(),metricKey:F.metricKey,label:F.label,plotType:F.plotType,evalName:F.evalName,distMetricType:F.distMetricType,inferenceMetricType:F.inferenceMetricType,inferenceAreaCategories:F.inferenceAreaCategories,trainerMetricType:F.trainerMetricType,trainerAreaCategories:F.trainerAreaCategories};r({...t,plots:[...t.plots,B]})},R=F=>{r({...t,plots:t.plots.filter(B=>B.id!==F)})},L=F=>{r({...t,name:F})},k=sy(id(cm,{activationConstraint:{distance:5}}),id(lm,{coordinateGetter:cy})),O=F=>{const{active:B,over:Y}=F;if(!Y||B.id===Y.id)return;const V=t.plots.findIndex(G=>G.id===B.id),q=t.plots.findIndex(G=>G.id===Y.id);V===-1||q===-1||r({...t,plots:um(t.plots,V,q)})};return f.jsxs("div",{ref:S,style:N,children:[f.jsxs(Pi,{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(Di,{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(kr,{className:bt("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:bt("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(GT,{className:"h-3.5 w-3.5 text-muted-foreground"})}),f.jsxs("div",{className:bt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[f.jsx(my,{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(hp,{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(oW,{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(qa,{className:"h-3 w-3 text-muted-foreground"})})]})]}),f.jsx(Ii,{children:f.jsx(ay,{sensors:k,collisionDetection:oy,onDragEnd:O,children:f.jsx(ly,{items:t.plots.map(F=>F.id),strategy:Dw,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(F=>f.jsx(R8,{plot:F,onRemove:()=>R(F.id),chartProps:s},F.id)),t.plots.length===0&&f.jsx(my,{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(hp,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),f.jsx(t5,{open:d,onOpenChange:p,title:"Rename Group",existingNames:n.filter(F=>F!==t.name),onSubmit:L,initialValue:t.name}),f.jsx(K$,{open:m,onOpenChange:x,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function Tme({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[d,p]=w.useState(!1),[m,x]=w.useState(!1),[b,_]=w.useState(!1),{attributes:S,listeners:M,setNodeRef:C,transform:A,transition:N,isDragging:D}=sC({id:t.id}),R={transform:iy.Transform.toString(A),transition:N,opacity:D?.4:1},L=t.groups.map(K=>K.name),k=K=>{const re={id:e5(),name:K,plots:[]};r({...t,groups:[...t.groups,re]})},O=(K,re)=>{r({...t,groups:t.groups.map(U=>U.id===K?re:U)})},F=K=>{r({...t,groups:t.groups.filter(re=>re.id!==K)})},B=K=>{const re={id:e5(),metricKey:K.metricKey,label:K.label,plotType:K.plotType,evalName:K.evalName,distMetricType:K.distMetricType,inferenceMetricType:K.inferenceMetricType,inferenceAreaCategories:K.inferenceAreaCategories,trainerMetricType:K.trainerMetricType,trainerAreaCategories:K.trainerAreaCategories};r({...t,plots:[...t.plots,re]})},Y=K=>{r({...t,plots:t.plots.filter(re=>re.id!==K)})},V=K=>{r({...t,name:K})},q=sy(id(cm,{activationConstraint:{distance:5}}),id(lm,{coordinateGetter:cy})),G=K=>{const{active:re,over:U}=K;if(!U||re.id===U.id)return;const H=t.groups.findIndex(j=>j.id===re.id),X=t.groups.findIndex(j=>j.id===U.id);H===-1||X===-1||r({...t,groups:um(t.groups,H,X)})},$=sy(id(cm,{activationConstraint:{distance:5}}),id(lm,{coordinateGetter:cy})),Q=K=>{const{active:re,over:U}=K;if(!U||re.id===U.id)return;const H=t.plots.findIndex(j=>j.id===re.id),X=t.plots.findIndex(j=>j.id===U.id);H===-1||X===-1||r({...t,plots:um(t.plots,H,X)})};return f.jsxs("div",{ref:C,style:R,children:[f.jsxs(Pi,{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(Di,{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(kr,{className:bt("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,...M,className:bt("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(GT,{className:"h-4 w-4 text-muted-foreground"})}),f.jsxs("div",{className:bt("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(hp,{className:"h-3 w-3"}),"New Group"]}),f.jsx(my,{catalog:e,onSelect:B,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(hp,{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(oW,{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(qa,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),f.jsxs(Ii,{children:[t.plots.length>0&&f.jsx(ay,{sensors:$,collisionDetection:oy,onDragEnd:Q,children:f.jsx(ly,{items:t.plots.map(K=>K.id),strategy:Dw,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(R8,{plot:K,onRemove:()=>Y(K.id),chartProps:s},K.id))})})}),f.jsx(ay,{sensors:q,collisionDetection:oy,onDragEnd:G,children:f.jsx(ly,{items:t.groups.map(K=>K.id),strategy:h8,children:f.jsx("div",{className:"space-y-2",children:t.groups.map(K=>f.jsx(Mme,{group:K,catalog:e,groupNames:L,onUpdate:re=>O(K.id,re),onRemove:()=>F(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(En,{size:"sm",variant:"outline",onClick:()=>p(!0),children:[f.jsx(hp,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),f.jsx(my,{catalog:e,onSelect:B,existingPlots:t.plots,allowDuplicates:!0,children:f.jsxs(En,{size:"sm",variant:"outline",children:[f.jsx(hp,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),f.jsx(t5,{open:d,onOpenChange:p,title:"New Group",existingNames:L,onSubmit:k}),f.jsx(t5,{open:m,onOpenChange:x,title:"Rename Section",existingNames:n.filter(K=>K!==t.name),onSubmit:V,initialValue:t.name}),f.jsx(K$,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function Cme({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,availableEnvs:b,activeTemplateId:_,layoutSnapshotTrigger:S,onLayoutSnapshot:M}){var Te,Xe,ht,ke,et,ct,yt,lt,Je,Ee,Ze,Ie,Ue,rt,ut,Dt,Rt,St,Ht,en;const C=Cx(),{data:A,isLoading:N}=hW(),{data:D}=Lde(_),[R,L]=w.useState({sections:[]}),[k,O]=w.useState(!1),[F,B]=w.useState(!1),[Y,V]=w.useState(void 0);_!==Y?_===null?A&&(V(null),L(A.layout??{sections:[]})):D&&D.id===_&&(V(_),L(D.layout??{sections:[]})):!F&&_===null&&A&&(B(!0),V(null),A.layout&&L(A.layout));const[q,G]=w.useState(m);m!==q&&(G(m),O(!0));const[$,Q]=w.useState(S);S!==$&&(Q(S),M(R));const K=w.useRef(null),re=w.useRef(null),U=w.useRef(_);U.current=_;const H=w.useCallback(Ut=>{L(Ut);const $e=U.current;$e===null?C.setQueryData(["custom-metrics-layout"],{layout:Ut}):C.setQueryData(["custom-metrics-template",$e],dt=>dt&&{...dt,layout:Ut}),re.current=Ut,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{if(re.current){const dt=re.current;re.current=null;const Tt=U.current;Tt===null?await GO(dt):await WO(Tt,dt)}},500)},[C]);w.useEffect(()=>()=>{if(K.current&&clearTimeout(K.current),re.current){const Ut=re.current;re.current=null;const $e=U.current;$e===null?GO(Ut):WO($e,Ut)}},[]);const X=w.useMemo(()=>Y$(o,s,p),[o,s,p]),j=a==="time",le=Vr(((Te=t[0])==null?void 0:Te.runPath)||"",j&&!!t[0],e),se=Vr(((Xe=t[1])==null?void 0:Xe.runPath)||"",j&&!!t[1],e),J=Vr(((ht=t[2])==null?void 0:ht.runPath)||"",j&&!!t[2],e),ee=Vr(((ke=t[3])==null?void 0:ke.runPath)||"",j&&!!t[3],e),ie=Vr(((et=t[4])==null?void 0:et.runPath)||"",j&&!!t[4],e),oe=Vr(((ct=t[5])==null?void 0:ct.runPath)||"",j&&!!t[5],e),de=Vr(((yt=t[6])==null?void 0:yt.runPath)||"",j&&!!t[6],e),ye=Vr(((lt=t[7])==null?void 0:lt.runPath)||"",j&&!!t[7],e),ge=Vr(((Je=t[8])==null?void 0:Je.runPath)||"",j&&!!t[8],e),Me=Vr(((Ee=t[9])==null?void 0:Ee.runPath)||"",j&&!!t[9],e),fe=Vr(((Ze=t[10])==null?void 0:Ze.runPath)||"",j&&!!t[10],e),Se=Vr(((Ie=t[11])==null?void 0:Ie.runPath)||"",j&&!!t[11],e),me=Vr(((Ue=t[12])==null?void 0:Ue.runPath)||"",j&&!!t[12],e),Pe=Vr(((rt=t[13])==null?void 0:rt.runPath)||"",j&&!!t[13],e),ce=Vr(((ut=t[14])==null?void 0:ut.runPath)||"",j&&!!t[14],e),He=Vr(((Dt=t[15])==null?void 0:Dt.runPath)||"",j&&!!t[15],e),Be=Vr(((Rt=t[16])==null?void 0:Rt.runPath)||"",j&&!!t[16],e),Ge=Vr(((St=t[17])==null?void 0:St.runPath)||"",j&&!!t[17],e),We=Vr(((Ht=t[18])==null?void 0:Ht.runPath)||"",j&&!!t[18],e),ae=Vr(((en=t[19])==null?void 0:en.runPath)||"",j&&!!t[19],e),Z=w.useMemo(()=>[le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae],[le,se,J,ee,ie,oe,de,ye,ge,Me,fe,Se,me,Pe,ce,He,Be,Ge,We,ae]),{isStepTimesFetching:he,isStepTimesRefetching:be}=w.useMemo(()=>{if(!j)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Ut=Z.some(Tt=>Tt.isFetching),$e=Z.filter(Tt=>Tt.isFetching),dt=Ut&&$e.length>0&&$e.every(Tt=>!!Tt.data);return{isStepTimesFetching:Ut,isStepTimesRefetching:dt}},[j,Z]),{stepTimesByRun:we,firstStepTimesByRun:ve}=w.useMemo(()=>{if(!j)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Ut=new Map,$e=new Map;return t.forEach((dt,Tt)=>{if(Tt>=20)return;const Ct=Z[Tt].data;if(!Ct||Ct.first_step_time===null||Ct.first_step_time===void 0||!Ct.step_times||Ct.step_times.length===0)return;const At=new Map;Ct.step_times.forEach(Ot=>{typeof Ot.time=="number"&&At.set(Ot.step,Ot.time)}),At.size>0&&(Ut.set(dt.runPath,At),$e.set(dt.runPath,Ct.first_step_time))}),{stepTimesByRun:Ut,firstStepTimesByRun:$e}},[t,j,Z]),Re=w.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:d,stepTimesByRun:we,firstStepTimesByRun:ve,isStepTimesFetching:he,isStepTimesRefetching:be,availableSampleTags:x,availableEnvs:b}),[t,e,n,r,i,a,l,c,d,we,ve,he,be,x,b]),Ae=R.sections.map(Ut=>Ut.name),Oe=Ut=>{const $e={id:e5(),name:Ut,groups:[],plots:[]};H({sections:[...R.sections,$e]})},qe=(Ut,$e)=>{H({sections:R.sections.map(dt=>dt.id===Ut?$e:dt)})},Fe=Ut=>{H({sections:R.sections.filter($e=>$e.id!==Ut)})},Ke=sy(id(cm,{activationConstraint:{distance:8}}),id(lm,{coordinateGetter:cy})),je=Ut=>{const{active:$e,over:dt}=Ut;if(!dt||$e.id===dt.id)return;const Tt=R.sections.findIndex(Ct=>Ct.id===$e.id),Bt=R.sections.findIndex(Ct=>Ct.id===dt.id);Tt===-1||Bt===-1||H({sections:um(R.sections,Tt,Bt)})};return f.jsxs("div",{className:"-mt-3",children:[f.jsx(ay,{sensors:Ke,collisionDetection:oy,onDragEnd:je,children:f.jsx(ly,{items:R.sections.map(Ut=>Ut.id),strategy:h8,children:R.sections.map((Ut,$e)=>f.jsxs("div",{children:[$e>0&&f.jsx("div",{className:"border-t border-gray-200 my-3"}),f.jsx(Tme,{section:Ut,catalog:X,allSectionNames:Ae,onUpdate:dt=>qe(Ut.id,dt),onRemove:()=>Fe(Ut.id),chartProps:Re})]},Ut.id))})}),R.sections.length===0&&N&&f.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[f.jsx(Zl,{className:"h-4 w-4 animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading..."})]}),R.sections.length===0&&!N&&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(En,{size:"sm",variant:"outline",onClick:()=>O(!0),children:[f.jsx(hp,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),f.jsx(t5,{open:k,onOpenChange:O,title:"New Section",existingNames:Ae,onSubmit:Oe})]})}const qO=100;function Z$({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/qO;return f.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:qO}).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 XO(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 Eme(t,e){const[n,r]=w.useState(null);if(w.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 Ame(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 Nme(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 l_(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 kme(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 Rme({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:XO(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: ",XO(r)]})]})]}),f.jsx(Z$,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function Pme({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(Z$,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function Dme(){var We,ae,Z,he,be,we,ve,Re,Ae,Oe,qe;const t=qn(bl),e=qn(LT),n=qn(FT),r=td(qG),i=td(XG),[s,o]=w.useState(!0),[a,l]=w.useState(!0),[c,d]=w.useState("custom"),[p,m]=w.useState(0),[x,b]=w.useState(0),[_,S]=hn(rce),[M,C]=hn(ice),[A,N]=w.useState(String(M)),[D,R]=hn(sce),[L,k]=hn(YG),[O,F]=hn(KG),[B,Y]=hn(ace),V=D?n:null,{data:q,isLoading:G,error:$}=gd(t||"",!!t,!0),{data:Q}=km(),K=w.useMemo(()=>{const Fe=(Q==null?void 0:Q.runs)||[],Ke=new Set(e);return t&&Ke.add(t),Fe.filter(je=>Ke.has(je.run_id)).map(je=>({runPath:je.run_id,runName:je.name,color:je.color,isSelected:je.run_id===t}))},[t,e,Q==null?void 0:Q.runs]);w.useEffect(()=>{q&&(r(q.is_tracking),i(q.is_syncing))},[q,r,i]);const re=typeof((We=q==null?void 0:q.config)==null?void 0:We.number_of_steps)=="number"?q.config.number_of_steps:null,U=typeof((ae=q==null?void 0:q.config)==null?void 0:ae.prompts_batch_size_for_trainer)=="number"?q.config.prompts_batch_size_for_trainer:typeof((Z=q==null?void 0:q.config)==null?void 0:Z.batch_size_for_trainer)=="number"?q.config.batch_size_for_trainer:null,H=(he=q==null?void 0:q.summary)!=null&&he.steps&&typeof q.summary.steps=="object"?q.summary.steps:null,X=l_((be=q==null?void 0:q.summary)==null?void 0:be["steps/last_training_step"])??l_(H==null?void 0:H.last_training_step)??l_((we=q==null?void 0:q.trainer_info)==null?void 0:we.last_training_step)??l_((ve=q==null?void 0:q.rollout_info)==null?void 0:ve.last_training_step)??l_(q==null?void 0:q.last_rollout_step)??-1,j=q==null?void 0:q.trainer_bucket_info,le=((Re=q==null?void 0:q.step_metrics_info)==null?void 0:Re.local_steps)??0,se=((Ae=q==null?void 0:q.step_metrics_info)==null?void 0:Ae.custom_metric_sections)??{},J=(q==null?void 0:q.available_rollout_metric_names)??[],ee=((Oe=q==null?void 0:q.eval_info)==null?void 0:Oe.evals)??[],ie=w.useMemo(()=>Y$(se,J,ee),[se,J,ee]),oe=w.useMemo(()=>{if(D)return K;const Fe=K.find(Ke=>Ke.isSelected);return Fe?[Fe]:K.slice(0,1)},[D,K]),de=sy(id(cm,{activationConstraint:{distance:5}}),id(lm,{coordinateGetter:cy})),ye=w.useCallback(Fe=>{const{active:Ke,over:je}=Fe;!je||Ke.id===je.id||Y(Te=>{const Xe=Te.findIndex(ke=>ke.id===Ke.id),ht=Te.findIndex(ke=>ke.id===je.id);return Xe===-1||ht===-1?Te:um(Te,Xe,ht)})},[Y]),ge=(q==null?void 0:q.available_sample_tags)??{},Me=(q==null?void 0:q.available_envs)??[],fe=w.useMemo(()=>({runs:oe,shouldPoll:!0,showEma:_,emaSpan:M,hoveredRunId:V,xAxisMode:"step",scrollRoot:null,availableSampleTags:ge,availableEnvs:Me}),[oe,_,M,V,ge,Me]),Se=w.useMemo(()=>!t||!(Q!=null&&Q.runs)?null:Q.runs.find(Fe=>Fe.run_id===t)??null,[t,Q]),me=((qe=Se==null?void 0:Se.state)==null?void 0:qe.toLowerCase())==="running",Pe=Eme((Se==null?void 0:Se.created_at)??null,me),ce=w.useMemo(()=>{var je,Te,Xe;if(me)return null;const Fe=(je=q==null?void 0:q.summary)==null?void 0:je._runtime;if(typeof Fe=="number")return Fe;const Ke=(Xe=(Te=q==null?void 0:q.summary)==null?void 0:Te._wandb)==null?void 0:Xe.runtime;return typeof Ke=="number"?Ke:null},[me,q==null?void 0:q.summary]),He=me?Pe:ce,{data:Be}=dW(t||"","timing_step_total",!!t&&!!re&&X>0,!0),Ge=w.useMemo(()=>{if(!(Be!=null&&Be.metrics)||!re||X<=0)return null;const Fe=Be.metrics.filter(Te=>Te.metric_name==="timing_step_total").map(Te=>({step:Te.step,value:Te.value}));if(Fe.length===0)return null;const Ke=Math.min(...Fe.map(Te=>Te.step)),je=Fe.filter(Te=>Te.step!==Ke);return kme(je,X,re)},[Be,re,X]);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:Se&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:Se.color}}),f.jsx("span",{className:"text-sm font-semibold truncate",children:Se.name||Se.run_id.split("/").pop()}),f.jsx("span",{className:"text-sm text-muted-foreground truncate",children:Se.run_id}),Se.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 ",Ame(Se.created_at)]})]})]})})})}),f.jsx("div",{className:L||O?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:L?f.jsx(ape,{runPath:t,onBack:()=>k(!1)},t):O?f.jsx(upe,{runPath:t,onBack:()=>F(!1)},`logs-${t}`):f.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[G?f.jsxs("div",{className:"space-y-3",children:[f.jsx(op,{className:"h-4 w-32"}),f.jsx(op,{className:"h-8 w-64"}),f.jsx(op,{className:"h-8 w-full"})]}):$?f.jsx(ld,{className:"border-destructive",children:f.jsx(lh,{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:[re!==null?f.jsx(Rme,{currentStep:X,totalSteps:re,runtimeSeconds:He??null,estimatedSecondsToFinish:Ge}):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…"})})]}),U!==null&&j&&f.jsx(Pme,{groupsDone:j.groups_done,totalGroups:U,step:j.step,waitingBuckets:q==null?void 0:q.waiting_buckets})]}),le>0&&K.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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o(!1),children:"Hide Plots"}),f.jsx(AS,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:S,value:A,onValueChange:N,onValueCommit:Fe=>{const Ke=parseInt(Fe,10);!isNaN(Ke)&&Ke>=2&&Ke<=100?(C(Ke),N(Ke.toString())):N(M.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),f.jsx(N1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:R,className:"text-xs px-2",children:"All selected runs"}),f.jsx(my,{catalog:ie,existingPlots:B,allowDuplicates:!0,onSelect:Fe=>{const Ke=Math.random().toString(36).slice(2,10);Y(je=>[...je,{id:Ke,metricKey:Fe.metricKey,label:Fe.label,plotType:Fe.plotType,evalName:Fe.evalName,distMetricType:Fe.distMetricType,inferenceMetricType:Fe.inferenceMetricType,inferenceAreaCategories:Fe.inferenceAreaCategories,trainerMetricType:Fe.trainerMetricType,trainerAreaCategories:Fe.trainerAreaCategories}])},children:f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),f.jsx(ay,{sensors:de,collisionDetection:oy,onDragEnd:ye,children:f.jsx(ly,{items:B.map(Fe=>Fe.id),strategy:Dw,children:f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:B.map(Fe=>f.jsx(R8,{plot:Fe,onRemove:()=>Y(Ke=>Ke.filter(je=>je.id!==Fe.id)),chartProps:fe},Fe.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"})]})}),(q==null?void 0:q.config)&&(()=>{const{model:Fe,envNames:Ke}=Nme(q.config);return!Fe&&Ke.length===0?null:f.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Fe&&f.jsx("span",{className:"font-semibold",children:Fe}),Ke.map(je=>f.jsx("span",{className:"text-muted-foreground",children:je},je))]})})(),(q==null?void 0:q.config)&&Object.keys(q.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"}),q.custom_config&&f.jsxs(dm,{type:"single",value:c,onValueChange:Fe=>{Fe&&d(Fe)},variant:"outline",size:"sm",children:[f.jsx(Xa,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),f.jsx(Xa,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),f.jsx(Whe,{currentRunId:t,currentConfig:q.config}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{m(Fe=>Fe+1)},children:"Collapse All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(Fe=>Fe+1)},children:"Expand All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>k(!0),children:"Code"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>F(!0),children:"Logs"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),f.jsx(xW,{config:c==="custom"&&q.custom_config?q.custom_config:q.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(Rm,{description:"Select a run from the sidebar or add a new one to get started."})}const P4=Ko;function Ime(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 Ome(){var Oe;const[t,e]=w.useState(null),n=w.useRef(0),[r,i]=hn(pce),s=qn(bl),o=qn(LT),a=qn(FT),[l,c]=hn(mce),[d,p]=w.useState(0),m=Cx(),[x,b]=hn(gce),[_,S]=hn(xce),{data:M}=Ode(),C=(M==null?void 0:M.templates)??[],[A,N]=w.useState(!1),[D,R]=w.useState(!1),[L,k]=w.useState("new"),[O,F]=w.useState(""),[B,Y]=w.useState(!1),[V,q]=w.useState(0),G=w.useRef(null),$=w.useRef(null),Q=w.useCallback(qe=>{k(qe),F(qe==="rename"?_??"":""),qe==="new"?($.current={sections:[]},R(!0)):qe==="duplicate"?(G.current=Fe=>{G.current=null,$.current=Fe,R(!0)},q(Fe=>Fe+1)):R(!0)},[_]),K=w.useCallback(async()=>{const qe=O.trim();if(qe){if(L==="new"||L==="duplicate"){const Fe=$.current??{sections:[]},Ke=await fetch(`${rr}/custom-metrics-templates`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:qe,layout:Fe})});if(Ke.ok){const je=await Ke.json();b(je.id),S(je.name),m.invalidateQueries({queryKey:["custom-metrics-templates"]})}$.current=null}else L==="rename"&&x&&(await fetch(`${rr}/custom-metrics-templates/${x}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:qe})})).ok&&(S(qe),m.invalidateQueries({queryKey:["custom-metrics-templates"]}));R(!1)}},[O,L,x,b,S,m]),re=w.useCallback(qe=>{qe===null?(b(null),S(null)):(b(qe.id),S(qe.name)),N(!1)},[b,S]),U=w.useCallback(async()=>{x&&(await fetch(`${rr}/custom-metrics-templates/${x}`,{method:"DELETE"}),b(null),S(null),m.invalidateQueries({queryKey:["custom-metrics-templates"]}),Y(!1))},[x,b,S,m]),[H,X]=hn(lce),[j,le]=hn(cce),[se,J]=w.useState(j.toString()),[ee,ie]=hn(uce),[oe,de]=hn(dce),[ye,ge]=hn(fce),[Me,fe]=hn(hce),[Se,me]=w.useState(ye.toString()),[Pe,ce]=w.useState(P4(Me));w.useEffect(()=>{me(ye.toString())},[ye]),w.useEffect(()=>{ce(P4(Me))},[Me]),hW();const He=!0;w.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),w.useEffect(()=>{if(!t)return;const qe=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",qe,{passive:!0}),()=>{t.removeEventListener("scroll",qe),i(n.current)}},[t]);const{data:Be}=km(),Ge=w.useMemo(()=>{const qe=(Be==null?void 0:Be.runs)||[],Fe=new Set(o);return s&&Fe.add(s),qe.filter(Ke=>Fe.has(Ke.run_id)).map(Ke=>({runPath:Ke.run_id,runName:Ke.name,color:Ke.color,isSelected:Ke.run_id===s}))},[s,o,Be==null?void 0:Be.runs]),{data:We,error:ae}=gd(s||"",!!s,He),Z=We==null?void 0:We.step_metrics_info,he=(Z==null?void 0:Z.local_steps)??0,be=(We==null?void 0:We.available_rollout_metric_names)??[],we=(Z==null?void 0:Z.custom_metric_sections)??{},ve=((Oe=We==null?void 0:We.eval_info)==null?void 0:Oe.evals)??[],Re=(We==null?void 0:We.available_sample_tags)??{},Ae=(We==null?void 0:We.available_envs)??[];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(dm,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:qe=>{qe&&c(qe)},children:[f.jsx(Xa,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),f.jsx(Xa,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&f.jsxs(f.Fragment,{children:[f.jsxs(En,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>p(qe=>qe+1),children:[f.jsx(hp,{className:"h-3 w-3 mr-1"}),"New Section"]}),f.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsxs(En,{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(lo,{align:"start",children:[f.jsx(ua,{onClick:()=>N(!0),children:"Load"}),f.jsx(ua,{onClick:()=>Q("new"),children:"New"}),f.jsx(ua,{onClick:()=>Q("duplicate"),children:"Duplicate"}),f.jsx(Bs,{}),f.jsx(ua,{onClick:()=>Q("rename"),disabled:!x,children:"Rename"}),f.jsx(ua,{onClick:()=>Y(!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(dm,{type:"single",variant:"outline",size:"sm",value:ee,onValueChange:qe=>{qe&&ie(qe)},children:[f.jsx(Xa,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),f.jsx(Xa,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),f.jsx(AS,{label:"EMA",variant:"selecting",size:"sm",enabled:H,onEnabledChange:X,value:se,onValueChange:J,onValueCommit:qe=>{const Fe=parseInt(qe,10);!isNaN(Fe)&&Fe>=2&&Fe<=100?(le(Fe),J(Fe.toString())):J(j.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),f.jsx(AS,{label:ee==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:oe,onEnabledChange:de,value:ee==="step"?Se:Pe,inputType:ee==="step"?"number":"text",onValueChange:qe=>{ee==="step"?me(qe):ce(qe)},onValueCommit:qe=>{if(ee==="step"){const Fe=parseInt(qe,10);!isNaN(Fe)&&Fe>=1?(ge(Fe),me(Fe.toString())):me(ye.toString())}else{const Fe=Ime(qe);Fe!==null?(fe(Fe),ce(P4(Fe))):ce(P4(Me))}},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:[ae&&f.jsx(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",ae instanceof Error?ae.message:"Unknown error"]})})}),l==="all"?f.jsx(pme,{runs:Ge,shouldPoll:He,totalSteps:he,showEma:H,emaSpan:j,hoveredRunId:a,availableRewardNames:be,customMetricSections:we,xAxisMode:ee,scrollRoot:t,maxStep:oe&&ee==="step"?ye:void 0,maxTime:oe&&ee==="time"?Me:void 0,evalsList:ve,availableSampleTags:Re,availableEnvs:Ae}):f.jsx(Cme,{runs:Ge,shouldPoll:He,showEma:H,emaSpan:j,hoveredRunId:a,availableRewardNames:be,customMetricSections:we,xAxisMode:ee,scrollRoot:t,maxStep:oe&&ee==="step"?ye:void 0,maxTime:oe&&ee==="time"?Me:void 0,evalsList:ve,availableSampleTags:Re,availableEnvs:Ae,newSectionTrigger:d,activeTemplateId:x,layoutSnapshotTrigger:V,onLayoutSnapshot:qe=>{G.current&&G.current(qe)}})]})}),f.jsx(nd,{open:A,onOpenChange:N,children:f.jsxs(rd,{className:"sm:max-w-[400px]",children:[f.jsx(iu,{children:f.jsx(su,{children:"Load Template"})}),f.jsxs("div",{className:"flex flex-col gap-1 max-h-[300px] overflow-y-auto",children:[f.jsx("button",{className:bt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===null&&"bg-accent font-medium"),onClick:()=>re(null),children:"Default"}),C.map(qe=>f.jsx("button",{className:bt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===qe.id&&"bg-accent font-medium"),onClick:()=>re(qe),children:qe.name},qe.id)),C.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:"No saved templates yet."})]})]})}),f.jsx(nd,{open:D,onOpenChange:R,children:f.jsxs(rd,{className:"sm:max-w-[400px]",children:[f.jsx(iu,{children:f.jsx(su,{children:L==="new"?"New Template":L==="duplicate"?"Duplicate Template":"Rename Template"})}),f.jsx(ah,{placeholder:"Template name",value:O,onChange:qe=>F(qe.target.value),onKeyDown:qe=>{qe.key==="Enter"&&O.trim()&&K()},autoFocus:!0}),f.jsxs(XT,{children:[f.jsx(En,{variant:"outline",size:"sm",onClick:()=>R(!1),children:"Cancel"}),f.jsx(En,{size:"sm",onClick:K,disabled:!O.trim(),children:L==="rename"?"Rename":"Create"})]})]})}),f.jsx(O2,{open:B,onOpenChange:Y,children:f.jsxs(L2,{children:[f.jsxs(j2,{children:[f.jsx(F2,{children:"Delete Template"}),f.jsxs(U2,{children:["Are you sure you want to delete “",_,"”? This action cannot be undone."]})]}),f.jsxs(z2,{children:[f.jsx(H2,{children:"Cancel"}),f.jsx(B2,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]}):f.jsx(Rm,{description:"Select a run from the sidebar to view training metrics."})}const D4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],gC={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 Lme(t){const e=Math.abs(t);if(e>=60)return eC(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 ud(t)}const jme=28;function zme(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 Fme(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 WA({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(qa,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ume(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?$l.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function Bme({isFullscreen:t,onClick:e}){return f.jsx("button",{onClick:e,className:bt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?f.jsx($T,{className:"h-3 w-3"}):f.jsx(WT,{className:"h-3 w-3"})})}function I4(t){return typeof t=="number"&&Number.isFinite(t)}function Hme(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 Q$({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 M=qn(gs),{isFullscreen:C,toggleFullscreen:A,fullscreenPortal:N}=Ume(),D=w.useRef(null),R=w.useRef(null),L=w.useRef(null),[k,O]=w.useState(!1),[F,B]=w.useState(null),[Y,V]=w.useState(null),q=gC[t]||{label:t.replace(/_/g," "),unit:""},G=s==="timeline",$=b==="clock"&&_==="bounds",Q=w.useMemo(()=>{if(c==="node_gpu"){const ee=new Map,ie=[...e].sort((oe,de)=>{const ye=I4(oe.node_id)?oe.node_id:Number.MAX_SAFE_INTEGER,ge=I4(de.node_id)?de.node_id:Number.MAX_SAFE_INTEGER;return ye!==ge?ye-ge:oe.gpu_index-de.gpu_index});for(const oe of ie){const de=I4(oe.node_id)?oe.node_id:null,ye=`${de??"?"}:${oe.gpu_index}`;if(ee.has(ye))continue;const ge=de===null?"Node ?":`Node ${de}`,Me=ee.size;ee.set(ye,{key:ye,label:`${ge} GPU ${oe.gpu_index}`,stroke:o||D4[Me%D4.length],gpuIndex:oe.gpu_index,nodeId:de})}return Array.from(ee.values())}return(n.length>0?Array.from(new Set(n)).sort((ee,ie)=>ee-ie):Array.from(new Set(e.map(ee=>ee.gpu_index))).sort((ee,ie)=>ee-ie)).map(ee=>({key:`gpu:${ee}`,label:(a==null?void 0:a[ee])??`GPU ${ee}`,stroke:o||D4[ee%D4.length],gpuIndex:ee,nodeId:null}))},[c,e,n,a,o]),K=w.useMemo(()=>new Set(Q.map(J=>J.key)),[Q]),{uplotData:re,seriesConfig:U,hasData:H,outlierBounds:X}=w.useMemo(()=>{if(e.length===0||Q.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const J={},ee=new Set,ie=[];for(const Me of e){const fe=c==="node_gpu"?`${I4(Me.node_id)?Me.node_id:"?"}:${Me.gpu_index}`:`gpu:${Me.gpu_index}`;K.has(fe)&&(ee.add(Me.timestamp),J[Me.timestamp]||(J[Me.timestamp]={}),J[Me.timestamp][fe]=Me.value,ie.push(Me.value))}const oe=Array.from(ee).sort((Me,fe)=>Me-fe);if(oe.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const de=oe.map(Me=>Me-r),ye=[{label:"Time"}],ge=[de];for(const Me of Q){const fe=oe.map(me=>{var Pe;return((Pe=J[me])==null?void 0:Pe[Me.key])??null}),Se=m!==null&&m.size>0&&!m.has(Me.key);ge.push(fe),ye.push({label:Me.label,stroke:Se?Hme(Me.stroke,.25):Me.stroke,width:Se?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:ge,seriesConfig:ye,hasData:!0,outlierBounds:Fme(ie)}},[e,r,Q,c,K,m]),j=d??(!G&&Q.length>1),le=w.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))),[]);w.useEffect(()=>{if(!D.current||!re||!H)return;const J=D.current,ee=J.clientWidth,ie=200;let oe=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY;for(let We=1;We<re.length;We+=1){const ae=re[We];for(let Z=0;Z<ae.length;Z+=1){const he=ae[Z];he!=null&&(k&&X?he>=X.lower&&he<=X.upper&&(he<oe&&(oe=he),he>de&&(de=he)):(he<oe&&(oe=he),he>de&&(de=he)))}}oe===Number.POSITIVE_INFINITY&&X&&(oe=X.lower,de=X.upper);const ye=de-oe,ge=Math.max(Math.abs(de),Math.abs(oe)),Me=Math.max(ge*.05,1e-10),fe=Math.max(ye*.1,Me),Se=[F!==null?F:Math.max(0,oe-fe),Y!==null?Y:de+fe],me=M?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Pe=M?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",He={width:ee,height:ie,padding:G?[0,0,0,0]:$?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!G,y:!1}},legend:{show:j},...G?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(We,ae,Z)=>{const he=i-r;return he>0?[0,he]:[ae,Z]}},y:{range:Se}},axes:G?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:Pe,grid:{stroke:me,width:1},ticks:{stroke:me,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(We,ae,Z,he)=>[Z,he]:void 0,values:(We,ae)=>ae.map(Z=>b==="clock"?am(r+Number(Z),i-r):ud(Number(Z)+x))},{stroke:Pe,grid:{stroke:me,width:1},ticks:{stroke:me,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(We,ae)=>{if(!ae||ae.length===0)return 40;const Z=Math.max(...ae.map(he=>he.length));return Math.max(40,Z*7+14)},values:(We,ae)=>ae.map(le)}],series:U,hooks:{setCursor:[We=>{if(!L.current||!D.current)return;const{left:ae,idx:Z}=We.cursor;if(Z==null||ae===void 0||ae<0){L.current.style.display="none";return}const he=re[0][Z];if(he===void 0){L.current.style.display="none";return}const be=re[0],we=(()=>{const ke=We.scales.x,et=Number(ke.min),ct=Number(ke.max);if(!Number.isFinite(et)||!Number.isFinite(ct))return null;const yt=Math.abs(ct-et);if(yt<=0)return null;const lt=Math.max(1,We.bbox.width);return yt*jme/lt})(),ve=Lme(Number(he)+x),Re=r+Number(he),Ae=am(Re,i-r);let Oe="";G||(Oe+=`<div class="font-medium mb-1">${Ae}</div>`,Oe+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${ve}</div>`,Oe+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Re.toFixed(3)}</div>`);const qe=[];for(let ke=0;ke<Q.length;ke+=1){const et=Q[ke],ct=re[ke+1],yt=zme(ct,be,Z,we);if(yt===null)continue;const lt=ct==null?void 0:ct[yt];lt!=null&&qe.push({entry:et,formatted:gu(lt),role:(p==null?void 0:p[et.key])??null})}const Fe=qe.length>0;if(qe.some(ke=>ke.role!==null)&&!G){const ke={Trainer:0,Inference:1},et=[];for(const ct of qe){const yt=ct.role??"Other";et.includes(yt)||et.push(yt)}et.sort((ct,yt)=>(ke[ct]??99)-(ke[yt]??99));for(const ct of et){Oe+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${ct}</div>`;for(const yt of qe)(yt.role??"Other")===ct&&(Oe+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${yt.entry.stroke}"></div>
                      <span class="text-muted-foreground">${yt.entry.label}:</span>
                      <span class="font-medium">${yt.formatted} ${q.unit}</span>
                    </div>
                  `)}}else for(const ke of qe)G?Oe+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${ke.entry.label}:</span>
                      <span class="font-medium">${ke.formatted} ${q.unit}</span>
                    </div>
                  `:Oe+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${ke.entry.stroke}"></div>
                      <span class="text-muted-foreground">${ke.entry.label}:</span>
                      <span class="font-medium">${ke.formatted} ${q.unit}</span>
                    </div>
                  `;if(!Fe){L.current.style.display="none";return}G&&(Oe+=`<div class="text-muted-foreground mt-1">Time: ${ve}</div>`),L.current.innerHTML=Oe,L.current.style.display="block";const je=D.current.getBoundingClientRect(),Te=L.current.getBoundingClientRect();let Xe=je.left+ae+15;Xe+Te.width+20>window.innerWidth&&(Xe=je.left+ae-Te.width-15+We.bbox.left),Xe=Math.max(4,Xe);let ht=je.top-Te.height+20;ht<4&&(ht=je.top+8),L.current.style.left=`${Xe}px`,L.current.style.top=`${ht}px`}]}};R.current&&R.current.destroy();const Be=new ps(He,re,J);R.current=Be;const Ge=new ResizeObserver(We=>{for(const ae of We){const{width:Z,height:he}=ae.contentRect;Be&&Z>0&&he>0&&Be.setSize({width:Z,height:he})}});return Ge.observe(J),()=>{Ge.disconnect(),Be.destroy(),R.current=null}},[re,H,U,t,r,i,x,b,_,$,G,q.unit,j,Q,p,le,k,X,F,Y,M,C]);const se=w.useCallback(()=>{L.current&&(L.current.style.display="none")},[]);return!H&&G?f.jsx("div",{className:"h-[200px] bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):N(f.jsxs("div",{className:bt("rounded-lg border transition-opacity",G?"overflow-hidden":C?"group/chart fixed inset-0 left-56 z-50 p-6 bg-background flex flex-col":"group/chart border-border p-3 bg-background",!C&&l&&"opacity-60"),children:[!G&&f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:bt("font-medium truncate",C?"text-sm":"text-xs"),title:t,children:q.label}),k&&f.jsx(WA,{label:"Ignore Outliers",onRemove:()=>O(!1)}),F!==null&&f.jsx(WA,{label:`Min Y: ${F}`,onRemove:()=>B(null)}),Y!==null&&f.jsx(WA,{label:`Max Y: ${Y}`,onRemove:()=>V(null)})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:k,onCheckedChange:O,children:"Ignore Outliers"}),f.jsx(Bs,{}),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:F??"",onChange:J=>{const ee=J.target.value;B(ee===""?null:Number(ee))},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:Y??"",onChange:J=>{const ee=J.target.value;V(ee===""?null:Number(ee))},onClick:J=>J.stopPropagation(),onKeyDown:J=>J.stopPropagation()})]})]})]}),f.jsx(Bme,{isFullscreen:C,onClick:A})]})]}),H?f.jsxs("div",{className:bt("relative bg-background rounded",C?"flex-1 min-h-0":"h-[200px]"),ref:D,onMouseLeave:se,children:[!G&&S&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),f.jsx("div",{ref:L,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:bt("flex items-center justify-center text-muted-foreground text-xs rounded",C?"flex-1 min-h-0":"h-[200px]"),children:l?"Loading...":`No data for ${q.label}`})]}))}function YO(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 Vme(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Gme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wme=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$me={};function KO(t,e){return($me.jsx?Wme:Gme).test(t)}const qme=/[ \t\n\f\r]/g;function Xme(t){return typeof t=="object"?t.type==="text"?ZO(t.value):!1:ZO(t)}function ZO(t){return t.replace(qme,"")===""}class Ow{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ow.prototype.normal={};Ow.prototype.property={};Ow.prototype.space=void 0;function J$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ow(n,r,e)}function OS(t){return t.toLowerCase()}class zc{constructor(e,n){this.attribute=n,this.property=e}}zc.prototype.attribute="";zc.prototype.booleanish=!1;zc.prototype.boolean=!1;zc.prototype.commaOrSpaceSeparated=!1;zc.prototype.commaSeparated=!1;zc.prototype.defined=!1;zc.prototype.mustUseProperty=!1;zc.prototype.number=!1;zc.prototype.overloadedBoolean=!1;zc.prototype.property="";zc.prototype.spaceSeparated=!1;zc.prototype.space=void 0;let Yme=0;const Fr=jx(),qo=jx(),qk=jx(),gn=jx(),ds=jx(),R1=jx(),Jc=jx();function jx(){return 2**++Yme}const Xk=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fr,booleanish:qo,commaOrSpaceSeparated:Jc,commaSeparated:R1,number:gn,overloadedBoolean:qk,spaceSeparated:ds},Symbol.toStringTag,{value:"Module"})),$A=Object.keys(Xk);class P8 extends zc{constructor(e,n,r,i){let s=-1;if(super(e,n),QO(this,"space",i),typeof r=="number")for(;++s<$A.length;){const o=$A[s];QO(this,$A[s],(r&Xk[o])===Xk[o])}}}P8.prototype.defined=!0;function QO(t,e,n){n&&(t[e]=n)}function Vy(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new P8(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[OS(r)]=r,n[OS(s.attribute)]=r}return new Ow(e,n,t.space)}const eq=Vy({properties:{ariaActiveDescendant:null,ariaAtomic:qo,ariaAutoComplete:null,ariaBusy:qo,ariaChecked:qo,ariaColCount:gn,ariaColIndex:gn,ariaColSpan:gn,ariaControls:ds,ariaCurrent:null,ariaDescribedBy:ds,ariaDetails:null,ariaDisabled:qo,ariaDropEffect:ds,ariaErrorMessage:null,ariaExpanded:qo,ariaFlowTo:ds,ariaGrabbed:qo,ariaHasPopup:null,ariaHidden:qo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ds,ariaLevel:gn,ariaLive:null,ariaModal:qo,ariaMultiLine:qo,ariaMultiSelectable:qo,ariaOrientation:null,ariaOwns:ds,ariaPlaceholder:null,ariaPosInSet:gn,ariaPressed:qo,ariaReadOnly:qo,ariaRelevant:null,ariaRequired:qo,ariaRoleDescription:ds,ariaRowCount:gn,ariaRowIndex:gn,ariaRowSpan:gn,ariaSelected:qo,ariaSetSize:gn,ariaSort:null,ariaValueMax:gn,ariaValueMin:gn,ariaValueNow:gn,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function tq(t,e){return e in t?t[e]:e}function nq(t,e){return tq(t,e.toLowerCase())}const Kme=Vy({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:R1,acceptCharset:ds,accessKey:ds,action:null,allow:null,allowFullScreen:Fr,allowPaymentRequest:Fr,allowUserMedia:Fr,alt:null,as:null,async:Fr,autoCapitalize:null,autoComplete:ds,autoFocus:Fr,autoPlay:Fr,blocking:ds,capture:null,charSet:null,checked:Fr,cite:null,className:ds,cols:gn,colSpan:null,content:null,contentEditable:qo,controls:Fr,controlsList:ds,coords:gn|R1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Fr,defer:Fr,dir:null,dirName:null,disabled:Fr,download:qk,draggable:qo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Fr,formTarget:null,headers:ds,height:gn,hidden:qk,high:gn,href:null,hrefLang:null,htmlFor:ds,httpEquiv:ds,id:null,imageSizes:null,imageSrcSet:null,inert:Fr,inputMode:null,integrity:null,is:null,isMap:Fr,itemId:null,itemProp:ds,itemRef:ds,itemScope:Fr,itemType:ds,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Fr,low:gn,manifest:null,max:null,maxLength:gn,media:null,method:null,min:null,minLength:gn,multiple:Fr,muted:Fr,name:null,nonce:null,noModule:Fr,noValidate:Fr,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:Fr,optimum:gn,pattern:null,ping:ds,placeholder:null,playsInline:Fr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Fr,referrerPolicy:null,rel:ds,required:Fr,reversed:Fr,rows:gn,rowSpan:gn,sandbox:ds,scope:null,scoped:Fr,seamless:Fr,selected:Fr,shadowRootClonable:Fr,shadowRootDelegatesFocus:Fr,shadowRootMode:null,shape:null,size:gn,sizes:null,slot:null,span:gn,spellCheck:qo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:gn,step:null,style:null,tabIndex:gn,target:null,title:null,translate:null,type:null,typeMustMatch:Fr,useMap:null,value:qo,width:gn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ds,axis:null,background:null,bgColor:null,border:gn,borderColor:null,bottomMargin:gn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Fr,declare:Fr,event:null,face:null,frame:null,frameBorder:null,hSpace:gn,leftMargin:gn,link:null,longDesc:null,lowSrc:null,marginHeight:gn,marginWidth:gn,noResize:Fr,noHref:Fr,noShade:Fr,noWrap:Fr,object:null,profile:null,prompt:null,rev:null,rightMargin:gn,rules:null,scheme:null,scrolling:qo,standby:null,summary:null,text:null,topMargin:gn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:gn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Fr,disableRemotePlayback:Fr,prefix:null,property:null,results:gn,security:null,unselectable:null},space:"html",transform:nq}),Zme=Vy({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:Jc,accentHeight:gn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:gn,amplitude:gn,arabicForm:null,ascent:gn,attributeName:null,attributeType:null,azimuth:gn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:gn,by:null,calcMode:null,capHeight:gn,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:gn,diffuseConstant:gn,direction:null,display:null,dur:null,divisor:gn,dominantBaseline:null,download:Fr,dx:null,dy:null,edgeMode:null,editable:null,elevation:gn,enableBackground:null,end:null,event:null,exponent:gn,externalResourcesRequired:null,fill:null,fillOpacity:gn,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:R1,g2:R1,glyphName:R1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:gn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:gn,horizOriginX:gn,horizOriginY:gn,id:null,ideographic:gn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:gn,k:gn,k1:gn,k2:gn,k3:gn,k4:gn,kernelMatrix:Jc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:gn,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:gn,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:gn,overlineThickness:gn,paintOrder:null,panose1:null,path:null,pathLength:gn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ds,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:gn,pointsAtY:gn,pointsAtZ:gn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jc,rev:Jc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jc,requiredFeatures:Jc,requiredFonts:Jc,requiredFormats:Jc,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:gn,specularExponent:gn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:gn,strikethroughThickness:gn,string:null,stroke:null,strokeDashArray:Jc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:gn,strokeOpacity:gn,strokeWidth:null,style:null,surfaceScale:gn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Jc,tabIndex:gn,tableValues:null,target:null,targetX:gn,targetY:gn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Jc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:gn,underlineThickness:gn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:gn,values:null,vAlphabetic:gn,vMathematical:gn,vectorEffect:null,vHanging:gn,vIdeographic:gn,version:null,vertAdvY:gn,vertOriginX:gn,vertOriginY:gn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:gn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tq}),rq=Vy({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()}}),iq=Vy({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nq}),sq=Vy({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Qme={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"},Jme=/[A-Z]/g,JO=/-[a-z]/g,ege=/^data[-\w.:]+$/i;function oq(t,e){const n=OS(e);let r=e,i=zc;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ege.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(JO,nge);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!JO.test(s)){let o=s.replace(Jme,tge);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=P8}return new i(r,e)}function tge(t){return"-"+t.toLowerCase()}function nge(t){return t.charAt(1).toUpperCase()}const aq=J$([eq,Kme,rq,iq,sq],"html"),xC=J$([eq,Zme,rq,iq,sq],"svg");function eL(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function rge(t){return t.join(" ").trim()}var Uv={},qA,tL;function ige(){if(tL)return qA;tL=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,M){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];M=M||{};var C=1,A=1;function N(q){var G=q.match(e);G&&(C+=G.length);var $=q.lastIndexOf(l);A=~$?q.length-$:A+q.length}function D(){var q={line:C,column:A};return function(G){return G.position=new R(q),O(),G}}function R(q){this.start=q,this.end={line:C,column:A},this.source=M.source}R.prototype.content=S;function L(q){var G=new Error(M.source+":"+C+":"+A+": "+q);if(G.reason=q,G.filename=M.source,G.line=C,G.column=A,G.source=S,!M.silent)throw G}function k(q){var G=q.exec(S);if(G){var $=G[0];return N($),S=S.slice($.length),G}}function O(){k(n)}function F(q){var G;for(q=q||[];G=B();)G!==!1&&q.push(G);return q}function B(){var q=D();if(!(c!=S.charAt(0)||d!=S.charAt(1))){for(var G=2;p!=S.charAt(G)&&(d!=S.charAt(G)||c!=S.charAt(G+1));)++G;if(G+=2,p===S.charAt(G-1))return L("End of comment missing");var $=S.slice(2,G-2);return A+=2,N($),S=S.slice(G),A+=2,q({type:m,comment:$})}}function Y(){var q=D(),G=k(r);if(G){if(B(),!k(i))return L("property missing ':'");var $=k(s),Q=q({type:x,property:_(G[0].replace(t,p)),value:$?_($[0].replace(t,p)):p});return k(o),Q}}function V(){var q=[];F(q);for(var G;G=Y();)G!==!1&&(q.push(G),F(q));return q}return O(),V()}function _(S){return S?S.replace(a,p):p}return qA=b,qA}var nL;function sge(){if(nL)return Uv;nL=1;var t=Uv&&Uv.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Uv,"__esModule",{value:!0}),Uv.default=n;const e=t(ige());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 Uv}var c_={},rL;function oge(){if(rL)return c_;rL=1,Object.defineProperty(c_,"__esModule",{value:!0}),c_.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 c_.camelCase=l,c_}var u_,iL;function age(){if(iL)return u_;iL=1;var t=u_&&u_.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(sge()),n=oge();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,u_=r,u_}var lge=age();const cge=Ay(lge),lq=cq("end"),D8=cq("start");function cq(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 uge(t){const e=D8(t),n=lq(t);if(e&&n)return{start:e,end:n}}function Y_(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?sL(t.position):"start"in t||"end"in t?sL(t):"line"in t||"column"in t?Yk(t):""}function Yk(t){return oL(t&&t.line)+":"+oL(t&&t.column)}function sL(t){return Yk(t&&t.start)+"-"+Yk(t&&t.end)}function oL(t){return t&&typeof t=="number"?t:1}class Sl 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=Y_(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}}Sl.prototype.file="";Sl.prototype.name="";Sl.prototype.reason="";Sl.prototype.message="";Sl.prototype.stack="";Sl.prototype.column=void 0;Sl.prototype.line=void 0;Sl.prototype.ancestors=void 0;Sl.prototype.cause=void 0;Sl.prototype.fatal=void 0;Sl.prototype.place=void 0;Sl.prototype.ruleId=void 0;Sl.prototype.source=void 0;const I8={}.hasOwnProperty,dge=new Map,fge=/[A-Z]/g,hge=new Set(["table","tbody","thead","tfoot","tr"]),pge=new Set(["td","th"]),uq="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mge(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=wge(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=Sge(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"?xC:aq,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=dq(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function dq(t,e,n){if(e.type==="element")return gge(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return xge(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return yge(t,e,n);if(e.type==="mdxjsEsm")return vge(t,e);if(e.type==="root")return bge(t,e,n);if(e.type==="text")return _ge(t,e)}function gge(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=xC,t.schema=i),t.ancestors.push(e);const s=hq(t,e.tagName,!1),o=Mge(t,e);let a=L8(t,e);return hge.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Xme(l):!0})),fq(t,o,s,e),O8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function xge(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)}LS(t,e.position)}function vge(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);LS(t,e.position)}function yge(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=xC,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:hq(t,e.name,!0),o=Tge(t,e),a=L8(t,e);return fq(t,o,s,e),O8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function bge(t,e,n){const r={};return O8(r,L8(t,e)),t.create(e,t.Fragment,r,n)}function _ge(t,e){return e.value}function fq(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function O8(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Sge(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 wge(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=D8(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 Mge(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&I8.call(e.properties,i)){const s=Cge(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&pge.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 Tge(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 LS(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 LS(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function L8(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:dge;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=dq(t,s,o);a!==void 0&&n.push(a)}return n}function Cge(t,e,n){const r=oq(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Vme(n):rge(n)),r.property==="style"){let i=typeof n=="object"?n:Ege(t,String(n));return t.stylePropertyNameCase==="css"&&(i=Age(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?Qme[r.property]||r.property:r.attribute,n]}}function Ege(t,e){try{return cge(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Sl("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=uq+"#cannot-parse-style-attribute",i}}function hq(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=KO(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=KO(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return I8.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);LS(t)}function LS(t,e){const n=new Sl("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=uq+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Age(t){const e={};let n;for(n in t)I8.call(t,n)&&(e[Nge(n)]=t[n]);return e}function Nge(t){let e=t.replace(fge,kge);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function kge(t){return"-"+t.toLowerCase()}const XA={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"]},Rge={};function Pge(t,e){const n=Rge,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pq(t,r,i)}function pq(t,e,n){if(Dge(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 aL(t.children,e,n)}return Array.isArray(t)?aL(t,e,n):""}function aL(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=pq(t[i],e,n);return r.join("")}function Dge(t){return!!(t&&typeof t=="object")}const lL=document.createElement("i");function j8(t){const e="&"+t+";";lL.innerHTML=e;const n=lL.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function fh(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 ed(t,e){return t.length>0?(fh(t,t.length,0,e),t):e}const cL={}.hasOwnProperty;function Ige(t){const e={};let n=-1;for(;++n<t.length;)Oge(e,t[n]);return e}function Oge(t,e){let n;for(n in e){const i=(cL.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){cL.call(i,o)||(i[o]=[]);const a=s[o];Lge(i[o],Array.isArray(a)?a:a?[a]:[])}}}function Lge(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);fh(t,0,0,r)}function mq(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 P1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jf=Pm(/[A-Za-z]/),ou=Pm(/[\dA-Za-z]/),jge=Pm(/[#-'*+\--9=?A-Z^-~]/);function Kk(t){return t!==null&&(t<32||t===127)}const Zk=Pm(/\d/),zge=Pm(/[\dA-Fa-f]/),Fge=Pm(/[!-/:-@[-`{-~]/);function er(t){return t!==null&&t<-2}function Oc(t){return t!==null&&(t<0||t===32)}function Oi(t){return t===-2||t===-1||t===32}const Uge=Pm(new RegExp("\\p{P}|\\p{S}","u")),Bge=Pm(/\s/);function Pm(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Gy(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&ou(t.charCodeAt(n+1))&&ou(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 Vi(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Oi(l)?(t.enter(n),a(l)):e(l)}function a(l){return Oi(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Hge={tokenize:Vge};function Vge(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"),Vi(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 er(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const Gge={tokenize:Wge},uL={tokenize:$ge};function Wge(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,R;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){R=e.events[D][1].end;break}M(r);let L=N;for(;L<e.events.length;)e.events[L][1].end={...R},L++;return fh(e.events,D+1,0,e.events.slice(N)),e.events.length=L,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(uL,d,p)(A)}function d(A){return i&&C(),M(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(uL,x,b)(A)}function x(A){return r++,n.push([e.currentConstruct,e.containerState]),m(A)}function b(A){if(A===null){i&&C(),M(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),M(0),t.consume(A);return}return er(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 R=i.events.length;for(;R--;)if(i.events[R][1].start.offset<o&&(!i.events[R][1].end||i.events[R][1].end.offset>o))return;const L=e.events.length;let k=L,O,F;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(O){F=e.events[k][1].end;break}O=!0}for(M(r),R=L;R<e.events.length;)e.events[R][1].end={...F},R++;fh(e.events,k+1,0,e.events.slice(L)),e.events.length=R}}function M(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 $ge(t,e,n){return Vi(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function dL(t){if(t===null||Oc(t)||Bge(t))return 1;if(Uge(t))return 2}function z8(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 Qk={name:"attention",resolveAll:qge,tokenize:Xge};function qge(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};fL(p,-l),fL(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=ed(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=ed(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=ed(c,z8(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=ed(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=ed(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,fh(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 Xge(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=dL(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=dL(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 fL(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Yge={name:"autolink",tokenize:Kge};function Kge(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 Jf(x)?(t.consume(x),o):x===64?n(x):c(x)}function o(x){return x===43||x===45||x===46||ou(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||ou(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||Kk(x)?n(x):(t.consume(x),l)}function c(x){return x===64?(t.consume(x),d):jge(x)?(t.consume(x),c):n(x)}function d(x){return ou(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||ou(x))&&r++<63){const b=x===45?m:p;return t.consume(x),b}return n(x)}}const vC={partial:!0,tokenize:Zge};function Zge(t,e,n){return r;function r(s){return Oi(s)?Vi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||er(s)?e(s):n(s)}}const gq={continuation:{tokenize:Jge},exit:exe,name:"blockQuote",tokenize:Qge};function Qge(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 Oi(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function Jge(t,e,n){const r=this;return i;function i(o){return Oi(o)?Vi(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(gq,e,n)(o)}}function exe(t){t.exit("blockQuote")}const xq={name:"characterEscape",tokenize:txe};function txe(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 Fge(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const vq={name:"characterReference",tokenize:nxe};function nxe(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=ou,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=zge,d):(t.enter("characterReferenceValue"),s=7,o=Zk,d(p))}function d(p){if(p===59&&i){const m=t.exit("characterReferenceValue");return o===ou&&!j8(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 hL={partial:!0,tokenize:ixe},pL={concrete:!0,name:"codeFenced",tokenize:rxe};function rxe(t,e,n){const r=this,i={partial:!0,tokenize:D};let s=0,o=0,a;return l;function l(R){return c(R)}function c(R){const L=r.events[r.events.length-1];return s=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,a=R,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(R)}function d(R){return R===a?(o++,t.consume(R),d):o<3?n(R):(t.exit("codeFencedFenceSequence"),Oi(R)?Vi(t,p,"whitespace")(R):p(R))}function p(R){return R===null||er(R)?(t.exit("codeFencedFence"),r.interrupt?e(R):t.check(hL,_,N)(R)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(R))}function m(R){return R===null||er(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),p(R)):Oi(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Vi(t,x,"whitespace")(R)):R===96&&R===a?n(R):(t.consume(R),m)}function x(R){return R===null||er(R)?p(R):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===null||er(R)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),p(R)):R===96&&R===a?n(R):(t.consume(R),b)}function _(R){return t.attempt(i,N,S)(R)}function S(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),M}function M(R){return s>0&&Oi(R)?Vi(t,C,"linePrefix",s+1)(R):C(R)}function C(R){return R===null||er(R)?t.check(hL,_,N)(R):(t.enter("codeFlowValue"),A(R))}function A(R){return R===null||er(R)?(t.exit("codeFlowValue"),C(R)):(t.consume(R),A)}function N(R){return t.exit("codeFenced"),e(R)}function D(R,L,k){let O=0;return F;function F(G){return R.enter("lineEnding"),R.consume(G),R.exit("lineEnding"),B}function B(G){return R.enter("codeFencedFence"),Oi(G)?Vi(R,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):Y(G)}function Y(G){return G===a?(R.enter("codeFencedFenceSequence"),V(G)):k(G)}function V(G){return G===a?(O++,R.consume(G),V):O>=o?(R.exit("codeFencedFenceSequence"),Oi(G)?Vi(R,q,"whitespace")(G):q(G)):k(G)}function q(G){return G===null||er(G)?(R.exit("codeFencedFence"),L(G)):k(G)}}}function ixe(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 YA={name:"codeIndented",tokenize:oxe},sxe={partial:!0,tokenize:axe};function oxe(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Vi(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):er(c)?t.attempt(sxe,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||er(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function axe(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):er(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Vi(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):er(o)?i(o):n(o)}}const lxe={name:"codeText",previous:uxe,resolve:cxe,tokenize:dxe};function cxe(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 uxe(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dxe(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)):er(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||er(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 fxe{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&&d_(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),d_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),d_(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);d_(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);d_(this.left,n.reverse())}}}function d_(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 yq(t){const e={};let n=-1,r,i,s,o,a,l,c;const d=new fxe(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,hxe(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 fh(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function hxe(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 M=a.slice(S[m],S[m+1]),C=s.pop();l.push([C,C+M.length-1]),t.splice(C,2,M)}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 pxe={resolve:gxe,tokenize:xxe},mxe={partial:!0,tokenize:vxe};function gxe(t){return yq(t),t}function xxe(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):er(a)?t.check(mxe,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 vxe(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Vi(t,s,"linePrefix")}function s(o){if(o===null||er(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 bq(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return p;function p(M){return M===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(M),t.exit(s),m):M===null||M===32||M===41||Kk(M)?n(M):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(M))}function m(M){return M===62?(t.enter(s),t.consume(M),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===62?(t.exit("chunkString"),t.exit(a),m(M)):M===null||M===60||er(M)?n(M):(t.consume(M),M===92?b:x)}function b(M){return M===60||M===62||M===92?(t.consume(M),x):x(M)}function _(M){return!d&&(M===null||M===41||Oc(M))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(M)):d<c&&M===40?(t.consume(M),d++,_):M===41?(t.consume(M),d--,_):M===null||M===32||M===40||Kk(M)?n(M):(t.consume(M),M===92?S:_)}function S(M){return M===40||M===41||M===92?(t.consume(M),_):_(M)}}function _q(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):er(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||er(x)||a++>999?(t.exit("chunkString"),d(x)):(t.consume(x),l||(l=!Oi(x)),x===92?m:p)}function m(x){return x===91||x===92||x===93?(t.consume(x),a++,p):p(x)}}function Sq(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):er(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Vi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||er(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 K_(t,e){let n;return r;function r(i){return er(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Oi(i)?Vi(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const yxe={name:"definition",tokenize:_xe},bxe={partial:!0,tokenize:Sxe};function _xe(t,e,n){const r=this;let i;return s;function s(x){return t.enter("definition"),o(x)}function o(x){return _q.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function a(x){return i=P1(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 Oc(x)?K_(t,c)(x):c(x)}function c(x){return bq(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function d(x){return t.attempt(bxe,p,p)(x)}function p(x){return Oi(x)?Vi(t,m,"whitespace")(x):m(x)}function m(x){return x===null||er(x)?(t.exit("definition"),r.parser.defined.push(i),e(x)):n(x)}}function Sxe(t,e,n){return r;function r(a){return Oc(a)?K_(t,i)(a):n(a)}function i(a){return Sq(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Oi(a)?Vi(t,o,"whitespace")(a):o(a)}function o(a){return a===null||er(a)?e(a):n(a)}}const wxe={name:"hardBreakEscape",tokenize:Mxe};function Mxe(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return er(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Txe={name:"headingAtx",resolve:Cxe,tokenize:Exe};function Cxe(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"},fh(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Exe(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||Oc(d)?(t.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||er(d)?(t.exit("atxHeading"),e(d)):Oi(d)?Vi(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||Oc(d)?(t.exit("atxHeadingText"),a(d)):(t.consume(d),c)}}const Axe=["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"],mL=["pre","script","style","textarea"],Nxe={concrete:!0,name:"htmlFlow",resolveTo:Pxe,tokenize:Dxe},kxe={partial:!0,tokenize:Oxe},Rxe={partial:!0,tokenize:Ixe};function Pxe(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 Dxe(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:U):Jf(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):Jf(j)?(t.consume(j),i=4,r.interrupt?e:U):n(j)}function x(j){return j===45?(t.consume(j),r.interrupt?e:U):n(j)}function b(j){const le="CDATA[";return j===le.charCodeAt(a++)?(t.consume(j),a===le.length?r.interrupt?e:Y:b):n(j)}function _(j){return Jf(j)?(t.consume(j),o=String.fromCharCode(j),S):n(j)}function S(j){if(j===null||j===47||j===62||Oc(j)){const le=j===47,se=o.toLowerCase();return!le&&!s&&mL.includes(se)?(i=1,r.interrupt?e(j):Y(j)):Axe.includes(o.toLowerCase())?(i=6,le?(t.consume(j),M):r.interrupt?e(j):Y(j)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):s?C(j):A(j))}return j===45||ou(j)?(t.consume(j),o+=String.fromCharCode(j),S):n(j)}function M(j){return j===62?(t.consume(j),r.interrupt?e:Y):n(j)}function C(j){return Oi(j)?(t.consume(j),C):F(j)}function A(j){return j===47?(t.consume(j),F):j===58||j===95||Jf(j)?(t.consume(j),N):Oi(j)?(t.consume(j),A):F(j)}function N(j){return j===45||j===46||j===58||j===95||ou(j)?(t.consume(j),N):D(j)}function D(j){return j===61?(t.consume(j),R):Oi(j)?(t.consume(j),D):A(j)}function R(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),l=j,L):Oi(j)?(t.consume(j),R):k(j)}function L(j){return j===l?(t.consume(j),l=null,O):j===null||er(j)?n(j):(t.consume(j),L)}function k(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Oc(j)?D(j):(t.consume(j),k)}function O(j){return j===47||j===62||Oi(j)?A(j):n(j)}function F(j){return j===62?(t.consume(j),B):n(j)}function B(j){return j===null||er(j)?Y(j):Oi(j)?(t.consume(j),B):n(j)}function Y(j){return j===45&&i===2?(t.consume(j),$):j===60&&i===1?(t.consume(j),Q):j===62&&i===4?(t.consume(j),H):j===63&&i===3?(t.consume(j),U):j===93&&i===5?(t.consume(j),re):er(j)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(kxe,X,V)(j)):j===null||er(j)?(t.exit("htmlFlowData"),V(j)):(t.consume(j),Y)}function V(j){return t.check(Rxe,q,X)(j)}function q(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),G}function G(j){return j===null||er(j)?V(j):(t.enter("htmlFlowData"),Y(j))}function $(j){return j===45?(t.consume(j),U):Y(j)}function Q(j){return j===47?(t.consume(j),o="",K):Y(j)}function K(j){if(j===62){const le=o.toLowerCase();return mL.includes(le)?(t.consume(j),H):Y(j)}return Jf(j)&&o.length<8?(t.consume(j),o+=String.fromCharCode(j),K):Y(j)}function re(j){return j===93?(t.consume(j),U):Y(j)}function U(j){return j===62?(t.consume(j),H):j===45&&i===2?(t.consume(j),U):Y(j)}function H(j){return j===null||er(j)?(t.exit("htmlFlowData"),X(j)):(t.consume(j),H)}function X(j){return t.exit("htmlFlow"),e(j)}}function Ixe(t,e,n){const r=this;return i;function i(o){return er(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 Oxe(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(vC,e,n)}}const Lxe={name:"htmlText",tokenize:jxe};function jxe(t,e,n){const r=this;let i,s,o;return a;function a(U){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(U),l}function l(U){return U===33?(t.consume(U),c):U===47?(t.consume(U),D):U===63?(t.consume(U),A):Jf(U)?(t.consume(U),k):n(U)}function c(U){return U===45?(t.consume(U),d):U===91?(t.consume(U),s=0,b):Jf(U)?(t.consume(U),C):n(U)}function d(U){return U===45?(t.consume(U),x):n(U)}function p(U){return U===null?n(U):U===45?(t.consume(U),m):er(U)?(o=p,Q(U)):(t.consume(U),p)}function m(U){return U===45?(t.consume(U),x):p(U)}function x(U){return U===62?$(U):U===45?m(U):p(U)}function b(U){const H="CDATA[";return U===H.charCodeAt(s++)?(t.consume(U),s===H.length?_:b):n(U)}function _(U){return U===null?n(U):U===93?(t.consume(U),S):er(U)?(o=_,Q(U)):(t.consume(U),_)}function S(U){return U===93?(t.consume(U),M):_(U)}function M(U){return U===62?$(U):U===93?(t.consume(U),M):_(U)}function C(U){return U===null||U===62?$(U):er(U)?(o=C,Q(U)):(t.consume(U),C)}function A(U){return U===null?n(U):U===63?(t.consume(U),N):er(U)?(o=A,Q(U)):(t.consume(U),A)}function N(U){return U===62?$(U):A(U)}function D(U){return Jf(U)?(t.consume(U),R):n(U)}function R(U){return U===45||ou(U)?(t.consume(U),R):L(U)}function L(U){return er(U)?(o=L,Q(U)):Oi(U)?(t.consume(U),L):$(U)}function k(U){return U===45||ou(U)?(t.consume(U),k):U===47||U===62||Oc(U)?O(U):n(U)}function O(U){return U===47?(t.consume(U),$):U===58||U===95||Jf(U)?(t.consume(U),F):er(U)?(o=O,Q(U)):Oi(U)?(t.consume(U),O):$(U)}function F(U){return U===45||U===46||U===58||U===95||ou(U)?(t.consume(U),F):B(U)}function B(U){return U===61?(t.consume(U),Y):er(U)?(o=B,Q(U)):Oi(U)?(t.consume(U),B):O(U)}function Y(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(t.consume(U),i=U,V):er(U)?(o=Y,Q(U)):Oi(U)?(t.consume(U),Y):(t.consume(U),q)}function V(U){return U===i?(t.consume(U),i=void 0,G):U===null?n(U):er(U)?(o=V,Q(U)):(t.consume(U),V)}function q(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||Oc(U)?O(U):(t.consume(U),q)}function G(U){return U===47||U===62||Oc(U)?O(U):n(U)}function $(U){return U===62?(t.consume(U),t.exit("htmlTextData"),t.exit("htmlText"),e):n(U)}function Q(U){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),K}function K(U){return Oi(U)?Vi(t,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):re(U)}function re(U){return t.enter("htmlTextData"),o(U)}}const F8={name:"labelEnd",resolveAll:Bxe,resolveTo:Hxe,tokenize:Vxe},zxe={tokenize:Gxe},Fxe={tokenize:Wxe},Uxe={tokenize:$xe};function Bxe(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&&fh(t,0,t.length,n),t}function Hxe(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=ed(a,t.slice(s+1,s+r+3)),a=ed(a,[["enter",d,e]]),a=ed(a,z8(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=ed(a,[["exit",d,e],t[o-2],t[o-1],["exit",c,e]]),a=ed(a,t.slice(o+1)),a=ed(a,[["exit",l,e]]),fh(t,s,t.length,a),t}function Vxe(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(P1(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(zxe,d,o?d:p)(m):m===91?t.attempt(Fxe,d,o?c:p)(m):o?d(m):p(m)}function c(m){return t.attempt(Uxe,d,p)(m)}function d(m){return e(m)}function p(m){return s._balanced=!0,n(m)}}function Gxe(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 Oc(p)?K_(t,s)(p):s(p)}function s(p){return p===41?d(p):bq(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Oc(p)?K_(t,l)(p):d(p)}function a(p){return n(p)}function l(p){return p===34||p===39||p===40?Sq(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):d(p)}function c(p){return Oc(p)?K_(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 Wxe(t,e,n){const r=this;return i;function i(a){return _q.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(P1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function $xe(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 qxe={name:"labelStartImage",resolveAll:F8.resolveAll,tokenize:Xxe};function Xxe(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 Yxe={name:"labelStartLink",resolveAll:F8.resolveAll,tokenize:Kxe};function Kxe(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 KA={name:"lineEnding",tokenize:Zxe};function Zxe(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Vi(t,e,"linePrefix")}}const l2={name:"thematicBreak",tokenize:Qxe};function Qxe(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||er(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Oi(c)?Vi(t,a,"whitespace")(c):a(c))}}const Tc={continuation:{tokenize:nve},exit:ive,name:"list",tokenize:tve},Jxe={partial:!0,tokenize:sve},eve={partial:!0,tokenize:rve};function tve(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:Zk(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(l2,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 Zk(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(vC,r.interrupt?n:d,t.attempt(Jxe,m,p))}function d(x){return r.containerState.initialBlankLine=!0,s++,m(x)}function p(x){return Oi(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 nve(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(vC,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Vi(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Oi(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(eve,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vi(t,t.attempt(Tc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function rve(t,e,n){const r=this;return Vi(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 ive(t){t.exit(this.containerState.type)}function sve(t,e,n){const r=this;return Vi(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!Oi(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const gL={name:"setextUnderline",resolveTo:ove,tokenize:ave};function ove(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 ave(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"),Oi(c)?Vi(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||er(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const lve={tokenize:cve};function cve(t){const e=this,n=t.attempt(vC,r,t.attempt(this.parser.constructs.flowInitial,i,Vi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(pxe,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 uve={resolveAll:Mq()},dve=wq("string"),fve=wq("text");function wq(t){return{resolveAll:Mq(t==="text"?hve: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 Mq(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 hve(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 pve={42:Tc,43:Tc,45:Tc,48:Tc,49:Tc,50:Tc,51:Tc,52:Tc,53:Tc,54:Tc,55:Tc,56:Tc,57:Tc,62:gq},mve={91:yxe},gve={[-2]:YA,[-1]:YA,32:YA},xve={35:Txe,42:l2,45:[gL,l2],60:Nxe,61:gL,95:l2,96:pL,126:pL},vve={38:vq,92:xq},yve={[-5]:KA,[-4]:KA,[-3]:KA,33:qxe,38:vq,42:Qk,60:[Yge,Lxe],91:Yxe,92:[wxe,xq],93:F8,95:Qk,96:lxe},bve={null:[Qk,uve]},_ve={null:[42,95]},Sve={null:[]},wve=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_ve,contentInitial:mve,disable:Sve,document:pve,flow:xve,flowInitial:gve,insideSpan:bve,string:vve,text:yve},Symbol.toStringTag,{value:"Module"}));function Mve(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:L(D),check:L(R),consume:C,enter:A,exit:N,interrupt:L(R,{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(B){return o=ed(o,B),S(),o[o.length-1]!==null?[]:(k(e,0),c.events=z8(s,c.events,c),c.events)}function m(B,Y){return Cve(x(B),Y)}function x(B){return Tve(o,B)}function b(){const{_bufferIndex:B,_index:Y,line:V,column:q,offset:G}=r;return{_bufferIndex:B,_index:Y,line:V,column:q,offset:G}}function _(B){i[B.line]=B.column,F()}function S(){let B;for(;r._index<o.length;){const Y=o[r._index];if(typeof Y=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<Y.length;)M(Y.charCodeAt(r._bufferIndex));else M(Y)}}function M(B){d=d(B)}function C(B){er(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,F()):B!==-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=B}function A(B,Y){const V=Y||{};return V.type=B,V.start=b(),c.events.push(["enter",V,c]),a.push(V),V}function N(B){const Y=a.pop();return Y.end=b(),c.events.push(["exit",Y,c]),Y}function D(B,Y){k(B,Y.from)}function R(B,Y){Y.restore()}function L(B,Y){return V;function V(q,G,$){let Q,K,re,U;return Array.isArray(q)?X(q):"tokenize"in q?X([q]):H(q);function H(J){return ee;function ee(ie){const oe=ie!==null&&J[ie],de=ie!==null&&J.null,ye=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(de)?de:de?[de]:[]];return X(ye)(ie)}}function X(J){return Q=J,K=0,J.length===0?$:j(J[K])}function j(J){return ee;function ee(ie){return U=O(),re=J,J.partial||(c.currentConstruct=J),J.name&&c.parser.constructs.disable.null.includes(J.name)?se():J.tokenize.call(Y?Object.assign(Object.create(c),Y):c,l,le,se)(ie)}}function le(J){return B(re,U),G}function se(J){return U.restore(),++K<Q.length?j(Q[K]):$}}}function k(B,Y){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&fh(c.events,Y,c.events.length-Y,B.resolve(c.events.slice(Y),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function O(){const B=b(),Y=c.previous,V=c.currentConstruct,q=c.events.length,G=Array.from(a);return{from:q,restore:$};function $(){r=B,c.previous=Y,c.currentConstruct=V,c.events.length=q,a=G,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Tve(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 Cve(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 Eve(t){const r={constructs:Ige([wve,...(t||{}).extensions||[]]),content:i(Hge),defined:[],document:i(Gge),flow:i(lve),lazy:{},string:i(dve),text:i(fve)};return r;function i(s){return o;function o(a){return Mve(r,s,a)}}}function Ave(t){for(;!yq(t););return t}const xL=/[\0\t\n\r]/g;function Nve(){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(xL.lastIndex=p,c=xL.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 kve=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rve(t){return t.replace(kve,Pve)}function Pve(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return mq(n.slice(s?2:1),s?16:10)}return j8(n)||t}const Tq={}.hasOwnProperty;function Dve(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),Ive(n)(Ave(Eve(n).document().write(Nve()(t,e,!0))))}function Ive(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(He),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(Se),blockQuote:s(de),characterEscape:O,characterReference:O,codeFenced:s(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ye,o),codeText:s(ge,o),codeTextData:O,data:O,codeFlowValue:O,definition:s(Me),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(fe),hardBreakEscape:s(me),hardBreakTrailing:s(me),htmlFlow:s(Pe,o),htmlFlowData:O,htmlText:s(Pe,o),htmlTextData:O,image:s(ce),label:o,link:s(He),listItem:s(Ge),listItemValue:m,listOrdered:s(Be,p),listUnordered:s(Be),paragraph:s(We),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Se),strong:s(ae),thematicBreak:s(he)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:oe,autolinkProtocol:ie,blockQuote:l(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:J,characterReference:ee,codeFenced:l(S),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:b,codeFlowValue:F,codeIndented:l(M),codeText:l(G),codeTextData:F,data:F,definition:l(),definitionDestinationString:N,definitionLabelString:C,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(Y),hardBreakTrailing:l(Y),htmlFlow:l(V),htmlFlowData:F,htmlText:l(q),htmlTextData:F,image:l(Q),label:re,labelText:K,lineEnding:B,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:le,resourceDestinationString:U,resourceTitleString:H,resource:X,setextHeading:l(k),setextHeadingLineSequence:L,setextHeadingText:R,strong:l(),thematicBreak:l()}};Cq(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(be){let we={type:"root",children:[]};const ve={stack:[we],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:d,data:n},Re=[];let Ae=-1;for(;++Ae<be.length;)if(be[Ae][1].type==="listOrdered"||be[Ae][1].type==="listUnordered")if(be[Ae][0]==="enter")Re.push(Ae);else{const Oe=Re.pop();Ae=i(be,Oe,Ae)}for(Ae=-1;++Ae<be.length;){const Oe=e[be[Ae][0]];Tq.call(Oe,be[Ae][1].type)&&Oe[be[Ae][1].type].call(Object.assign({sliceSerialize:be[Ae][2].sliceSerialize},ve),be[Ae][1])}if(ve.tokenStack.length>0){const Oe=ve.tokenStack[ve.tokenStack.length-1];(Oe[1]||vL).call(ve,void 0,Oe[0])}for(we.position={start:S0(be.length>0?be[0][1].start:{line:1,column:1,offset:0}),end:S0(be.length>0?be[be.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<e.transforms.length;)we=e.transforms[Ae](we)||we;return we}function i(be,we,ve){let Re=we-1,Ae=-1,Oe=!1,qe,Fe,Ke,je;for(;++Re<=ve;){const Te=be[Re];switch(Te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Te[0]==="enter"?Ae++:Ae--,je=void 0;break}case"lineEndingBlank":{Te[0]==="enter"&&(qe&&!je&&!Ae&&!Ke&&(Ke=Re),je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:je=void 0}if(!Ae&&Te[0]==="enter"&&Te[1].type==="listItemPrefix"||Ae===-1&&Te[0]==="exit"&&(Te[1].type==="listUnordered"||Te[1].type==="listOrdered")){if(qe){let Xe=Re;for(Fe=void 0;Xe--;){const ht=be[Xe];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;Fe&&(be[Fe][1].type="lineEndingBlank",Oe=!0),ht[1].type="lineEnding",Fe=Xe}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Ke&&(!Fe||Ke<Fe)&&(qe._spread=!0),qe.end=Object.assign({},Fe?be[Fe][1].start:Te[1].end),be.splice(Fe||Re,0,["exit",qe,Te[2]]),Re++,ve++}if(Te[1].type==="listItemPrefix"){const Xe={type:"listItem",_spread:!1,start:Object.assign({},Te[1].start),end:void 0};qe=Xe,be.splice(Re,0,["enter",Xe,Te[2]]),Re++,ve++,Ke=void 0,je=!0}}}return be[we][1]._spread=Oe,ve}function s(be,we){return ve;function ve(Re){a.call(this,be(Re),Re),we&&we.call(this,Re)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(be,we,ve){this.stack[this.stack.length-1].children.push(be),this.stack.push(be),this.tokenStack.push([we,ve||void 0]),be.position={start:S0(we.start),end:void 0}}function l(be){return we;function we(ve){be&&be.call(this,ve),c.call(this,ve)}}function c(be,we){const ve=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==be.type&&(we?we.call(this,be,Re[0]):(Re[1]||vL).call(this,be,Re[0]));else throw new Error("Cannot close `"+be.type+"` ("+Y_({start:be.start,end:be.end})+"): it’s not open");ve.position.end=S0(be.end)}function d(){return Pge(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(be){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(be),10),this.data.expectingFirstListItemValue=void 0}}function x(){const be=this.resume(),we=this.stack[this.stack.length-1];we.lang=be}function b(){const be=this.resume(),we=this.stack[this.stack.length-1];we.meta=be}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const be=this.resume(),we=this.stack[this.stack.length-1];we.value=be.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const be=this.resume(),we=this.stack[this.stack.length-1];we.value=be.replace(/(\r?\n|\r)$/g,"")}function C(be){const we=this.resume(),ve=this.stack[this.stack.length-1];ve.label=we,ve.identifier=P1(this.sliceSerialize(be)).toLowerCase()}function A(){const be=this.resume(),we=this.stack[this.stack.length-1];we.title=be}function N(){const be=this.resume(),we=this.stack[this.stack.length-1];we.url=be}function D(be){const we=this.stack[this.stack.length-1];if(!we.depth){const ve=this.sliceSerialize(be).length;we.depth=ve}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function L(be){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(be).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function O(be){const ve=this.stack[this.stack.length-1].children;let Re=ve[ve.length-1];(!Re||Re.type!=="text")&&(Re=Z(),Re.position={start:S0(be.start),end:void 0},ve.push(Re)),this.stack.push(Re)}function F(be){const we=this.stack.pop();we.value+=this.sliceSerialize(be),we.position.end=S0(be.end)}function B(be){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=we.children[we.children.length-1];ve.position.end=S0(be.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(we.type)&&(O.call(this,be),F.call(this,be))}function Y(){this.data.atHardBreak=!0}function V(){const be=this.resume(),we=this.stack[this.stack.length-1];we.value=be}function q(){const be=this.resume(),we=this.stack[this.stack.length-1];we.value=be}function G(){const be=this.resume(),we=this.stack[this.stack.length-1];we.value=be}function $(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=we,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function Q(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=we,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function K(be){const we=this.sliceSerialize(be),ve=this.stack[this.stack.length-2];ve.label=Rve(we),ve.identifier=P1(we).toLowerCase()}function re(){const be=this.stack[this.stack.length-1],we=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Re=be.children;ve.children=Re}else ve.alt=we}function U(){const be=this.resume(),we=this.stack[this.stack.length-1];we.url=be}function H(){const be=this.resume(),we=this.stack[this.stack.length-1];we.title=be}function X(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function le(be){const we=this.resume(),ve=this.stack[this.stack.length-1];ve.label=we,ve.identifier=P1(this.sliceSerialize(be)).toLowerCase(),this.data.referenceType="full"}function se(be){this.data.characterReferenceType=be.type}function J(be){const we=this.sliceSerialize(be),ve=this.data.characterReferenceType;let Re;ve?(Re=mq(we,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=j8(we);const Ae=this.stack[this.stack.length-1];Ae.value+=Re}function ee(be){const we=this.stack.pop();we.position.end=S0(be.end)}function ie(be){F.call(this,be);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(be)}function oe(be){F.call(this,be);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(be)}function de(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function ge(){return{type:"inlineCode",value:""}}function Me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fe(){return{type:"emphasis",children:[]}}function Se(){return{type:"heading",depth:0,children:[]}}function me(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function ce(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Be(be){return{type:"list",ordered:be.type==="listOrdered",start:null,spread:be._spread,children:[]}}function Ge(be){return{type:"listItem",spread:be._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function ae(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function he(){return{type:"thematicBreak"}}}function S0(t){return{line:t.line,column:t.column,offset:t.offset}}function Cq(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?Cq(t,r):Ove(t,r)}}function Ove(t,e){let n;for(n in e)if(Tq.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 vL(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Y_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Y_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Y_({start:e.start,end:e.end})+") is still open")}function Lve(t){const e=this;e.parser=n;function n(r){return Dve(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function jve(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 zve(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Fve(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 Uve(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Bve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Hve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Gy(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 Vve(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 Gve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Eq(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 Wve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Eq(t,e);const i={src:Gy(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 $ve(t,e){const n={src:Gy(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 qve(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 Xve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Eq(t,e);const i={href:Gy(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 Yve(t,e){const n={href:Gy(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 Kve(t,e,n){const r=t.all(e),i=n?Zve(n):Aq(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 Zve(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=Aq(n[r])}return e}function Aq(t){const e=t.spread;return e??t.children.length>1}function Qve(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 Jve(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function e1e(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function t1e(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function n1e(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=D8(e.children[1]),l=lq(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 r1e(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 i1e(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const yL=9,bL=32;function s1e(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(_L(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(_L(e.slice(i),i>0,!1)),s.join("")}function _L(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===yL||s===bL;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===yL||s===bL;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function o1e(t,e){const n={type:"text",value:s1e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function a1e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const l1e={blockquote:jve,break:zve,code:Fve,delete:Uve,emphasis:Bve,footnoteReference:Hve,heading:Vve,html:Gve,imageReference:Wve,image:$ve,inlineCode:qve,linkReference:Xve,link:Yve,listItem:Kve,list:Qve,paragraph:Jve,root:e1e,strong:t1e,table:n1e,tableCell:i1e,tableRow:r1e,text:o1e,thematicBreak:a1e,toml:O4,yaml:O4,definition:O4,footnoteDefinition:O4};function O4(){}const Nq=-1,yC=0,Z_=1,n5=2,U8=3,B8=4,H8=5,V8=6,kq=7,Rq=8,SL=typeof self=="object"?self:globalThis,c1e=(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 yC:case Nq:return n(o,i);case Z_:{const a=n([],i);for(const l of o)a.push(r(l));return a}case n5:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case U8:return n(new Date(o),i);case B8:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case H8:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case V8:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case kq:{const{name:a,message:l}=o;return n(new SL[a](l),i)}case Rq: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 SL[s](o),i)};return r},wL=t=>c1e(new Map,t)(0),Bv="",{toString:u1e}={},{keys:d1e}=Object,f_=t=>{const e=typeof t;if(e!=="object"||!t)return[yC,e];const n=u1e.call(t).slice(8,-1);switch(n){case"Array":return[Z_,Bv];case"Object":return[n5,Bv];case"Date":return[U8,Bv];case"RegExp":return[B8,Bv];case"Map":return[H8,Bv];case"Set":return[V8,Bv];case"DataView":return[Z_,n]}return n.includes("Array")?[Z_,n]:n.includes("Error")?[kq,n]:[n5,n]},L4=([t,e])=>t===yC&&(e==="function"||e==="symbol"),f1e=(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]=f_(o);switch(a){case yC:{let d=o;switch(l){case"bigint":a=Rq,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([Nq],o)}return i([a,d],o)}case Z_:{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 n5:{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 d1e(o))(t||!L4(f_(o[m])))&&d.push([s(m),s(o[m])]);return p}case U8:return i([a,o.toISOString()],o);case B8:{const{source:d,flags:p}=o;return i([a,{source:d,flags:p}],o)}case H8:{const d=[],p=i([a,d],o);for(const[m,x]of o)(t||!(L4(f_(m))||L4(f_(x))))&&d.push([s(m),s(x)]);return p}case V8:{const d=[],p=i([a,d],o);for(const m of o)(t||!L4(f_(m)))&&d.push(s(m));return p}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},ML=(t,{json:e,lossy:n}={})=>{const r=[];return f1e(!(e||n),!!e,new Map,r)(t),r},r5=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?wL(ML(t,e)):structuredClone(t):(t,e)=>wL(ML(t,e));function h1e(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 p1e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function m1e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||h1e,r=t.options.footnoteBackLabel||p1e,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=Gy(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 M={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(d,!0)};t.patch(c,M),a.push(M)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...r5(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 G8=(function(t){if(t==null)return y1e;if(typeof t=="function")return bC(t);if(typeof t=="object")return Array.isArray(t)?g1e(t):x1e(t);if(typeof t=="string")return v1e(t);throw new Error("Expected function, string, or object as test")});function g1e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=G8(t[n]);return bC(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function x1e(t){const e=t;return bC(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function v1e(t){return bC(e);function e(n){return n&&n.type===t}}function bC(t){return e;function e(n,r,i){return!!(b1e(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function y1e(){return!0}function b1e(t){return t!==null&&typeof t=="object"&&"type"in t}const Pq=[],_1e=!0,TL=!1,Dq="skip";function Iq(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=G8(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=Pq,b,_,S;if((!e||s(l,c,d[d.length-1]||void 0))&&(x=S1e(n(l,d)),x[0]===TL))return x;if("children"in l&&l.children){const M=l;if(M.children&&x[0]!==Dq)for(_=(r?M.children.length:-1)+o,S=d.concat(M);_>-1&&_<M.children.length;){const C=M.children[_];if(b=a(C,_,S)(),b[0]===TL)return b;_=typeof b[1]=="number"?b[1]:_+o}}return x}}}function S1e(t){return Array.isArray(t)?t:typeof t=="number"?[_1e,t]:t==null?Pq:[t]}function Oq(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),Iq(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 Jk={}.hasOwnProperty,w1e={};function M1e(t,e){const n=e||w1e,r=new Map,i=new Map,s=new Map,o={...l1e,...n.handlers},a={all:c,applyData:C1e,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:T1e,wrap:A1e};return Oq(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(Jk.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,M=r5(S);return M.children=a.all(d),M}return r5(d)}return(a.options.unknownHandler||E1e)(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=CL(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=CL(_.value))}Array.isArray(b)?p.push(...b):p.push(b)}}}return p}}function T1e(t,e){t.position&&(e.position=uge(t))}function C1e(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,r5(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function E1e(t,e){const n=e.data||{},r="value"in e&&!(Jk.call(n,"hProperties")||Jk.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 A1e(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 CL(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function EL(t,e){const n=M1e(t,e),r=n.one(t,void 0),i=m1e(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function N1e(t,e){return t&&"run"in t?async function(n,r){const i=EL(n,{file:r,...e});await t.run(i,r)}:function(n,r){return EL(n,{file:r,...t||e})}}function AL(t){if(t)throw t}var ZA,NL;function k1e(){if(NL)return ZA;NL=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 ZA=function l(){var c,d,p,m,x,b,_=arguments[0],S=1,M=arguments.length,C=!1;for(typeof _=="boolean"&&(C=_,_=arguments[1]||{},S=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});S<M;++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 _},ZA}var R1e=k1e();const QA=Ay(R1e);function eR(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 P1e(){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?D1e(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 D1e(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 $f={basename:I1e,dirname:O1e,extname:L1e,join:j1e,sep:"/"};function I1e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Lw(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 O1e(t){if(Lw(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 L1e(t){Lw(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 j1e(...t){let e=-1,n;for(;++e<t.length;)Lw(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":z1e(n)}function z1e(t){Lw(t);const e=t.codePointAt(0)===47;let n=F1e(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function F1e(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 Lw(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const U1e={cwd:B1e};function B1e(){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 H1e(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 V1e(t)}function V1e(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 JA=["history","path","basename","stem","extname","dirname"];class Lq{constructor(e){let n;e?tR(e)?n={path:e}:typeof e=="string"||G1e(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":U1e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<JA.length;){const s=JA[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)JA.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?$f.basename(this.path):void 0}set basename(e){t6(e,"basename"),e6(e,"basename"),this.path=$f.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?$f.dirname(this.path):void 0}set dirname(e){kL(this.basename,"dirname"),this.path=$f.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?$f.extname(this.path):void 0}set extname(e){if(e6(e,"extname"),kL(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=$f.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){tR(e)&&(e=H1e(e)),t6(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?$f.basename(this.path,this.extname):void 0}set stem(e){t6(e,"stem"),e6(e,"stem"),this.path=$f.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 Sl(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 e6(t,e){if(t&&t.includes($f.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+$f.sep+"`")}function t6(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function kL(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function G1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const W1e=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),$1e={}.hasOwnProperty;class W8 extends W1e{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=P1e()}copy(){const e=new W8;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(QA(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(i6("data",this.frozen),this.namespace[e]=n,this):$1e.call(this.namespace,e)&&this.namespace[e]||void 0:e?(i6("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=j4(e),r=this.parser||this.Parser;return n6("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),n6("process",this.parser||this.Parser),r6("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=j4(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);Y1e(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(),n6("processSync",this.parser||this.Parser),r6("processSync",this.compiler||this.Compiler),this.process(e,i),PL("processSync","process",n),r;function i(s,o){n=!0,AL(s),r=o}}run(e,n,r){RL(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=j4(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),PL("runSync","run",r),i;function s(o,a){AL(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=j4(n),i=this.compiler||this.Compiler;return r6("stringify",i),RL(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(i6("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=QA(!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];eR(_)&&eR(x)&&(x=QA(!0,_,x)),r[m]=[c,x,...b]}}}}const q1e=new W8().freeze();function n6(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function r6(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function i6(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 RL(t){if(!eR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function PL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function j4(t){return X1e(t)?t:new Lq(t)}function X1e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Y1e(t){return typeof t=="string"||K1e(t)}function K1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Z1e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DL=[],IL={allowDangerousHtml:!0},Q1e=/^(https?|ircs?|mailto|xmpp)$/i,J1e=[{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 eye(t){const e=tye(t),n=nye(t);return rye(e.runSync(e.parse(n),n),t)}function tye(t){const e=t.rehypePlugins||DL,n=t.remarkPlugins||DL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...IL}:IL;return q1e().use(Lve).use(n).use(N1e,r).use(e)}function nye(t){const e=t.children||"",n=new Lq;return typeof e=="string"&&(n.value=e),n}function rye(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||iye;for(const d of J1e)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Z1e+d.id,void 0);return Oq(t,c),mge(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 XA)if(Object.hasOwn(XA,x)&&Object.hasOwn(d.properties,x)){const b=d.properties[x],_=XA[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 iye(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||Q1e.test(t.slice(0,e))?t:""}function sye(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 oye(){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 aye(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(sye(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 lye={tokenize:cye,concrete:!0,name:"mathFlow"},OL={tokenize:uye,partial:!0};function cye(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"),Vi(t,c,"whitespace")(C))}function c(C){return C===null||er(C)?p(C):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(C))}function d(C){return C===null||er(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(OL,m,S)(C)}function m(C){return t.attempt({tokenize:M,partial:!0},S,x)(C)}function x(C){return(s?Vi(t,b,"linePrefix",s+1):b)(C)}function b(C){return C===null?S(C):er(C)?t.attempt(OL,m,S)(C):(t.enter("mathFlowValue"),_(C))}function _(C){return C===null||er(C)?(t.exit("mathFlowValue"),b(C)):(t.consume(C),_)}function S(C){return t.exit("mathFlow"),e(C)}function M(C,A,N){let D=0;return Vi(C,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function R(O){return C.enter("mathFlowFence"),C.enter("mathFlowFenceSequence"),L(O)}function L(O){return O===36?(D++,C.consume(O),L):D<o?N(O):(C.exit("mathFlowFenceSequence"),Vi(C,k,"whitespace")(O))}function k(O){return O===null||er(O)?(C.exit("mathFlowFence"),A(O)):N(O)}}}function uye(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 dye(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:fye,previous:hye,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):er(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),m):(i.enter("mathTextData"),x(_))}function x(_){return _===null||_===32||_===36||er(_)?(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 fye(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 hye(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function pye(t){return{flow:{36:lye},text:{36:dye(t)}}}class kc{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 kc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class fu{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 fu(n,kc.range(this,e))}}class fn{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__=fn.prototype,p.position=i,i!=null&&s!=null&&(p.length=s-i),p.rawMessage=e,p}}fn.prototype.__proto__=Error.prototype;var mye=/([A-Z])/g,$8=t=>t.replace(mye,"-$1").toLowerCase(),gye={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},xye=/[&><"']/g,yl=t=>String(t).replace(xye,e=>gye[e]),Q_=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?Q_(t.body[0]):t:t.type==="font"?Q_(t.body):t,vye=new Set(["mathord","textord","atom"]),kp=t=>vye.has(Q_(t).type),yye=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"},c2={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 bye(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 q8{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 c2)if(c2.hasOwnProperty(n)){var r=c2[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:bye(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 fn("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=yye(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class w0{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 Kf[_ye[this.id]]}sub(){return Kf[Sye[this.id]]}fracNum(){return Kf[wye[this.id]]}fracDen(){return Kf[Mye[this.id]]}cramp(){return Kf[Tye[this.id]]}text(){return Kf[Cye[this.id]]}isTight(){return this.size>=2}}var X8=0,i5=1,D1=2,xp=3,jS=4,sd=5,gy=6,Xl=7,Kf=[new w0(X8,0,!1),new w0(i5,0,!0),new w0(D1,1,!1),new w0(xp,1,!0),new w0(jS,2,!1),new w0(sd,2,!0),new w0(gy,3,!1),new w0(Xl,3,!0)],_ye=[jS,sd,jS,sd,gy,Xl,gy,Xl],Sye=[sd,sd,sd,sd,Xl,Xl,Xl,Xl],wye=[D1,xp,jS,sd,gy,Xl,gy,Xl],Mye=[xp,xp,sd,sd,Xl,Xl,Xl,Xl],Tye=[i5,i5,xp,xp,sd,sd,Xl,Xl],Cye=[X8,i5,D1,xp,D1,xp,D1,xp],br={DISPLAY:Kf[X8],TEXT:Kf[D1],SCRIPT:Kf[jS],SCRIPTSCRIPT:Kf[gy]},nR=[{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 Eye(t){for(var e=0;e<nR.length;e++)for(var n=nR[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 u2=[];nR.forEach(t=>t.blocks.forEach(e=>u2.push(...e)));function jq(t){for(var e=0;e<u2.length;e+=2)if(t>=u2[e]&&t<=u2[e+1])return!0;return!1}var Hv=80,Aye=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"},Nye=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"},kye=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"},Rye=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"},Pye=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"},Dye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Iye=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"},Oye=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=Aye(n,Hv);break;case"sqrtSize1":i=Nye(n,Hv);break;case"sqrtSize2":i=kye(n,Hv);break;case"sqrtSize3":i=Rye(n,Hv);break;case"sqrtSize4":i=Pye(n,Hv);break;case"sqrtTall":i=Iye(n,Hv,r)}return i},Lye=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""}},LL={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`},jye=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 jw=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 nh={"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]}},z4={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]},jL={Å:"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 zye(t,e){nh[t]=e}function Y8(t,e,n){if(!nh[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=nh[e][r];if(!i&&t[0]in jL&&(r=jL[t[0]].charCodeAt(0),i=nh[e][r]),!i&&n==="text"&&jq(r)&&(i=nh[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var s6={};function Fye(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!s6[e]){var n=s6[e]={cssEmPerMu:z4.quad[e]/18};for(var r in z4)z4.hasOwnProperty(r)&&(n[r]=z4[r][e])}return s6[e]}var Uye=[[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]],zL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],FL=function(e,n){return n.size<2?e:Uye[e-1][n.size-1]};class ap{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||ap.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=zL[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 ap(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:FL(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:zL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=FL(ap.BASESIZE,e);return this.size===n&&this.textSize===ap.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!==ap.BASESIZE?["sizing","reset-size"+this.size,"size"+ap.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Fye(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}ap.BASESIZE=6;var rR={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},Bye={ex:!0,em:!0,mu:!0},zq=function(e){return typeof e!="string"&&(e=e.unit),e in rR||e in Bye||e==="ex"},to=function(e,n){var r;if(e.unit in rR)r=rR[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 fn("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},bn=function(e){return+e.toFixed(4)+"em"},hm=function(e){return e.filter(n=>n).join(" ")},Fq=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)}},Uq=function(e){var n=document.createElement(e);n.className=hm(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},Hye=/[\s"'>/=\x00-\x1f]/,Bq=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+yl(hm(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=$8(i)+":"+this.style[i]+";");r&&(n+=' style="'+yl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Hye.test(s))throw new fn("Invalid attribute name '"+s+"'");n+=" "+s+'="'+yl(this.attributes[s])+'"'}n+=">";for(var o=0;o<this.children.length;o++)n+=this.children[o].toMarkup();return n+="</"+e+">",n};class zw{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,Fq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return Uq.call(this,"span")}toMarkup(){return Bq.call(this,"span")}}class K8{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,Fq.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 Uq.call(this,"a")}toMarkup(){return Bq.call(this,"a")}}class Vye{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="'+yl(this.src)+'"'+(' alt="'+yl(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=$8(r)+":"+this.style[r]+";");return n&&(e+=' style="'+yl(n)+'"'),e+="'/>",e}}var Gye={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class dd{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=Eye(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Gye[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=bn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=hm(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+=yl(hm(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+=$8(i)+":"+this.style[i]+";");r&&(e=!0,n+=' style="'+yl(r)+'"');var s=yl(this.text);return e?(n+=">",n+=s,n+="</span>",n):s}}class wp{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+'="'+yl(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class pm{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",LL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+yl(this.alternate)+'"/>':'<path d="'+yl(LL[this.pathName])+'"/>'}}class iR{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+'="'+yl(this.attributes[n])+'"');return e+="/>",e}}function UL(t){if(t instanceof dd)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function Wye(t){if(t instanceof zw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var $ye={bin:1,close:1,inner:1,open:1,punct:1,rel:1},qye={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},ms={math:{},text:{}};function te(t,e,n,r,i,s){ms[t][i]={font:e,group:n,replace:r},s&&r&&(ms[t][r]=ms[t][i])}var ue="math",sn="text",Ce="main",tt="ams",Vs="accent-token",Dn="bin",Ql="close",Wy="inner",ir="mathord",Jo="op-token",_u="open",_C="punct",it="rel",Rp="spacing",gt="textord";te(ue,Ce,it,"≡","\\equiv",!0);te(ue,Ce,it,"≺","\\prec",!0);te(ue,Ce,it,"≻","\\succ",!0);te(ue,Ce,it,"∼","\\sim",!0);te(ue,Ce,it,"⊥","\\perp");te(ue,Ce,it,"⪯","\\preceq",!0);te(ue,Ce,it,"⪰","\\succeq",!0);te(ue,Ce,it,"≃","\\simeq",!0);te(ue,Ce,it,"∣","\\mid",!0);te(ue,Ce,it,"≪","\\ll",!0);te(ue,Ce,it,"≫","\\gg",!0);te(ue,Ce,it,"≍","\\asymp",!0);te(ue,Ce,it,"∥","\\parallel");te(ue,Ce,it,"⋈","\\bowtie",!0);te(ue,Ce,it,"⌣","\\smile",!0);te(ue,Ce,it,"⊑","\\sqsubseteq",!0);te(ue,Ce,it,"⊒","\\sqsupseteq",!0);te(ue,Ce,it,"≐","\\doteq",!0);te(ue,Ce,it,"⌢","\\frown",!0);te(ue,Ce,it,"∋","\\ni",!0);te(ue,Ce,it,"∝","\\propto",!0);te(ue,Ce,it,"⊢","\\vdash",!0);te(ue,Ce,it,"⊣","\\dashv",!0);te(ue,Ce,it,"∋","\\owns");te(ue,Ce,_C,".","\\ldotp");te(ue,Ce,_C,"⋅","\\cdotp");te(ue,Ce,gt,"#","\\#");te(sn,Ce,gt,"#","\\#");te(ue,Ce,gt,"&","\\&");te(sn,Ce,gt,"&","\\&");te(ue,Ce,gt,"ℵ","\\aleph",!0);te(ue,Ce,gt,"∀","\\forall",!0);te(ue,Ce,gt,"ℏ","\\hbar",!0);te(ue,Ce,gt,"∃","\\exists",!0);te(ue,Ce,gt,"∇","\\nabla",!0);te(ue,Ce,gt,"♭","\\flat",!0);te(ue,Ce,gt,"ℓ","\\ell",!0);te(ue,Ce,gt,"♮","\\natural",!0);te(ue,Ce,gt,"♣","\\clubsuit",!0);te(ue,Ce,gt,"℘","\\wp",!0);te(ue,Ce,gt,"♯","\\sharp",!0);te(ue,Ce,gt,"♢","\\diamondsuit",!0);te(ue,Ce,gt,"ℜ","\\Re",!0);te(ue,Ce,gt,"♡","\\heartsuit",!0);te(ue,Ce,gt,"ℑ","\\Im",!0);te(ue,Ce,gt,"♠","\\spadesuit",!0);te(ue,Ce,gt,"§","\\S",!0);te(sn,Ce,gt,"§","\\S");te(ue,Ce,gt,"¶","\\P",!0);te(sn,Ce,gt,"¶","\\P");te(ue,Ce,gt,"†","\\dag");te(sn,Ce,gt,"†","\\dag");te(sn,Ce,gt,"†","\\textdagger");te(ue,Ce,gt,"‡","\\ddag");te(sn,Ce,gt,"‡","\\ddag");te(sn,Ce,gt,"‡","\\textdaggerdbl");te(ue,Ce,Ql,"⎱","\\rmoustache",!0);te(ue,Ce,_u,"⎰","\\lmoustache",!0);te(ue,Ce,Ql,"⟯","\\rgroup",!0);te(ue,Ce,_u,"⟮","\\lgroup",!0);te(ue,Ce,Dn,"∓","\\mp",!0);te(ue,Ce,Dn,"⊖","\\ominus",!0);te(ue,Ce,Dn,"⊎","\\uplus",!0);te(ue,Ce,Dn,"⊓","\\sqcap",!0);te(ue,Ce,Dn,"∗","\\ast");te(ue,Ce,Dn,"⊔","\\sqcup",!0);te(ue,Ce,Dn,"◯","\\bigcirc",!0);te(ue,Ce,Dn,"∙","\\bullet",!0);te(ue,Ce,Dn,"‡","\\ddagger");te(ue,Ce,Dn,"≀","\\wr",!0);te(ue,Ce,Dn,"⨿","\\amalg");te(ue,Ce,Dn,"&","\\And");te(ue,Ce,it,"⟵","\\longleftarrow",!0);te(ue,Ce,it,"⇐","\\Leftarrow",!0);te(ue,Ce,it,"⟸","\\Longleftarrow",!0);te(ue,Ce,it,"⟶","\\longrightarrow",!0);te(ue,Ce,it,"⇒","\\Rightarrow",!0);te(ue,Ce,it,"⟹","\\Longrightarrow",!0);te(ue,Ce,it,"↔","\\leftrightarrow",!0);te(ue,Ce,it,"⟷","\\longleftrightarrow",!0);te(ue,Ce,it,"⇔","\\Leftrightarrow",!0);te(ue,Ce,it,"⟺","\\Longleftrightarrow",!0);te(ue,Ce,it,"↦","\\mapsto",!0);te(ue,Ce,it,"⟼","\\longmapsto",!0);te(ue,Ce,it,"↗","\\nearrow",!0);te(ue,Ce,it,"↩","\\hookleftarrow",!0);te(ue,Ce,it,"↪","\\hookrightarrow",!0);te(ue,Ce,it,"↘","\\searrow",!0);te(ue,Ce,it,"↼","\\leftharpoonup",!0);te(ue,Ce,it,"⇀","\\rightharpoonup",!0);te(ue,Ce,it,"↙","\\swarrow",!0);te(ue,Ce,it,"↽","\\leftharpoondown",!0);te(ue,Ce,it,"⇁","\\rightharpoondown",!0);te(ue,Ce,it,"↖","\\nwarrow",!0);te(ue,Ce,it,"⇌","\\rightleftharpoons",!0);te(ue,tt,it,"≮","\\nless",!0);te(ue,tt,it,"","\\@nleqslant");te(ue,tt,it,"","\\@nleqq");te(ue,tt,it,"⪇","\\lneq",!0);te(ue,tt,it,"≨","\\lneqq",!0);te(ue,tt,it,"","\\@lvertneqq");te(ue,tt,it,"⋦","\\lnsim",!0);te(ue,tt,it,"⪉","\\lnapprox",!0);te(ue,tt,it,"⊀","\\nprec",!0);te(ue,tt,it,"⋠","\\npreceq",!0);te(ue,tt,it,"⋨","\\precnsim",!0);te(ue,tt,it,"⪹","\\precnapprox",!0);te(ue,tt,it,"≁","\\nsim",!0);te(ue,tt,it,"","\\@nshortmid");te(ue,tt,it,"∤","\\nmid",!0);te(ue,tt,it,"⊬","\\nvdash",!0);te(ue,tt,it,"⊭","\\nvDash",!0);te(ue,tt,it,"⋪","\\ntriangleleft");te(ue,tt,it,"⋬","\\ntrianglelefteq",!0);te(ue,tt,it,"⊊","\\subsetneq",!0);te(ue,tt,it,"","\\@varsubsetneq");te(ue,tt,it,"⫋","\\subsetneqq",!0);te(ue,tt,it,"","\\@varsubsetneqq");te(ue,tt,it,"≯","\\ngtr",!0);te(ue,tt,it,"","\\@ngeqslant");te(ue,tt,it,"","\\@ngeqq");te(ue,tt,it,"⪈","\\gneq",!0);te(ue,tt,it,"≩","\\gneqq",!0);te(ue,tt,it,"","\\@gvertneqq");te(ue,tt,it,"⋧","\\gnsim",!0);te(ue,tt,it,"⪊","\\gnapprox",!0);te(ue,tt,it,"⊁","\\nsucc",!0);te(ue,tt,it,"⋡","\\nsucceq",!0);te(ue,tt,it,"⋩","\\succnsim",!0);te(ue,tt,it,"⪺","\\succnapprox",!0);te(ue,tt,it,"≆","\\ncong",!0);te(ue,tt,it,"","\\@nshortparallel");te(ue,tt,it,"∦","\\nparallel",!0);te(ue,tt,it,"⊯","\\nVDash",!0);te(ue,tt,it,"⋫","\\ntriangleright");te(ue,tt,it,"⋭","\\ntrianglerighteq",!0);te(ue,tt,it,"","\\@nsupseteqq");te(ue,tt,it,"⊋","\\supsetneq",!0);te(ue,tt,it,"","\\@varsupsetneq");te(ue,tt,it,"⫌","\\supsetneqq",!0);te(ue,tt,it,"","\\@varsupsetneqq");te(ue,tt,it,"⊮","\\nVdash",!0);te(ue,tt,it,"⪵","\\precneqq",!0);te(ue,tt,it,"⪶","\\succneqq",!0);te(ue,tt,it,"","\\@nsubseteqq");te(ue,tt,Dn,"⊴","\\unlhd");te(ue,tt,Dn,"⊵","\\unrhd");te(ue,tt,it,"↚","\\nleftarrow",!0);te(ue,tt,it,"↛","\\nrightarrow",!0);te(ue,tt,it,"⇍","\\nLeftarrow",!0);te(ue,tt,it,"⇏","\\nRightarrow",!0);te(ue,tt,it,"↮","\\nleftrightarrow",!0);te(ue,tt,it,"⇎","\\nLeftrightarrow",!0);te(ue,tt,it,"△","\\vartriangle");te(ue,tt,gt,"ℏ","\\hslash");te(ue,tt,gt,"▽","\\triangledown");te(ue,tt,gt,"◊","\\lozenge");te(ue,tt,gt,"Ⓢ","\\circledS");te(ue,tt,gt,"®","\\circledR");te(sn,tt,gt,"®","\\circledR");te(ue,tt,gt,"∡","\\measuredangle",!0);te(ue,tt,gt,"∄","\\nexists");te(ue,tt,gt,"℧","\\mho");te(ue,tt,gt,"Ⅎ","\\Finv",!0);te(ue,tt,gt,"⅁","\\Game",!0);te(ue,tt,gt,"‵","\\backprime");te(ue,tt,gt,"▲","\\blacktriangle");te(ue,tt,gt,"▼","\\blacktriangledown");te(ue,tt,gt,"■","\\blacksquare");te(ue,tt,gt,"⧫","\\blacklozenge");te(ue,tt,gt,"★","\\bigstar");te(ue,tt,gt,"∢","\\sphericalangle",!0);te(ue,tt,gt,"∁","\\complement",!0);te(ue,tt,gt,"ð","\\eth",!0);te(sn,Ce,gt,"ð","ð");te(ue,tt,gt,"╱","\\diagup");te(ue,tt,gt,"╲","\\diagdown");te(ue,tt,gt,"□","\\square");te(ue,tt,gt,"□","\\Box");te(ue,tt,gt,"◊","\\Diamond");te(ue,tt,gt,"¥","\\yen",!0);te(sn,tt,gt,"¥","\\yen",!0);te(ue,tt,gt,"✓","\\checkmark",!0);te(sn,tt,gt,"✓","\\checkmark");te(ue,tt,gt,"ℶ","\\beth",!0);te(ue,tt,gt,"ℸ","\\daleth",!0);te(ue,tt,gt,"ℷ","\\gimel",!0);te(ue,tt,gt,"ϝ","\\digamma",!0);te(ue,tt,gt,"ϰ","\\varkappa");te(ue,tt,_u,"┌","\\@ulcorner",!0);te(ue,tt,Ql,"┐","\\@urcorner",!0);te(ue,tt,_u,"└","\\@llcorner",!0);te(ue,tt,Ql,"┘","\\@lrcorner",!0);te(ue,tt,it,"≦","\\leqq",!0);te(ue,tt,it,"⩽","\\leqslant",!0);te(ue,tt,it,"⪕","\\eqslantless",!0);te(ue,tt,it,"≲","\\lesssim",!0);te(ue,tt,it,"⪅","\\lessapprox",!0);te(ue,tt,it,"≊","\\approxeq",!0);te(ue,tt,Dn,"⋖","\\lessdot");te(ue,tt,it,"⋘","\\lll",!0);te(ue,tt,it,"≶","\\lessgtr",!0);te(ue,tt,it,"⋚","\\lesseqgtr",!0);te(ue,tt,it,"⪋","\\lesseqqgtr",!0);te(ue,tt,it,"≑","\\doteqdot");te(ue,tt,it,"≓","\\risingdotseq",!0);te(ue,tt,it,"≒","\\fallingdotseq",!0);te(ue,tt,it,"∽","\\backsim",!0);te(ue,tt,it,"⋍","\\backsimeq",!0);te(ue,tt,it,"⫅","\\subseteqq",!0);te(ue,tt,it,"⋐","\\Subset",!0);te(ue,tt,it,"⊏","\\sqsubset",!0);te(ue,tt,it,"≼","\\preccurlyeq",!0);te(ue,tt,it,"⋞","\\curlyeqprec",!0);te(ue,tt,it,"≾","\\precsim",!0);te(ue,tt,it,"⪷","\\precapprox",!0);te(ue,tt,it,"⊲","\\vartriangleleft");te(ue,tt,it,"⊴","\\trianglelefteq");te(ue,tt,it,"⊨","\\vDash",!0);te(ue,tt,it,"⊪","\\Vvdash",!0);te(ue,tt,it,"⌣","\\smallsmile");te(ue,tt,it,"⌢","\\smallfrown");te(ue,tt,it,"≏","\\bumpeq",!0);te(ue,tt,it,"≎","\\Bumpeq",!0);te(ue,tt,it,"≧","\\geqq",!0);te(ue,tt,it,"⩾","\\geqslant",!0);te(ue,tt,it,"⪖","\\eqslantgtr",!0);te(ue,tt,it,"≳","\\gtrsim",!0);te(ue,tt,it,"⪆","\\gtrapprox",!0);te(ue,tt,Dn,"⋗","\\gtrdot");te(ue,tt,it,"⋙","\\ggg",!0);te(ue,tt,it,"≷","\\gtrless",!0);te(ue,tt,it,"⋛","\\gtreqless",!0);te(ue,tt,it,"⪌","\\gtreqqless",!0);te(ue,tt,it,"≖","\\eqcirc",!0);te(ue,tt,it,"≗","\\circeq",!0);te(ue,tt,it,"≜","\\triangleq",!0);te(ue,tt,it,"∼","\\thicksim");te(ue,tt,it,"≈","\\thickapprox");te(ue,tt,it,"⫆","\\supseteqq",!0);te(ue,tt,it,"⋑","\\Supset",!0);te(ue,tt,it,"⊐","\\sqsupset",!0);te(ue,tt,it,"≽","\\succcurlyeq",!0);te(ue,tt,it,"⋟","\\curlyeqsucc",!0);te(ue,tt,it,"≿","\\succsim",!0);te(ue,tt,it,"⪸","\\succapprox",!0);te(ue,tt,it,"⊳","\\vartriangleright");te(ue,tt,it,"⊵","\\trianglerighteq");te(ue,tt,it,"⊩","\\Vdash",!0);te(ue,tt,it,"∣","\\shortmid");te(ue,tt,it,"∥","\\shortparallel");te(ue,tt,it,"≬","\\between",!0);te(ue,tt,it,"⋔","\\pitchfork",!0);te(ue,tt,it,"∝","\\varpropto");te(ue,tt,it,"◀","\\blacktriangleleft");te(ue,tt,it,"∴","\\therefore",!0);te(ue,tt,it,"∍","\\backepsilon");te(ue,tt,it,"▶","\\blacktriangleright");te(ue,tt,it,"∵","\\because",!0);te(ue,tt,it,"⋘","\\llless");te(ue,tt,it,"⋙","\\gggtr");te(ue,tt,Dn,"⊲","\\lhd");te(ue,tt,Dn,"⊳","\\rhd");te(ue,tt,it,"≂","\\eqsim",!0);te(ue,Ce,it,"⋈","\\Join");te(ue,tt,it,"≑","\\Doteq",!0);te(ue,tt,Dn,"∔","\\dotplus",!0);te(ue,tt,Dn,"∖","\\smallsetminus");te(ue,tt,Dn,"⋒","\\Cap",!0);te(ue,tt,Dn,"⋓","\\Cup",!0);te(ue,tt,Dn,"⩞","\\doublebarwedge",!0);te(ue,tt,Dn,"⊟","\\boxminus",!0);te(ue,tt,Dn,"⊞","\\boxplus",!0);te(ue,tt,Dn,"⋇","\\divideontimes",!0);te(ue,tt,Dn,"⋉","\\ltimes",!0);te(ue,tt,Dn,"⋊","\\rtimes",!0);te(ue,tt,Dn,"⋋","\\leftthreetimes",!0);te(ue,tt,Dn,"⋌","\\rightthreetimes",!0);te(ue,tt,Dn,"⋏","\\curlywedge",!0);te(ue,tt,Dn,"⋎","\\curlyvee",!0);te(ue,tt,Dn,"⊝","\\circleddash",!0);te(ue,tt,Dn,"⊛","\\circledast",!0);te(ue,tt,Dn,"⋅","\\centerdot");te(ue,tt,Dn,"⊺","\\intercal",!0);te(ue,tt,Dn,"⋒","\\doublecap");te(ue,tt,Dn,"⋓","\\doublecup");te(ue,tt,Dn,"⊠","\\boxtimes",!0);te(ue,tt,it,"⇢","\\dashrightarrow",!0);te(ue,tt,it,"⇠","\\dashleftarrow",!0);te(ue,tt,it,"⇇","\\leftleftarrows",!0);te(ue,tt,it,"⇆","\\leftrightarrows",!0);te(ue,tt,it,"⇚","\\Lleftarrow",!0);te(ue,tt,it,"↞","\\twoheadleftarrow",!0);te(ue,tt,it,"↢","\\leftarrowtail",!0);te(ue,tt,it,"↫","\\looparrowleft",!0);te(ue,tt,it,"⇋","\\leftrightharpoons",!0);te(ue,tt,it,"↶","\\curvearrowleft",!0);te(ue,tt,it,"↺","\\circlearrowleft",!0);te(ue,tt,it,"↰","\\Lsh",!0);te(ue,tt,it,"⇈","\\upuparrows",!0);te(ue,tt,it,"↿","\\upharpoonleft",!0);te(ue,tt,it,"⇃","\\downharpoonleft",!0);te(ue,Ce,it,"⊶","\\origof",!0);te(ue,Ce,it,"⊷","\\imageof",!0);te(ue,tt,it,"⊸","\\multimap",!0);te(ue,tt,it,"↭","\\leftrightsquigarrow",!0);te(ue,tt,it,"⇉","\\rightrightarrows",!0);te(ue,tt,it,"⇄","\\rightleftarrows",!0);te(ue,tt,it,"↠","\\twoheadrightarrow",!0);te(ue,tt,it,"↣","\\rightarrowtail",!0);te(ue,tt,it,"↬","\\looparrowright",!0);te(ue,tt,it,"↷","\\curvearrowright",!0);te(ue,tt,it,"↻","\\circlearrowright",!0);te(ue,tt,it,"↱","\\Rsh",!0);te(ue,tt,it,"⇊","\\downdownarrows",!0);te(ue,tt,it,"↾","\\upharpoonright",!0);te(ue,tt,it,"⇂","\\downharpoonright",!0);te(ue,tt,it,"⇝","\\rightsquigarrow",!0);te(ue,tt,it,"⇝","\\leadsto");te(ue,tt,it,"⇛","\\Rrightarrow",!0);te(ue,tt,it,"↾","\\restriction");te(ue,Ce,gt,"‘","`");te(ue,Ce,gt,"$","\\$");te(sn,Ce,gt,"$","\\$");te(sn,Ce,gt,"$","\\textdollar");te(ue,Ce,gt,"%","\\%");te(sn,Ce,gt,"%","\\%");te(ue,Ce,gt,"_","\\_");te(sn,Ce,gt,"_","\\_");te(sn,Ce,gt,"_","\\textunderscore");te(ue,Ce,gt,"∠","\\angle",!0);te(ue,Ce,gt,"∞","\\infty",!0);te(ue,Ce,gt,"′","\\prime");te(ue,Ce,gt,"△","\\triangle");te(ue,Ce,gt,"Γ","\\Gamma",!0);te(ue,Ce,gt,"Δ","\\Delta",!0);te(ue,Ce,gt,"Θ","\\Theta",!0);te(ue,Ce,gt,"Λ","\\Lambda",!0);te(ue,Ce,gt,"Ξ","\\Xi",!0);te(ue,Ce,gt,"Π","\\Pi",!0);te(ue,Ce,gt,"Σ","\\Sigma",!0);te(ue,Ce,gt,"Υ","\\Upsilon",!0);te(ue,Ce,gt,"Φ","\\Phi",!0);te(ue,Ce,gt,"Ψ","\\Psi",!0);te(ue,Ce,gt,"Ω","\\Omega",!0);te(ue,Ce,gt,"A","Α");te(ue,Ce,gt,"B","Β");te(ue,Ce,gt,"E","Ε");te(ue,Ce,gt,"Z","Ζ");te(ue,Ce,gt,"H","Η");te(ue,Ce,gt,"I","Ι");te(ue,Ce,gt,"K","Κ");te(ue,Ce,gt,"M","Μ");te(ue,Ce,gt,"N","Ν");te(ue,Ce,gt,"O","Ο");te(ue,Ce,gt,"P","Ρ");te(ue,Ce,gt,"T","Τ");te(ue,Ce,gt,"X","Χ");te(ue,Ce,gt,"¬","\\neg",!0);te(ue,Ce,gt,"¬","\\lnot");te(ue,Ce,gt,"⊤","\\top");te(ue,Ce,gt,"⊥","\\bot");te(ue,Ce,gt,"∅","\\emptyset");te(ue,tt,gt,"∅","\\varnothing");te(ue,Ce,ir,"α","\\alpha",!0);te(ue,Ce,ir,"β","\\beta",!0);te(ue,Ce,ir,"γ","\\gamma",!0);te(ue,Ce,ir,"δ","\\delta",!0);te(ue,Ce,ir,"ϵ","\\epsilon",!0);te(ue,Ce,ir,"ζ","\\zeta",!0);te(ue,Ce,ir,"η","\\eta",!0);te(ue,Ce,ir,"θ","\\theta",!0);te(ue,Ce,ir,"ι","\\iota",!0);te(ue,Ce,ir,"κ","\\kappa",!0);te(ue,Ce,ir,"λ","\\lambda",!0);te(ue,Ce,ir,"μ","\\mu",!0);te(ue,Ce,ir,"ν","\\nu",!0);te(ue,Ce,ir,"ξ","\\xi",!0);te(ue,Ce,ir,"ο","\\omicron",!0);te(ue,Ce,ir,"π","\\pi",!0);te(ue,Ce,ir,"ρ","\\rho",!0);te(ue,Ce,ir,"σ","\\sigma",!0);te(ue,Ce,ir,"τ","\\tau",!0);te(ue,Ce,ir,"υ","\\upsilon",!0);te(ue,Ce,ir,"ϕ","\\phi",!0);te(ue,Ce,ir,"χ","\\chi",!0);te(ue,Ce,ir,"ψ","\\psi",!0);te(ue,Ce,ir,"ω","\\omega",!0);te(ue,Ce,ir,"ε","\\varepsilon",!0);te(ue,Ce,ir,"ϑ","\\vartheta",!0);te(ue,Ce,ir,"ϖ","\\varpi",!0);te(ue,Ce,ir,"ϱ","\\varrho",!0);te(ue,Ce,ir,"ς","\\varsigma",!0);te(ue,Ce,ir,"φ","\\varphi",!0);te(ue,Ce,Dn,"∗","*",!0);te(ue,Ce,Dn,"+","+");te(ue,Ce,Dn,"−","-",!0);te(ue,Ce,Dn,"⋅","\\cdot",!0);te(ue,Ce,Dn,"∘","\\circ",!0);te(ue,Ce,Dn,"÷","\\div",!0);te(ue,Ce,Dn,"±","\\pm",!0);te(ue,Ce,Dn,"×","\\times",!0);te(ue,Ce,Dn,"∩","\\cap",!0);te(ue,Ce,Dn,"∪","\\cup",!0);te(ue,Ce,Dn,"∖","\\setminus",!0);te(ue,Ce,Dn,"∧","\\land");te(ue,Ce,Dn,"∨","\\lor");te(ue,Ce,Dn,"∧","\\wedge",!0);te(ue,Ce,Dn,"∨","\\vee",!0);te(ue,Ce,gt,"√","\\surd");te(ue,Ce,_u,"⟨","\\langle",!0);te(ue,Ce,_u,"∣","\\lvert");te(ue,Ce,_u,"∥","\\lVert");te(ue,Ce,Ql,"?","?");te(ue,Ce,Ql,"!","!");te(ue,Ce,Ql,"⟩","\\rangle",!0);te(ue,Ce,Ql,"∣","\\rvert");te(ue,Ce,Ql,"∥","\\rVert");te(ue,Ce,it,"=","=");te(ue,Ce,it,":",":");te(ue,Ce,it,"≈","\\approx",!0);te(ue,Ce,it,"≅","\\cong",!0);te(ue,Ce,it,"≥","\\ge");te(ue,Ce,it,"≥","\\geq",!0);te(ue,Ce,it,"←","\\gets");te(ue,Ce,it,">","\\gt",!0);te(ue,Ce,it,"∈","\\in",!0);te(ue,Ce,it,"","\\@not");te(ue,Ce,it,"⊂","\\subset",!0);te(ue,Ce,it,"⊃","\\supset",!0);te(ue,Ce,it,"⊆","\\subseteq",!0);te(ue,Ce,it,"⊇","\\supseteq",!0);te(ue,tt,it,"⊈","\\nsubseteq",!0);te(ue,tt,it,"⊉","\\nsupseteq",!0);te(ue,Ce,it,"⊨","\\models");te(ue,Ce,it,"←","\\leftarrow",!0);te(ue,Ce,it,"≤","\\le");te(ue,Ce,it,"≤","\\leq",!0);te(ue,Ce,it,"<","\\lt",!0);te(ue,Ce,it,"→","\\rightarrow",!0);te(ue,Ce,it,"→","\\to");te(ue,tt,it,"≱","\\ngeq",!0);te(ue,tt,it,"≰","\\nleq",!0);te(ue,Ce,Rp," ","\\ ");te(ue,Ce,Rp," ","\\space");te(ue,Ce,Rp," ","\\nobreakspace");te(sn,Ce,Rp," ","\\ ");te(sn,Ce,Rp," "," ");te(sn,Ce,Rp," ","\\space");te(sn,Ce,Rp," ","\\nobreakspace");te(ue,Ce,Rp,null,"\\nobreak");te(ue,Ce,Rp,null,"\\allowbreak");te(ue,Ce,_C,",",",");te(ue,Ce,_C,";",";");te(ue,tt,Dn,"⊼","\\barwedge",!0);te(ue,tt,Dn,"⊻","\\veebar",!0);te(ue,Ce,Dn,"⊙","\\odot",!0);te(ue,Ce,Dn,"⊕","\\oplus",!0);te(ue,Ce,Dn,"⊗","\\otimes",!0);te(ue,Ce,gt,"∂","\\partial",!0);te(ue,Ce,Dn,"⊘","\\oslash",!0);te(ue,tt,Dn,"⊚","\\circledcirc",!0);te(ue,tt,Dn,"⊡","\\boxdot",!0);te(ue,Ce,Dn,"△","\\bigtriangleup");te(ue,Ce,Dn,"▽","\\bigtriangledown");te(ue,Ce,Dn,"†","\\dagger");te(ue,Ce,Dn,"⋄","\\diamond");te(ue,Ce,Dn,"⋆","\\star");te(ue,Ce,Dn,"◃","\\triangleleft");te(ue,Ce,Dn,"▹","\\triangleright");te(ue,Ce,_u,"{","\\{");te(sn,Ce,gt,"{","\\{");te(sn,Ce,gt,"{","\\textbraceleft");te(ue,Ce,Ql,"}","\\}");te(sn,Ce,gt,"}","\\}");te(sn,Ce,gt,"}","\\textbraceright");te(ue,Ce,_u,"{","\\lbrace");te(ue,Ce,Ql,"}","\\rbrace");te(ue,Ce,_u,"[","\\lbrack",!0);te(sn,Ce,gt,"[","\\lbrack",!0);te(ue,Ce,Ql,"]","\\rbrack",!0);te(sn,Ce,gt,"]","\\rbrack",!0);te(ue,Ce,_u,"(","\\lparen",!0);te(ue,Ce,Ql,")","\\rparen",!0);te(sn,Ce,gt,"<","\\textless",!0);te(sn,Ce,gt,">","\\textgreater",!0);te(ue,Ce,_u,"⌊","\\lfloor",!0);te(ue,Ce,Ql,"⌋","\\rfloor",!0);te(ue,Ce,_u,"⌈","\\lceil",!0);te(ue,Ce,Ql,"⌉","\\rceil",!0);te(ue,Ce,gt,"\\","\\backslash");te(ue,Ce,gt,"∣","|");te(ue,Ce,gt,"∣","\\vert");te(sn,Ce,gt,"|","\\textbar",!0);te(ue,Ce,gt,"∥","\\|");te(ue,Ce,gt,"∥","\\Vert");te(sn,Ce,gt,"∥","\\textbardbl");te(sn,Ce,gt,"~","\\textasciitilde");te(sn,Ce,gt,"\\","\\textbackslash");te(sn,Ce,gt,"^","\\textasciicircum");te(ue,Ce,it,"↑","\\uparrow",!0);te(ue,Ce,it,"⇑","\\Uparrow",!0);te(ue,Ce,it,"↓","\\downarrow",!0);te(ue,Ce,it,"⇓","\\Downarrow",!0);te(ue,Ce,it,"↕","\\updownarrow",!0);te(ue,Ce,it,"⇕","\\Updownarrow",!0);te(ue,Ce,Jo,"∐","\\coprod");te(ue,Ce,Jo,"⋁","\\bigvee");te(ue,Ce,Jo,"⋀","\\bigwedge");te(ue,Ce,Jo,"⨄","\\biguplus");te(ue,Ce,Jo,"⋂","\\bigcap");te(ue,Ce,Jo,"⋃","\\bigcup");te(ue,Ce,Jo,"∫","\\int");te(ue,Ce,Jo,"∫","\\intop");te(ue,Ce,Jo,"∬","\\iint");te(ue,Ce,Jo,"∭","\\iiint");te(ue,Ce,Jo,"∏","\\prod");te(ue,Ce,Jo,"∑","\\sum");te(ue,Ce,Jo,"⨂","\\bigotimes");te(ue,Ce,Jo,"⨁","\\bigoplus");te(ue,Ce,Jo,"⨀","\\bigodot");te(ue,Ce,Jo,"∮","\\oint");te(ue,Ce,Jo,"∯","\\oiint");te(ue,Ce,Jo,"∰","\\oiiint");te(ue,Ce,Jo,"⨆","\\bigsqcup");te(ue,Ce,Jo,"∫","\\smallint");te(sn,Ce,Wy,"…","\\textellipsis");te(ue,Ce,Wy,"…","\\mathellipsis");te(sn,Ce,Wy,"…","\\ldots",!0);te(ue,Ce,Wy,"…","\\ldots",!0);te(ue,Ce,Wy,"⋯","\\@cdots",!0);te(ue,Ce,Wy,"⋱","\\ddots",!0);te(ue,Ce,gt,"⋮","\\varvdots");te(sn,Ce,gt,"⋮","\\varvdots");te(ue,Ce,Vs,"ˊ","\\acute");te(ue,Ce,Vs,"ˋ","\\grave");te(ue,Ce,Vs,"¨","\\ddot");te(ue,Ce,Vs,"~","\\tilde");te(ue,Ce,Vs,"ˉ","\\bar");te(ue,Ce,Vs,"˘","\\breve");te(ue,Ce,Vs,"ˇ","\\check");te(ue,Ce,Vs,"^","\\hat");te(ue,Ce,Vs,"⃗","\\vec");te(ue,Ce,Vs,"˙","\\dot");te(ue,Ce,Vs,"˚","\\mathring");te(ue,Ce,ir,"","\\@imath");te(ue,Ce,ir,"","\\@jmath");te(ue,Ce,gt,"ı","ı");te(ue,Ce,gt,"ȷ","ȷ");te(sn,Ce,gt,"ı","\\i",!0);te(sn,Ce,gt,"ȷ","\\j",!0);te(sn,Ce,gt,"ß","\\ss",!0);te(sn,Ce,gt,"æ","\\ae",!0);te(sn,Ce,gt,"œ","\\oe",!0);te(sn,Ce,gt,"ø","\\o",!0);te(sn,Ce,gt,"Æ","\\AE",!0);te(sn,Ce,gt,"Œ","\\OE",!0);te(sn,Ce,gt,"Ø","\\O",!0);te(sn,Ce,Vs,"ˊ","\\'");te(sn,Ce,Vs,"ˋ","\\`");te(sn,Ce,Vs,"ˆ","\\^");te(sn,Ce,Vs,"˜","\\~");te(sn,Ce,Vs,"ˉ","\\=");te(sn,Ce,Vs,"˘","\\u");te(sn,Ce,Vs,"˙","\\.");te(sn,Ce,Vs,"¸","\\c");te(sn,Ce,Vs,"˚","\\r");te(sn,Ce,Vs,"ˇ","\\v");te(sn,Ce,Vs,"¨",'\\"');te(sn,Ce,Vs,"˝","\\H");te(sn,Ce,Vs,"◯","\\textcircled");var Hq={"--":!0,"---":!0,"``":!0,"''":!0};te(sn,Ce,gt,"–","--",!0);te(sn,Ce,gt,"–","\\textendash");te(sn,Ce,gt,"—","---",!0);te(sn,Ce,gt,"—","\\textemdash");te(sn,Ce,gt,"‘","`",!0);te(sn,Ce,gt,"‘","\\textquoteleft");te(sn,Ce,gt,"’","'",!0);te(sn,Ce,gt,"’","\\textquoteright");te(sn,Ce,gt,"“","``",!0);te(sn,Ce,gt,"“","\\textquotedblleft");te(sn,Ce,gt,"”","''",!0);te(sn,Ce,gt,"”","\\textquotedblright");te(ue,Ce,gt,"°","\\degree",!0);te(sn,Ce,gt,"°","\\degree");te(sn,Ce,gt,"°","\\textdegree",!0);te(ue,Ce,gt,"£","\\pounds");te(ue,Ce,gt,"£","\\mathsterling",!0);te(sn,Ce,gt,"£","\\pounds");te(sn,Ce,gt,"£","\\textsterling",!0);te(ue,tt,gt,"✠","\\maltese");te(sn,tt,gt,"✠","\\maltese");var BL='0123456789/@."';for(var o6=0;o6<BL.length;o6++){var HL=BL.charAt(o6);te(ue,Ce,gt,HL,HL)}var VL='0123456789!@*()-=+";:?/.,';for(var a6=0;a6<VL.length;a6++){var GL=VL.charAt(a6);te(sn,Ce,gt,GL,GL)}var s5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var l6=0;l6<s5.length;l6++){var F4=s5.charAt(l6);te(ue,Ce,ir,F4,F4),te(sn,Ce,gt,F4,F4)}te(ue,tt,gt,"C","ℂ");te(sn,tt,gt,"C","ℂ");te(ue,tt,gt,"H","ℍ");te(sn,tt,gt,"H","ℍ");te(ue,tt,gt,"N","ℕ");te(sn,tt,gt,"N","ℕ");te(ue,tt,gt,"P","ℙ");te(sn,tt,gt,"P","ℙ");te(ue,tt,gt,"Q","ℚ");te(sn,tt,gt,"Q","ℚ");te(ue,tt,gt,"R","ℝ");te(sn,tt,gt,"R","ℝ");te(ue,tt,gt,"Z","ℤ");te(sn,tt,gt,"Z","ℤ");te(ue,Ce,ir,"h","ℎ");te(sn,Ce,ir,"h","ℎ");var mr="";for(var jl=0;jl<s5.length;jl++){var xo=s5.charAt(jl);mr=String.fromCharCode(55349,56320+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56372+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56424+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56580+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56684+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56736+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56788+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56840+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56944+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),jl<26&&(mr=String.fromCharCode(55349,56632+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr),mr=String.fromCharCode(55349,56476+jl),te(ue,Ce,ir,xo,mr),te(sn,Ce,gt,xo,mr))}mr="𝕜";te(ue,Ce,ir,"k",mr);te(sn,Ce,gt,"k",mr);for(var Sg=0;Sg<10;Sg++){var M0=Sg.toString();mr=String.fromCharCode(55349,57294+Sg),te(ue,Ce,ir,M0,mr),te(sn,Ce,gt,M0,mr),mr=String.fromCharCode(55349,57314+Sg),te(ue,Ce,ir,M0,mr),te(sn,Ce,gt,M0,mr),mr=String.fromCharCode(55349,57324+Sg),te(ue,Ce,ir,M0,mr),te(sn,Ce,gt,M0,mr),mr=String.fromCharCode(55349,57334+Sg),te(ue,Ce,ir,M0,mr),te(sn,Ce,gt,M0,mr)}var sR="ÐÞþ";for(var c6=0;c6<sR.length;c6++){var U4=sR.charAt(c6);te(ue,Ce,ir,U4,U4),te(sn,Ce,gt,U4,U4)}var B4=[["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"]],WL=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Xye=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[B4[a][2],B4[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[WL[l][2],WL[l][o]]}else{if(s===120485||s===120486)return[B4[0][2],B4[0][o]];if(120486<s&&s<120782)return["",""];throw new fn("Unsupported character: "+e)}},SC=function(e,n,r){return ms[r][e]&&ms[r][e].replace&&(e=ms[r][e].replace),{value:e,metrics:Y8(e,n,r)}},Vl=function(e,n,r,i,s){var o=SC(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 dd(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 dd(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},Z8=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&SC(e,"Main-Bold",n).metrics?Vl(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||ms[n][e].font==="main"?Vl(e,"Main-Regular",n,r,i):Vl(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},Yye=function(e,n,r,i,s){return s!=="textord"&&SC(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},wC=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]=Xye(s,i)),c.length>0)return Vl(s,c,i,n,o.concat(d));if(l){var p,m;if(l==="boldsymbol"){var x=Yye(s,i,n,o,r);p=x.fontName,m=[x.fontClass]}else a?(p=oR[l].fontName,m=[l]):(p=H4(l,n.fontWeight,n.fontShape),m=[l,n.fontWeight,n.fontShape]);if(SC(s,p,i).metrics)return Vl(s,p,i,n,o.concat(m));if(Hq.hasOwnProperty(s)&&p.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Vl(s[_],p,i,n,o.concat(m)));return Pp(b)}}if(r==="mathord")return Vl(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var S=ms[i][s]&&ms[i][s].font;if(S==="ams"){var M=H4("amsrm",n.fontWeight,n.fontShape);return Vl(s,M,i,n,o.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var C=H4("textrm",n.fontWeight,n.fontShape);return Vl(s,C,i,n,o.concat(n.fontWeight,n.fontShape))}else{var A=H4(S,n.fontWeight,n.fontShape);return Vl(s,A,i,n,o.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},Kye=(t,e)=>{if(hm(t.classes)!==hm(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},Vq=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof dd&&r instanceof dd&&Kye(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},Q8=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},an=function(e,n,r,i){var s=new zw(e,n,r,i);return Q8(s),s},mm=(t,e,n,r)=>new zw(t,e,n,r),xy=function(e,n,r){var i=an([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=bn(i.height),i.maxFontSize=1,i},Zye=function(e,n,r,i){var s=new K8(e,n,r,i);return Q8(s),s},Pp=function(e){var n=new jw(e);return Q8(n),n},vy=function(e,n){return e instanceof jw?an([],[e],n):e},Qye=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}=Qye(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=an(["pstrut"],[]);c.style.height=bn(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,M=_.wrapperClasses||[],C=_.wrapperStyle||{},A=an(M,[c,S],void 0,C);A.style.top=bn(-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=an(["vlist"],d);N.style.height=bn(m);var D;if(p<0){var R=an([],[]),L=an(["vlist"],[R]);L.style.height=bn(-p);var k=an(["vlist-s"],[new dd("​")]);D=[an(["vlist-r"],[N,k]),an(["vlist-r"],[L])]}else D=[an(["vlist-r"],[N])];var O=an(["vlist-t"],D);return D.length===2&&O.classes.push("vlist-t2"),O.height=m,O.depth=-p,O},Gq=(t,e)=>{var n=an(["mspace"],[],e),r=to(t,e);return n.style.marginRight=bn(r),n},H4=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},oR={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]},$q=function(e,n){var[r,i,s]=Wq[e],o=new pm(r),a=new wp([o],{width:bn(i),height:bn(s),style:"width:"+bn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=mm(["overlay"],[a],n);return l.height=s,l.style.height=bn(s),l.style.width=bn(i),l},Js={number:3,unit:"mu"},wg={number:4,unit:"mu"},Qh={number:5,unit:"mu"},Jye={mord:{mop:Js,mbin:wg,mrel:Qh,minner:Js},mop:{mord:Js,mop:Js,mrel:Qh,minner:Js},mbin:{mord:wg,mop:wg,mopen:wg,minner:wg},mrel:{mord:Qh,mop:Qh,mopen:Qh,minner:Qh},mopen:{},mclose:{mop:Js,mbin:wg,mrel:Qh,minner:Js},mpunct:{mord:Js,mop:Js,mrel:Qh,mopen:Js,mclose:Js,mpunct:Js,minner:Js},minner:{mord:Js,mop:Js,mbin:wg,mrel:Qh,mopen:Js,mpunct:Js,minner:Js}},ebe={mord:{mop:Js},mop:{mord:Js,mop:Js},mbin:{},mrel:{},mopen:{},mclose:{mop:Js},mpunct:{},minner:{mop:Js}},qq={},o5={},a5={};function Rn(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)qq[n[l]]=a;e&&(s&&(o5[e]=s),o&&(a5[e]=o))}function zx(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;Rn({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var l5=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Ro=function(e){return e.type==="ordgroup"?e.body:[e]},tbe=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),nbe=new Set(["rightmost","mrel","mclose","mpunct"]),rbe={display:br.DISPLAY,text:br.TEXT,script:br.SCRIPT,scriptscript:br.SCRIPTSCRIPT},ibe={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},pa=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 jw){var l=a.children;s.push(...l)}else s.push(a)}if(Vq(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(rbe[d.style]))}var p=an([i[0]||"leftmost"],[],n),m=an([i[1]||"rightmost"],[],n),x=r==="root";return $L(s,(b,_)=>{var S=_.classes[0],M=b.classes[0];S==="mbin"&&nbe.has(M)?_.classes[0]="mord":M==="mbin"&&tbe.has(S)&&(b.classes[0]="mord")},{node:p},m,x),$L(s,(b,_)=>{var S=aR(_),M=aR(b),C=S&&M?b.hasClass("mtight")?ebe[S][M]:Jye[S][M]:null;if(C)return Gq(C,c)},{node:p},m,x),s},$L=function t(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Xq(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=an(["leftmost"])),r.insertAfter=(p=>m=>{e.splice(p+1,0,m),o++})(o)}i&&e.pop()},Xq=function(e){return e instanceof jw||e instanceof K8||e instanceof zw&&e.hasClass("enclosing")?e:null},sbe=function t(e,n){var r=Xq(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},aR=function(e,n){return e?(n&&(e=sbe(e,n)),ibe[e.classes[0]]||null):null},zS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return an(n.concat(r))},bi=function(e,n,r){if(!e)return an();if(o5[e.type]){var i=o5[e.type](e,n);if(r&&n.size!==r.size){i=an(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new fn("Got group of unknown type: '"+e.type+"'")};function V4(t,e){var n=an(["base"],t,e),r=an(["strut"]);return r.style.height=bn(n.height+n.depth),n.depth&&(r.style.verticalAlign=bn(-n.depth)),n.children.unshift(r),n}function lR(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=pa(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(V4(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(V4(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(V4(o,e));var c;n?(c=V4(pa(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var d=an(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),c){var p=c.children[0];p.style.height=bn(d.height+d.depth),d.depth&&(p.style.verticalAlign=bn(-d.depth))}return d}function Yq(t){return new jw(t)}class pn{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=hm(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Zo&&this.children[r+1]instanceof Zo){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Zo;)i+=this.children[++r].toText();e.appendChild(new Zo(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+=yl(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+yl(hm(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 Zo{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return yl(this.toText())}toText(){return this.text}}class Kq{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",bn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+bn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var obe=new Set(["\\imath","\\jmath"]),abe=new Set(["mrow","mtable"]),fd=function(e,n,r){return ms[n][e]&&ms[n][e].replace&&e.charCodeAt(0)!==55349&&!(Hq.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=ms[n][e].replace),new Zo(e)},J8=function(e){return e.length===1?e[0]:new pn("mrow",e)},e9=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(obe.has(s))return null;ms[i][s]&&ms[i][s].replace&&(s=ms[i][s].replace);var o=oR[r].fontName;return Y8(s,o,i)?oR[r].variant:null};function u6(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Zo&&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 Zo&&n.text===","}else return!1}var Fc=function(e,n,r){if(e.length===1){var i=is(e[0],n);return r&&i instanceof pn&&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 pn&&o instanceof pn){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(u6(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&u6(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||u6(o))){var c=l.children[0];c instanceof pn&&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 Zo&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var p=l.children[0];p instanceof Zo&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),s.pop())}}}s.push(l),o=l}return s},gm=function(e,n,r){return J8(Fc(e,n,r))},is=function(e,n){if(!e)return new pn("mrow");if(a5[e.type]){var r=a5[e.type](e,n);return r}else throw new fn("Got group of unknown type: '"+e.type+"'")};function qL(t,e,n,r,i){var s=Fc(t,n),o;s.length===1&&s[0]instanceof pn&&abe.has(s[0].type)?o=s[0]:o=new pn("mrow",s);var a=new pn("annotation",[new Zo(e)]);a.setAttribute("encoding","application/x-tex");var l=new pn("semantics",[o,a]),c=new pn("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var d=i?"katex":"katex-mathml";return an([d],[c])}var Zq=function(e){return new ap({style:e.displayMode?br.DISPLAY:br.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Qq=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=an(r,[e])}return e},lbe=function(e,n,r){var i=Zq(r),s;if(r.output==="mathml")return qL(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=lR(e,i);s=an(["katex"],[o])}else{var a=qL(e,n,i,r.displayMode,!1),l=lR(e,i);s=an(["katex"],[a,l])}return Qq(s,r)},cbe=function(e,n,r){var i=Zq(r),s=lR(e,i),o=an(["katex"],[s]);return Qq(o,r)},ube={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":"="},MC=function(e){var n=new pn("mo",[new Zo(ube[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},dbe={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]},fbe=new Set(["widehat","widecheck","widetilde","utilde"]),TC=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if(fbe.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 pm(m),S=new wp([_],{width:"100%",height:bn(x),viewBox:"0 0 "+a+" "+p,preserveAspectRatio:"none"});return{span:mm([],[S],n),minWidth:0,height:x}}else{var M=[],C=dbe[l],[A,N,D]=C,R=D/1e3,L=A.length,k,O;if(L===1){var F=C[3];k=["hide-tail"],O=[F]}else if(L===2)k=["halfarrow-left","halfarrow-right"],O=["xMinYMin","xMaxYMin"];else if(L===3)k=["brace-left","brace-center","brace-right"],O=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+L+" children.");for(var B=0;B<L;B++){var Y=new pm(A[B]),V=new wp([Y],{width:"400em",height:bn(R),viewBox:"0 0 "+a+" "+D,preserveAspectRatio:O[B]+" slice"}),q=mm([k[B]],[V],n);if(L===1)return{span:q,minWidth:N,height:R};q.style.height=bn(R),M.push(q)}return{span:an(["stretchy"],M,n),minWidth:N,height:R}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=bn(o),s>0&&(i.style.minWidth=bn(s)),i},hbe=function(e,n,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(o=an(["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 iR({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new iR({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new wp(c,{width:"100%",height:bn(a)});o=mm([],[d],s)}return o.height=a,o.style.height=bn(a),o};function Ur(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 t9(t){var e=CC(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 CC(t){return t&&(t.type==="atom"||qye.hasOwnProperty(t.type))?t:null}var n9=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Ur(t.base,"accent"),n=r.base,t.base=n,i=Wye(bi(t,e)),t.base=r):(r=Ur(t,"accent"),n=r.base);var s=bi(n,e.havingCrampedStyle()),o=r.isShifty&&kp(n),a=0;if(o){var l=Q_(n),c=bi(l,e.havingCrampedStyle());a=UL(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=TC(r,e),m=Ci({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+bn(2*a)+")",marginLeft:bn(2*a)}:void 0}]});else{var x,b;r.label==="\\vec"?(x=$q("vec",e),b=Wq.vec[1]):(x=wC({mode:r.mode,text:r.label},e,"textord"),x=UL(x),x.italic=0,b=x.width,d&&(p+=x.depth)),m=an(["accent-body"],[x]);var _=r.label==="\\textcircled";_&&(m.classes.push("accent-full"),p=s.height);var S=a;_||(S-=b/2),m.style.left=bn(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 M=an(["mord","accent"],[m],e);return i?(i.children[0]=M,i.height=Math.max(M.height,i.height),i.classes[0]="mord",i):M},Jq=(t,e)=>{var n=t.isStretchy?MC(t.label):new pn("mo",[fd(t.label,t.mode)]),r=new pn("mover",[is(t.base,e),n]);return r.setAttribute("accent","true"),r},pbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Rn({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=l5(e[0]),r=!pbe.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:n9,mathmlBuilder:Jq});Rn({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:n9,mathmlBuilder:Jq});Rn({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=TC(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 an(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=MC(t.label),r=new pn("munder",[is(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var G4=t=>{var e=new pn("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Rn({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=vy(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=vy(bi(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=TC(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"),an(["mrel","x-arrow"],[d],e)},mathmlBuilder(t,e){var n=MC(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=G4(is(t.body,e));if(t.below){var s=G4(is(t.below,e));r=new pn("munderover",[n,s,i])}else r=new pn("mover",[n,i])}else if(t.below){var o=G4(is(t.below,e));r=new pn("munder",[n,o])}else r=G4(),r=new pn("mover",[n,r]);return r}});function eX(t,e){var n=pa(t.body,e,!0);return an([t.mclass],n,e)}function tX(t,e){var n,r=Fc(t.body,e);return t.mclass==="minner"?n=new pn("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new pn("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new pn("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}Rn({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:Ro(i),isCharacterBox:kp(i)}},htmlBuilder:eX,mathmlBuilder:tX});var EC=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"};Rn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:EC(e[0]),body:Ro(e[1]),isCharacterBox:kp(e[1])}}});Rn({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=EC(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Ro(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:kp(l)}},htmlBuilder:eX,mathmlBuilder:tX});Rn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:EC(e[0]),body:Ro(e[0])}},htmlBuilder(t,e){var n=pa(t.body,e,!0),r=an([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fc(t.body,e),r=new pn("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var mbe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},XL=()=>({type:"styling",body:[],mode:"math",style:"display"}),YL=t=>t.type==="textord"&&t.text==="@",gbe=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function xbe(t,e,n){var r=mbe[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 vbe(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 fn("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=XL(),l=0;l<o.length;l++)if(!YL(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=t9(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(gbe(o[x],c)){m=!1,l=x;break}if(YL(o[x]))throw new fn("Missing a "+c+" character to complete a CD arrow.",o[x]);d[p].body.push(o[x])}if(m)throw new fn("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new fn('Expected one of "<>AV=|." after @',o[l]);var b=xbe(c,d,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),a=XL()}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([])}}Rn({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=vy(bi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=bn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new pn("mrow",[is(t.label,e)]);return n=new pn("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new pn("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Rn({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=vy(bi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new pn("mrow",[is(t.fragment,e)])}});Rn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Ur(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var a=Ur(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new fn("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new fn("\\@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 nX=(t,e)=>{var n=pa(t.body,e.withColor(t.color),!1);return Pp(n)},rX=(t,e)=>{var n=Fc(t.body,e.withColor(t.color)),r=new pn("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Rn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Ur(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:Ro(i)}},htmlBuilder:nX,mathmlBuilder:rX});Rn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Ur(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:nX,mathmlBuilder:rX});Rn({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&&Ur(i,"size").value}},htmlBuilder(t,e){var n=an(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=bn(to(t.size,e)))),n},mathmlBuilder(t,e){var n=new pn("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",bn(to(t.size,e)))),n}});var cR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},iX=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new fn("Expected a control sequence",t);return e},ybe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},sX=(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)};Rn({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(cR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=cR[r.text]),Ur(e.parseFunction(),"internal");throw new fn("Invalid token after macro prefix",r)}});Rn({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 fn("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 fn('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new fn('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new fn("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===cR[n]),{type:"internal",mode:e.mode}}});Rn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iX(e.gullet.popToken());e.gullet.consumeSpaces();var i=ybe(e);return sX(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Rn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iX(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return sX(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var j_=function(e,n,r){var i=ms.math[e]&&ms.math[e].replace,s=Y8(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},r9=function(e,n,r,i){var s=r.havingBaseStyle(n),o=an(i.concat(s.sizingClasses(r)),[e],r),a=s.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},oX=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=bn(s),e.height-=s,e.depth+=s},bbe=function(e,n,r,i,s,o){var a=Vl(e,"Main-Regular",s,i),l=r9(a,n,i,o);return oX(l,i,n),l},_be=function(e,n,r,i){return Vl(e,"Size"+n+"-Regular",r,i)},aX=function(e,n,r,i,s,o){var a=_be(e,n,s,i),l=r9(an(["delimsizing","size"+n],[a],i),br.TEXT,i,o);return r&&oX(l,i,br.TEXT),l},d6=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=an(["delimsizinginner",i],[an([],[Vl(e,n,r)])]);return{type:"elem",elem:s}},f6=function(e,n,r){var i=nh["Size4-Regular"][e.charCodeAt(0)]?nh["Size4-Regular"][e.charCodeAt(0)][4]:nh["Size1-Regular"][e.charCodeAt(0)][4],s=new pm("inner",Lye(e,Math.round(1e3*n))),o=new wp([s],{width:bn(i),height:bn(n),style:"width:"+bn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=mm([],[o],r);return a.height=n,a.style.height=bn(n),a.style.width=bn(i),{type:"elem",elem:a}},uR=.008,W4={type:"kern",size:-1*uR},Sbe=new Set(["|","\\lvert","\\rvert","\\vert"]),wbe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),lX=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"):Sbe.has(e)?(c="∣",p="vert",m=333):wbe.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=j_(a,x,s),_=b.height+b.depth,S=j_(c,x,s),M=S.height+S.depth,C=j_(d,x,s),A=C.height+C.depth,N=0,D=1;if(l!==null){var R=j_(l,x,s);N=R.height+R.depth,D=2}var L=_+A+N,k=Math.max(0,Math.ceil((n-L)/(D*M))),O=L+k*D*M,F=i.fontMetrics().axisHeight;r&&(F*=i.sizeMultiplier);var B=O/2-F,Y=[];if(p.length>0){var V=O-_-A,q=Math.round(O*1e3),G=jye(p,Math.round(V*1e3)),$=new pm(p,G),Q=(m/1e3).toFixed(3)+"em",K=(q/1e3).toFixed(3)+"em",re=new wp([$],{width:Q,height:K,viewBox:"0 0 "+m+" "+q}),U=mm([],[re],i);U.height=q/1e3,U.style.width=Q,U.style.height=K,Y.push({type:"elem",elem:U})}else{if(Y.push(d6(d,x,s)),Y.push(W4),l===null){var H=O-_-A+2*uR;Y.push(f6(c,H,i))}else{var X=(O-_-A-N)/2+2*uR;Y.push(f6(c,X,i)),Y.push(W4),Y.push(d6(l,x,s)),Y.push(W4),Y.push(f6(c,X,i))}Y.push(W4),Y.push(d6(a,x,s))}var j=i.havingBaseStyle(br.TEXT),le=Ci({positionType:"bottom",positionData:B,children:Y});return r9(an(["delimsizing","mult"],[le],j),br.TEXT,i,o)},h6=80,p6=.08,m6=function(e,n,r,i,s){var o=Oye(e,i,r),a=new pm(e,o),l=new wp([a],{width:"400em",height:bn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return mm(["hide-tail"],[l],s)},Mbe=function(e,n){var r=n.havingBaseSizing(),i=hX("\\surd",e*r.sizeMultiplier,fX,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+h6,e<1?s=1:e<1.4&&(s=.7),l=(1+o+p6)/s,c=(1+o)/s,a=m6("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",p=.833/s):i.type==="large"?(d=(1e3+h6)*J_[i.size],c=(J_[i.size]+o)/s,l=(J_[i.size]+o+p6)/s,a=m6("sqrtSize"+i.size,l,d,o,n),a.style.minWidth="1.02em",p=1/s):(l=e+o+p6,c=e+o,d=Math.floor(1e3*e+o)+h6,a=m6("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",p=1.056),a.height=c,a.style.height=bn(l),{span:a,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},cX=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),Tbe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),uX=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),J_=[0,1.2,1.8,2.4,3],dX=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),cX.has(e)||uX.has(e))return aX(e,n,!1,r,i,s);if(Tbe.has(e))return lX(e,J_[n],!1,r,i,s);throw new fn("Illegal delimiter: '"+e+"'")},Cbe=[{type:"small",style:br.SCRIPTSCRIPT},{type:"small",style:br.SCRIPT},{type:"small",style:br.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Ebe=[{type:"small",style:br.SCRIPTSCRIPT},{type:"small",style:br.SCRIPT},{type:"small",style:br.TEXT},{type:"stack"}],fX=[{type:"small",style:br.SCRIPTSCRIPT},{type:"small",style:br.SCRIPT},{type:"small",style:br.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Abe=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.")},hX=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=j_(e,Abe(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]},dR=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;uX.has(e)?a=Cbe:cX.has(e)?a=fX:a=Ebe;var l=hX(e,n,a,i);return l.type==="small"?bbe(e,l.style,r,i,s,o):l.type==="large"?aX(e,l.size,r,i,s,o):lX(e,n,r,i,s,o)},g6=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 dR(e,p,!0,i,s,o)},KL={"\\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}},Nbe=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 AC(t,e){var n=CC(t);if(n&&Nbe.has(n.text))return n;throw n?new fn("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new fn("Invalid delimiter type '"+t.type+"'",t)}Rn({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=AC(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:KL[t.funcName].size,mclass:KL[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?an([t.mclass]):dX(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(fd(t.delim,t.mode));var n=new pn("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=bn(J_[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function ZL(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Rn({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 fn("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:AC(e[0],t).text,color:n}}});Rn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=AC(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Ur(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{ZL(t);for(var n=pa(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=zS(e,["mopen"]):a=g6(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]=g6(d.delim,r,i,d.options,t.mode,[]))}var p;if(t.right===".")p=zS(e,["mclose"]);else{var m=t.rightColor?e.withColor(t.rightColor):e;p=g6(t.right,r,i,m,t.mode,["mclose"])}return n.push(p),an(["minner"],n,e)},mathmlBuilder:(t,e)=>{ZL(t);var n=Fc(t.body,e);if(t.left!=="."){var r=new pn("mo",[fd(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new pn("mo",[fd(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return J8(n)}});Rn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=AC(e[0],t);if(!t.parser.leftrightDepth)throw new fn("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=zS(e,[]);else{n=dX(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==="|"?fd("|","text"):fd(t.delim,t.mode),r=new pn("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var i9=(t,e)=>{var n=vy(bi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o=0,a=kp(t.body);if(r==="sout")s=an(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=to({number:.6,unit:"pt"},e),c=to({number:.35,unit:"ex"},e),d=e.havingBaseSizing();i=i/d.sizeMultiplier;var p=n.height+n.depth+l+c;n.style.paddingLeft=bn(p/2+l);var m=Math.floor(1e3*p*i),x=Dye(m),b=new wp([new pm("phase",x)],{width:"400em",height:bn(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});s=mm(["hide-tail"],[b],e),s.style.height=bn(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,M=0;/box/.test(r)?(M=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),_=e.fontMetrics().fboxsep+(r==="colorbox"?0:M),S=_):r==="angl"?(M=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),_=4*M,S=Math.max(0,.25-n.depth)):(_=a?.2:0,S=_),s=hbe(n,r,_,S,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=bn(M)):r==="angl"&&M!==.049&&(s.style.borderTopWidth=bn(M),s.style.borderRightWidth=bn(M)),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?an(["mord","cancel-lap"],[C],e):an(["mord"],[C],e)},s9=(t,e)=>{var n=0,r=new pn(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};Rn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Ur(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:i9,mathmlBuilder:s9});Rn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Ur(e[0],"color-token").color,o=Ur(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:i9,mathmlBuilder:s9});Rn({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]}}});Rn({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:i9,mathmlBuilder:s9});Rn({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 pX={};function _h(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)pX[n[l]]=a;s&&(o5[e]=s),o&&(a5[e]=o)}var mX={};function ze(t,e){mX[t]=e}function QL(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 NC=t=>{var e=t.parser.settings;if(!e.displayMode)throw new fn("{"+t.envName+"} can be used only in display mode.")},kbe=new Set(["gather","gather*"]);function o9(t){if(!t.includes("ed"))return!t.includes("*")}function Dm(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 fn("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var b=[],_=[b],S=[],M=[],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 fu("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),M.push(QL(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 R=t.fetch().text;if(R==="&"){if(p&&b.length===p){if(c||a)throw new fn("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(R==="\\end"){N(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(_.length>1||!d)&&_.pop(),M.length<_.length+1&&M.push([]);break}else if(R==="\\\\"){t.consume();var L=void 0;t.gullet.future().text!==" "&&(L=t.parseSizeGroup(!0)),S.push(L?L.value:null),N(),M.push(QL(t)),b=[],_.push(b),A()}else throw new fn("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:M,colSeparationType:a,tags:C,leqno:m}}function a9(t){return t.slice(0,1)==="d"?"display":"text"}var Sh=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(br.SCRIPT).sizeMultiplier;m=.2778*(x/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?to({number:3,unit:"ex"},n):12*p,_=3*p,S=e.arraystretch*b,M=.7*S,C=.3*S,A=0;function N(Be){for(var Ge=0;Ge<Be.length;++Ge)Ge>0&&(A+=.25),c.push({pos:A,isDashed:Be[Ge]})}for(N(o[0]),r=0;r<e.body.length;++r){var D=e.body[r],R=M,L=C;a<D.length&&(a=D.length);var k=new Array(D.length);for(i=0;i<D.length;++i){var O=bi(D[i],n);L<O.depth&&(L=O.depth),R<O.height&&(R=O.height),k[i]=O}var F=e.rowGaps[r],B=0;F&&(B=to(F,n),B>0&&(B+=C,L<B&&(L=B),B=0)),e.addJot&&(L+=_),k.height=R,k.depth=L,A+=R,k.pos=A,A+=L+B,l[r]=k,N(o[r+1])}var Y=A/2+n.fontMetrics().axisHeight,V=e.cols||[],q=[],G,$,Q=[];if(e.tags&&e.tags.some(Be=>Be))for(r=0;r<s;++r){var K=l[r],re=K.pos-Y,U=e.tags[r],H=void 0;U===!0?H=an(["eqn-num"],[],n):U===!1?H=an([],[],n):H=an([],pa(U,n,!0),n),H.depth=K.depth,H.height=K.height,Q.push({type:"elem",elem:H,shift:re})}for(i=0,$=0;i<a||$<V.length;++i,++$){for(var X=V[$]||{},j=!0;X.type==="separator";){if(j||(G=an(["arraycolsep"],[]),G.style.width=bn(n.fontMetrics().doubleRuleSep),q.push(G)),X.separator==="|"||X.separator===":"){var le=X.separator==="|"?"solid":"dashed",se=an(["vertical-separator"],[],n);se.style.height=bn(A),se.style.borderRightWidth=bn(d),se.style.borderRightStyle=le,se.style.margin="0 "+bn(-d/2);var J=A-Y;J&&(se.style.verticalAlign=bn(-J)),q.push(se)}else throw new fn("Invalid separator type: "+X.separator);$++,X=V[$]||{},j=!1}if(!(i>=a)){var ee=void 0;if(i>0||e.hskipBeforeAndAfter){var ie;ee=(ie=X.pregap)!=null?ie:m,ee!==0&&(G=an(["arraycolsep"],[]),G.style.width=bn(ee),q.push(G))}var oe=[];for(r=0;r<s;++r){var de=l[r],ye=de[i];if(ye){var ge=de.pos-Y;ye.depth=de.depth,ye.height=de.height,oe.push({type:"elem",elem:ye,shift:ge})}}if(oe=Ci({positionType:"individualShift",children:oe}),oe=an(["col-align-"+(X.align||"c")],[oe]),q.push(oe),i<a-1||e.hskipBeforeAndAfter){var Me;ee=(Me=X.postgap)!=null?Me:m,ee!==0&&(G=an(["arraycolsep"],[]),G.style.width=bn(ee),q.push(G))}}}if(l=an(["mtable"],q),c.length>0){for(var fe=xy("hline",n,d),Se=xy("hdashline",n,d),me=[{type:"elem",elem:l,shift:0}];c.length>0;){var Pe=c.pop(),ce=Pe.pos-Y;Pe.isDashed?me.push({type:"elem",elem:Se,shift:ce}):me.push({type:"elem",elem:fe,shift:ce})}l=Ci({positionType:"individualShift",children:me})}if(Q.length===0)return an(["mord"],[l],n);var He=Ci({positionType:"individualShift",children:Q});return He=an(["tag"],[He],n),Pp([l,He])},Rbe={c:"center ",l:"left ",r:"right "},wh=function(e,n){for(var r=[],i=new pn("mtd",[],["mtr-glue"]),s=new pn("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 pn("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 pn("mtr",l))}var d=new pn("mtable",r),p=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);d.setAttribute("rowspacing",bn(p));var m="",x="";if(e.cols&&e.cols.length>0){var b=e.cols,_="",S=!1,M=0,C=b.length;b[0].type==="separator"&&(m+="top ",M=1),b[b.length-1].type==="separator"&&(m+="bottom ",C-=1);for(var A=M;A<C;A++)b[A].type==="align"?(x+=Rbe[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="",R=1;R<N.length;R++)D+=R%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 L="",k=e.hLinesBeforeRow;m+=k[0].length>0?"left ":"",m+=k[k.length-1].length>0?"right ":"";for(var O=1;O<k.length-1;O++)L+=k[O].length===0?"none ":k[O][0]?"dashed ":"solid ";return/[sd]/.test(L)&&d.setAttribute("rowlines",L.trim()),m!==""&&(d=new pn("menclose",[d]),d.setAttribute("notation",m.trim())),e.arraystretch&&e.arraystretch<1&&(d=new pn("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},gX=function(e,n){e.envName.includes("ed")||NC(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=Dm(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:o9(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=Ur(n[0].body[p],"textord");d+=m.text}a=Number(d),l=a*2}var x=!l;o.body.forEach(function(M){for(var C=1;C<M.length;C+=2){var A=Ur(M[C],"styling"),N=Ur(A.body[0],"ordgroup");N.body.unshift(c)}if(x)l<M.length&&(l=M.length);else{var D=M.length/2;if(a<D)throw new fn("Too many math in a row: "+("expected "+a+", but got "+D),M[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};_h({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=CC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=t9(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 fn("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Dm(t.parser,s,a9(t.envName))},htmlBuilder:Sh,mathmlBuilder:wh});_h({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 fn("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=Dm(t.parser,r,a9(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:Sh,mathmlBuilder:wh});_h({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Dm(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=CC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=t9(o),l=a.text;if("lc".includes(l))return{type:"align",align:l};throw new fn("Unknown column alignment: "+l,o)});if(i.length>1)throw new fn("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Dm(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new fn("{subarray} can contain only one column");return s},htmlBuilder:Sh,mathmlBuilder:wh});_h({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=Dm(t.parser,e,a9(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:gX,htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){kbe.has(t.envName)&&NC(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:o9(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Dm(t.parser,e,"display")},htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:gX,htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){NC(t);var e={autoTag:o9(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Dm(t.parser,e,"display")},htmlBuilder:Sh,mathmlBuilder:wh});_h({type:"array",names:["CD"],props:{numArgs:0},handler(t){return NC(t),vbe(t.parser)},htmlBuilder:Sh,mathmlBuilder:wh});ze("\\nonumber","\\gdef\\@eqnsw{0}");ze("\\notag","\\nonumber");Rn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new fn(t.funcName+" valid only within array environment")}});var JL=pX;Rn({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 fn("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Ur(i.body[o],"textord").text;if(r==="\\begin"){if(!JL.hasOwnProperty(s))throw new fn("No such environment: "+s,i);var a=JL[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=Ur(n.parseFunction(),"environment");if(x.name!==s)throw new fn("Mismatch: \\begin{"+s+"} matched by \\end{"+x.name+"}",m);return p}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var xX=(t,e)=>{var n=t.font,r=e.withFont(n);return bi(t.body,r)},vX=(t,e)=>{var n=t.font,r=e.withFont(n);return is(t.body,r)},ej={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Rn({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=l5(e[0]),s=r;return s in ej&&(s=ej[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:xX,mathmlBuilder:vX});Rn({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:EC(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:kp(r)}}});Rn({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:xX,mathmlBuilder:vX});var Pbe=(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=to(t.barSize,e),d=xy("frac-line",e,p)):d=xy("frac-line",e),p=d.height,m=d.height):(d=null,p=0,m=e.fontMetrics().defaultRuleThickness);var x,b,_;n.size===br.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 M=x-o.depth-(c.height-_);M<b&&(x+=.5*(b-M),_+=.5*(b-M)),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===br.DISPLAY.size?N=e.fontMetrics().delim1:n.size===br.SCRIPTSCRIPT.size?N=e.havingStyle(br.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var D,R;return t.leftDelim==null?D=zS(e,["mopen"]):D=dR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?R=an([]):t.rightDelim==null?R=zS(e,["mclose"]):R=dR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),an(["mord"].concat(s.sizingClasses(e)),[D,an(["mfrac"],[S]),R],e)},Dbe=(t,e)=>{var n=new pn("mfrac",[is(t.numer,e),is(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=to(t.barSize,e);n.setAttribute("linethickness",bn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new pn("mo",[new Zo(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new pn("mo",[new Zo(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return J8(i)}return n},yX=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};Rn({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"),yX({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:Pbe,mathmlBuilder:Dbe});Rn({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 tj=["display","text","script","scriptscript"],nj=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Rn({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=l5(e[0]),o=s.type==="atom"&&s.family==="open"?nj(s.text):null,a=l5(e[1]),l=a.type==="atom"&&a.family==="close"?nj(a.text):null,c=Ur(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=Ur(x.body[0],"textord");m=tj[Number(b.text)]}}else x=Ur(x,"textord"),m=tj[Number(x.text)];return yX({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:d,barSize:p,leftDelim:o,rightDelim:l},m)}});Rn({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:Ur(e[0],"size").value,token:i}}});Rn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Ur(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 bX=(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=Ur(t.base,"horizBrace")):i=Ur(t,"horizBrace");var s=bi(i.base,e.havingBaseStyle(br.DISPLAY)),o=TC(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=an(["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 an(["mord",i.isOver?"mover":"munder"],[a],e)},Ibe=(t,e)=>{var n=MC(t.label);return new pn(t.isOver?"mover":"munder",[is(t.base,e),n])};Rn({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:bX,mathmlBuilder:Ibe});Rn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Ur(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Ro(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=pa(t.body,e,!1);return Zye(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=gm(t.body,e);return n instanceof pn||(n=new pn("mrow",[n])),n.setAttribute("href",t.href),n}});Rn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Ur(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:Ro(a)}}});Rn({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:Ro(e[0])}},htmlBuilder(t,e){var n=pa(t.body,e,!1);return Pp(n)},mathmlBuilder(t,e){return new pn("mrow",Fc(t.body,e))}});Rn({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=Ur(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 fn("\\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:Ro(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=pa(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=an(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)=>gm(t.body,e)});Rn({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:Ro(e[0]),mathml:Ro(e[1])}},htmlBuilder:(t,e)=>{var n=pa(t.html,e,!1);return Pp(n)},mathmlBuilder:(t,e)=>gm(t.mathml,e)});var x6=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 fn("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!zq(r))throw new fn("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Rn({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=Ur(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=x6(m);break;case"height":s=x6(m);break;case"totalheight":o=x6(m);break;default:throw new fn("Invalid key: '"+p[0]+"' in \\includegraphics.")}}}var x=Ur(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=to(t.height,e),r=0;t.totalheight.number>0&&(r=to(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=to(t.width,e));var s={height:bn(n+r)};i>0&&(s.width=bn(i)),r>0&&(s.verticalAlign=bn(-r));var o=new Vye(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new pn("mglyph",[]);n.setAttribute("alt",t.alt);var r=to(t.height,e),i=0;if(t.totalheight.number>0&&(i=to(t.totalheight,e)-r,n.setAttribute("valign",bn(-i))),n.setAttribute("height",bn(r+i)),t.width.number>0){var s=to(t.width,e);n.setAttribute("width",bn(s))}return n.setAttribute("src",t.src),n}});Rn({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=Ur(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 Gq(t.dimension,e)},mathmlBuilder(t,e){var n=to(t.dimension,e);return new Kq(n)}});Rn({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=an([],[bi(t.body,e)]),n=an(["inner"],[n],e)):n=an(["inner"],[bi(t.body,e)]);var r=an(["fix"],[]),i=an([t.alignment],[n,r],e),s=an(["strut"]);return s.style.height=bn(i.height+i.depth),i.depth&&(s.style.verticalAlign=bn(-i.depth)),i.children.unshift(s),i=an(["thinbox"],[i],e),an(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new pn("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}});Rn({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}}});Rn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new fn("Mismatched "+t.funcName)}});var rj=(t,e)=>{switch(e.style.size){case br.DISPLAY.size:return t.display;case br.TEXT.size:return t.text;case br.SCRIPT.size:return t.script;case br.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Rn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Ro(e[0]),text:Ro(e[1]),script:Ro(e[2]),scriptscript:Ro(e[3])}},htmlBuilder:(t,e)=>{var n=rj(t,e),r=pa(n,e,!1);return Pp(r)},mathmlBuilder:(t,e)=>{var n=rj(t,e);return gm(n,e)}});var _X=(t,e,n,r,i,s,o)=>{t=an([],[t]);var a=n&&kp(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:bn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:bn(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:bn(-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:bn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var S=[m];if(l&&s!==0&&!a){var M=an(["mspace"],[],r);M.style.marginRight=bn(s),S.unshift(M)}return an(["mop","op-limits"],S,r)},SX=new Set(["\\smallint"]),$y=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ur(t.base,"op"),i=!0):s=Ur(t,"op");var o=e.style,a=!1;o.size===br.DISPLAY.size&&s.symbol&&!SX.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=Vl(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),d.length>0){var p=l.italic,m=$q(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=pa(s.body,e,!0);x.length===1&&x[0]instanceof dd?(l=x[0],l.classes[0]="mop"):l=an(["mop"],x,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(Z8(s.name[_],s.mode,e));l=an(["mop"],b,e)}var S=0,M=0;return(l instanceof dd||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(S=(l.height-l.depth)/2-e.fontMetrics().axisHeight,M=l.italic),i?_X(l,n,r,e,o,M,S):(S&&(l.style.position="relative",l.style.top=bn(S)),l)},Fw=(t,e)=>{var n;if(t.symbol)n=new pn("mo",[fd(t.name,t.mode)]),SX.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new pn("mo",Fc(t.body,e));else{n=new pn("mi",[new Zo(t.name.slice(1))]);var r=new pn("mo",[fd("⁡","text")]);t.parentIsSupSub?n=new pn("mrow",[n,r]):n=Yq([n,r])}return n},Obe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Rn({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=Obe[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:$y,mathmlBuilder:Fw});Rn({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:Ro(r)}},htmlBuilder:$y,mathmlBuilder:Fw});var Lbe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Rn({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:$y,mathmlBuilder:Fw});Rn({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:$y,mathmlBuilder:Fw});Rn({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=Lbe[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:$y,mathmlBuilder:Fw});var wX=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ur(t.base,"operatorname"),i=!0):s=Ur(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=pa(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof dd&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=an(["mop"],l,e)}else o=an(["mop"],[],e);return i?_X(o,n,r,e,e.style,0,0):o},jbe=(t,e)=>{for(var n=Fc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof Kq))if(s instanceof pn)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 Zo?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 Zo(a)]}var l=new pn("mi",n);l.setAttribute("mathvariant","normal");var c=new pn("mo",[fd("⁡","text")]);return t.parentIsSupSub?new pn("mrow",[l,c]):Yq([l,c])};Rn({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:Ro(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:wX,mathmlBuilder:jbe});ze("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");zx({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Pp(pa(t.body,e,!1)):an(["mord"],pa(t.body,e,!0),e)},mathmlBuilder(t,e){return gm(t.body,e,!0)}});Rn({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=xy("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 an(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new pn("mo",[new Zo("‾")]);n.setAttribute("stretchy","true");var r=new pn("mover",[is(t.body,e),n]);return r.setAttribute("accent","true"),r}});Rn({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:Ro(r)}},htmlBuilder:(t,e)=>{var n=pa(t.body,e.withPhantom(),!1);return Pp(n)},mathmlBuilder:(t,e)=>{var n=Fc(t.body,e);return new pn("mphantom",n)}});Rn({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=an([],[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}]}),an(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Fc(Ro(t.body),e),r=new pn("mphantom",n),i=new pn("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});Rn({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=an(["inner"],[bi(t.body,e.withPhantom())]),r=an(["fix"],[]);return an(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fc(Ro(t.body),e),r=new pn("mphantom",n),i=new pn("mpadded",[r]);return i.setAttribute("width","0px"),i}});Rn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Ur(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=to(t.dy,e);return Ci({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new pn("mpadded",[is(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Rn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Rn({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=Ur(e[0],"size"),o=Ur(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Ur(i,"size").value,width:s.value,height:o.value}},htmlBuilder(t,e){var n=an(["mord","rule"],[],e),r=to(t.width,e),i=to(t.height,e),s=t.shift?to(t.shift,e):0;return n.style.borderRightWidth=bn(r),n.style.borderTopWidth=bn(i),n.style.bottom=bn(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=to(t.width,e),r=to(t.height,e),i=t.shift?to(t.shift,e):0,s=e.color&&e.getColor()||"black",o=new pn("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",bn(n)),o.setAttribute("height",bn(r));var a=new pn("mpadded",[o]);return i>=0?a.setAttribute("height",bn(i)):(a.setAttribute("height",bn(i)),a.setAttribute("depth",bn(-i))),a.setAttribute("voffset",bn(i)),a}});function MX(t,e,n){for(var r=pa(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 Pp(r)}var ij=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],zbe=(t,e)=>{var n=e.havingSize(t.size);return MX(t.body,n,e)};Rn({type:"sizing",names:ij,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:ij.indexOf(r)+1,body:s}},htmlBuilder:zbe,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fc(t.body,n),i=new pn("mstyle",r);return i.setAttribute("mathsize",bn(n.sizeMultiplier)),i}});Rn({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]&&Ur(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=an([],[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 an(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new pn("mpadded",[is(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Rn({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=vy(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<br.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:d}=Mbe(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=bn(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(br.SCRIPTSCRIPT),_=bi(t.index,b,e),S=.6*(x.height-x.depth),M=Ci({positionType:"shift",positionData:-S,children:[{type:"elem",elem:_}]}),C=an(["root"],[M]);return an(["mord","sqrt"],[C,x],e)}else return an(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new pn("mroot",[is(n,e),is(r,e)]):new pn("msqrt",[is(n,e)])}});var sj={display:br.DISPLAY,text:br.TEXT,script:br.SCRIPT,scriptscript:br.SCRIPTSCRIPT};Rn({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=sj[t.style],r=e.havingStyle(n).withFont("");return MX(t.body,r,e)},mathmlBuilder(t,e){var n=sj[t.style],r=e.havingStyle(n),i=Fc(t.body,r),s=new pn("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 Fbe=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===br.DISPLAY.size||r.alwaysHandleSupSub);return i?$y:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===br.DISPLAY.size||r.limits);return s?wX:null}else{if(r.type==="accent")return kp(r.base)?n9:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?bX:null}else return null}else return null};zx({type:"supsub",htmlBuilder(t,e){var n=Fbe(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&&kp(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===br.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var S=e.sizeMultiplier,M=bn(.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 dd||A)&&(C=bn(-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,R=4*D;if(d-a.depth-(l.height-p)<R){p=R-(d-a.depth)+l.height;var L=.8*c.xHeight-(d-a.depth);L>0&&(d+=L,p-=L)}var k=[{type:"elem",elem:l,shift:p,marginRight:M,marginLeft:C},{type:"elem",elem:a,shift:-d,marginRight:M}];N=Ci({positionType:"individualShift",children:k})}else if(l){p=Math.max(p,c.sub1,l.height-.8*c.xHeight);var O=[{type:"elem",elem:l,marginLeft:C,marginRight:M}];N=Ci({positionType:"shift",positionData:p,children:O})}else if(a)d=Math.max(d,_,a.depth+.25*c.xHeight),N=Ci({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:M}]});else throw new Error("supsub must have either sup or sub.");var F=aR(o,"right")||"mord";return an([F],[o,an(["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===br.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===br.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===br.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===br.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===br.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===br.DISPLAY)?o="mover":o="msup"}return new pn(o,s)}});zx({type:"atom",htmlBuilder(t,e){return Z8(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new pn("mo",[fd(t.text,t.mode)]);if(t.family==="bin"){var r=e9(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 TX={mi:"italic",mn:"normal",mtext:"normal"};zx({type:"mathord",htmlBuilder(t,e){return wC(t,e,"mathord")},mathmlBuilder(t,e){var n=new pn("mi",[fd(t.text,t.mode,e)]),r=e9(t,e)||"italic";return r!==TX[n.type]&&n.setAttribute("mathvariant",r),n}});zx({type:"textord",htmlBuilder(t,e){return wC(t,e,"textord")},mathmlBuilder(t,e){var n=fd(t.text,t.mode,e),r=e9(t,e)||"normal",i;return t.mode==="text"?i=new pn("mtext",[n]):/[0-9]/.test(t.text)?i=new pn("mn",[n]):t.text==="\\prime"?i=new pn("mo",[n]):i=new pn("mi",[n]),r!==TX[i.type]&&i.setAttribute("mathvariant",r),i}});var v6={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},y6={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};zx({type:"spacing",htmlBuilder(t,e){if(y6.hasOwnProperty(t.text)){var n=y6[t.text].className||"";if(t.mode==="text"){var r=wC(t,e,"textord");return r.classes.push(n),r}else return an(["mspace",n],[Z8(t.text,t.mode,e)],e)}else{if(v6.hasOwnProperty(t.text))return an(["mspace",v6[t.text]],[],e);throw new fn('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(y6.hasOwnProperty(t.text))n=new pn("mtext",[new Zo(" ")]);else{if(v6.hasOwnProperty(t.text))return new pn("mspace");throw new fn('Unknown type of space "'+t.text+'"')}return n}});var oj=()=>{var t=new pn("mtd",[]);return t.setAttribute("width","50%"),t};zx({type:"tag",mathmlBuilder(t,e){var n=new pn("mtable",[new pn("mtr",[oj(),new pn("mtd",[gm(t.body,e)]),oj(),new pn("mtd",[gm(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var aj={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},lj={"\\textbf":"textbf","\\textmd":"textmd"},Ube={"\\textit":"textit","\\textup":"textup"},cj=(t,e)=>{var n=t.font;if(n){if(aj[n])return e.withTextFontFamily(aj[n]);if(lj[n])return e.withTextFontWeight(lj[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Ube[n])};Rn({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:Ro(i),font:r}},htmlBuilder(t,e){var n=cj(t,e),r=pa(t.body,n,!0);return an(["mord","text"],r,n)},mathmlBuilder(t,e){var n=cj(t,e);return gm(t.body,n)}});Rn({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=xy("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 an(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new pn("mo",[new Zo("‾")]);n.setAttribute("stretchy","true");var r=new pn("munder",[is(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Rn({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 pn("mpadded",[is(t.body,e)],["vcenter"])}});Rn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new fn("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=uj(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(Vl(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return an(["mord","text"].concat(i.sizingClasses(e)),Vq(r),i)},mathmlBuilder(t,e){var n=new Zo(uj(t)),r=new pn("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var uj=t=>t.body.replace(/ /g,t.star?"␣":" "),K0=qq,CX=`[ \r
	]`,Bbe="\\\\[a-zA-Z@]+",Hbe="\\\\[^\uD800-\uDFFF]",Vbe="("+Bbe+")"+CX+"*",Gbe=`\\\\(
|[ \r	]+
?)[ \r	]*`,fR="[̀-ͯ]",Wbe=new RegExp(fR+"+$"),$be="("+CX+"+)|"+(Gbe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(fR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(fR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Vbe)+("|"+Hbe+")");class dj{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($be,"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 fu("EOF",new kc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new fn("Unexpected character: '"+e[n]+"'",new fu(e[n],new kc(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 fu(i,new kc(this,n,this.tokenRegex.lastIndex))}}class qbe{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 fn("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 Xbe=mX;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 fj={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 fn("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=fj[e.text],r==null||r>=n)throw new fn("Invalid base-"+n+" digit "+e.text);for(var i;(i=fj[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var l9=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new fn("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new fn("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new fn("\\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 fn("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=>l9(t,!1,!0,!1));ze("\\renewcommand",t=>l9(t,!0,!1,!1));ze("\\providecommand",t=>l9(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),K0[n],ms.math[n],ms.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 hj={",":"\\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"},Ybe=new Set(["bin","rel"]);ze("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in hj?e=hj[n]:(n.slice(0,4)==="\\not"||n in ms.math&&Ybe.has(ms.math[n].group))&&(e="\\dotsb"),e});var c9={")":!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 c9?"\\ldots\\,":"\\ldots"});ze("\\dotsc",function(t){var e=t.future().text;return e in c9&&e!==","?"\\ldots\\,":"\\ldots"});ze("\\cdots",function(t){var e=t.future().text;return e in c9?"\\@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 fn("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 EX=bn(nh["Main-Regular"][84][1]-.7*nh["Main-Regular"][65][1]);ze("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+EX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");ze("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+EX+"}{\\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 AX=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",AX(!1));ze("\\bra@set",AX(!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 NX={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Kbe{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 qbe(Xbe,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new dj(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 fu("EOF",r.loc)),this.pushTokens(i),new fu("",kc.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 fn("Extra }",s)}else if(s.text==="EOF")throw new fn("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 fn("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 fn("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 fn("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 fn("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 fn("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 fn("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 fu(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 dj(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)||K0.hasOwnProperty(e)||ms.math.hasOwnProperty(e)||ms.text.hasOwnProperty(e)||NX.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:K0.hasOwnProperty(e)&&!K0[e].primitive}}var pj=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,$4=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),b6={"́":{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"}},mj={á:"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 kC{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 Kbe(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 fn("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 fu("}")),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(kC.endOfExpression.has(i.text)||n&&i.text===n||e&&K0[i.text]&&K0[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 fn("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 fn("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 fn("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new fn("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new fn("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new fn("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($4[s.text]){var c=pj.test(s.text),d=[];for(d.push(new fu($4[s.text])),this.consume();;){var p=this.fetch().text;if(!$4[p]||pj.test(p)!==c)break;d.unshift(new fu($4[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=K0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new fn("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new fn("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new fn("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=K0[e];if(a&&a.handler)return a.handler(o,n,r);throw new fn("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 fn("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 fn("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new fn("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new fn("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 fn("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 fn("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 fn("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!zq(s))throw new fn("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:kc.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!NX.hasOwnProperty(i)){if(this.settings.throwOnError)throw new fn("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:kc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:kc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:kc.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 fn(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}mj.hasOwnProperty(n[0])&&!ms[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=mj[n[0]]+n.slice(1));var s=Wbe.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(ms[this.mode][n]){this.settings.strict&&this.mode==="math"&&sR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var a=ms[this.mode][n].group,l=kc.range(e),c;if($ye.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&&(jq(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:kc.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(!b6[m])throw new fn("Unknown accent ' "+m+"'",e);var x=b6[m][this.mode]||b6[m].text;if(!x)throw new fn("Accent "+m+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:kc.range(e),label:x,isStretchy:!1,isShifty:!0,base:o}}return o}}kC.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var u9=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new kC(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 fn("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new fu("\\df@tag")])}]}return i},kX=function(e,n,r){n.textContent="";var i=d9(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."),kX=function(){throw new fn("KaTeX doesn't work in quirks mode.")});var Zbe=function(e,n){var r=d9(e,n).toMarkup();return r},Qbe=function(e,n){var r=new q8(n);return u9(e,r)},RX=function(e,n,r){if(r.throwOnError||!(e instanceof fn))throw e;var i=an(["katex-error"],[new dd(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},d9=function(e,n){var r=new q8(n);try{var i=u9(e,r);return lbe(i,e,r)}catch(s){return RX(s,e,r)}},Jbe=function(e,n){var r=new q8(n);try{var i=u9(e,r);return cbe(i,e,r)}catch(s){return RX(s,e,r)}},e_e="0.16.33",t_e={Span:zw,Anchor:K8,SymbolNode:dd,SvgNode:wp,PathNode:pm,LineNode:iR},hR={version:e_e,render:kX,renderToString:Zbe,ParseError:fn,SETTINGS_SCHEMA:c2,__parse:Qbe,__renderToDomTree:d9,__renderToHTMLTree:Jbe,__setFontMetrics:zye,__defineSymbol:te,__defineFunction:Rn,__defineMacro:ze,__domTree:t_e};const n_e={};function r_e(t){const e=this,n=t||n_e,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(pye(n)),s.push(oye()),o.push(aye(n))}const gj=/[#.]/g;function i_e(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){gj.lastIndex=i;const a=gj.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 PX(t,e,n){const r=n?l_e(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=i_e(s,e);const c=l.tagName.toLowerCase(),d=r?r.get(c):void 0;if(l.tagName=d||c,s_e(o))a.unshift(o);else for(const[p,m]of Object.entries(o))o_e(t,l.properties,p,m)}for(const c of a)pR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function s_e(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 o_e(t,e,n,r){const i=oq(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=eL(r):i.commaSeparated?s=YO(r):i.commaOrSpaceSeparated?s=eL(YO(r).join(" ")):s=xj(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?a_e(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(xj(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function pR(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)pR(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?pR(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function xj(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||OS(n)===OS(e)))return!0}return n}function a_e(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function l_e(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const c_e=["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"],u_e=PX(aq,"div"),d_e=PX(xC,"g",c_e),_6={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function f_e(t,e){return DX(t,{})||{type:"root",children:[]}}function DX(t,e){const n=h_e(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function h_e(t,e){switch(t.nodeType){case 1:return x_e(t,e);case 3:return m_e(t);case 8:return g_e(t);case 9:return vj(t,e);case 10:return p_e();case 11:return vj(t,e);default:return}}function vj(t,e){return{type:"root",children:IX(t,e)}}function p_e(){return{type:"doctype"}}function m_e(t){return{type:"text",value:t.nodeValue||""}}function g_e(t){return{type:"comment",value:t.nodeValue||""}}function x_e(t,e){const n=t.namespaceURI,r=n===_6.svg?d_e:u_e,i=n===_6.html?t.tagName.toLowerCase():t.tagName,s=n===_6.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,IX(s,e))}function IX(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 v_e(t,e){const n=y_e(t);return f_e(n)}function y_e(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const yj=(function(t,e,n){const r=G8(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]}),Fx=(function(t){if(t==null)return S_e;if(typeof t=="string")return __e(t);if(typeof t=="object")return b_e(t);if(typeof t=="function")return f9(t);throw new Error("Expected function, string, or array as `test`")});function b_e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Fx(t[n]);return f9(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function __e(t){return f9(e);function e(n){return n.tagName===t}}function f9(t){return e;function e(n,r,i){return!!(w_e(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function S_e(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function w_e(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const bj=/\n/g,_j=/[\t ]+/g,mR=Fx("br"),Sj=Fx(R_e),M_e=Fx("p"),wj=Fx("tr"),T_e=Fx(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",k_e,P_e]),OX=Fx(["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 C_e(t,e){const n=e||{},r="children"in t?t.children:[],i=OX(t),s=zX(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...jX(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...LX(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?mR(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 LX(t,e,n){return t.type==="element"?E_e(t,e,n):t.type==="text"?n.whitespace==="normal"?jX(t,n):A_e(t):[]}function E_e(t,e,n){const r=zX(t,n),i=t.children||[];let s=-1,o=[];if(T_e(t))return o;let a,l;for(mR(t)||wj(t)&&yj(e,t,wj)?l=`
`:M_e(t)?(a=2,l=2):OX(t)&&(a=1,l=1);++s<i.length;)o=o.concat(LX(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?mR(i[s+1]):l}));return Sj(t)&&yj(e,t,Sj)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function jX(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){bj.lastIndex=s;const l=bj.exec(n),c=l&&"index"in l?l.index:n.length;r.push(N_e(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 A_e(t){return[String(t.value)]}function N_e(t,e,n){const r=[];let i=0,s;for(;i<t.length;){_j.lastIndex=i;const o=_j.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 zX(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 k_e(t){return!!(t.properties||{}).hidden}function R_e(t){return t.tagName==="td"||t.tagName==="th"}function P_e(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const D_e={},I_e=[];function O_e(t){const e=t||D_e;return function(n,r){Iq(n,"element",function(i,s){const o=Array.isArray(i.properties.className)?i.properties.className:I_e,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=C_e(m,{whitespace:"pre"});let b;try{b=hR.renderToString(x,{...e,displayMode:d,throwOnError:!0})}catch(S){const M=S,C=M.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:M,place:i.position,ruleId:C,source:"rehype-katex"});try{b=hR.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=v_e(b).children);const _=p.children.indexOf(m);return p.children.splice(_,1,...b),Dq})}}function h9(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 Uw(t){const e=new Map,n=h9(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 Mp(t){const e=new Map,n=h9(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 Bw(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 Tp(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 I1({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=nW,collapseAllSignal:_=0,expandAllSignal:S=0,defaultSectionsOpen:M=!0,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:D=[],formatThinkBlocks:R=!0}){var ie;const L=w.useMemo(()=>{if(!r)return new Map;const oe=new Map;for(const de of r){const ye=oe.get(de.sample_idx)||[];ye.push(de),oe.set(de.sample_idx,ye)}return oe},[r]),k=w.useMemo(()=>{if(!r)return[];const oe=new Set;for(const de of r)oe.add(de.metric_name);return[...oe].sort()},[r]),O=w.useMemo(()=>{if(!i)return new Map;const oe=new Map;for(const de of i){const ye=oe.get(de.sample_idx)||[];ye.push(de),oe.set(de.sample_idx,ye)}return oe},[i]),F=w.useMemo(()=>{if(!s)return new Map;const oe=new Map;for(const de of s){const ye=oe.get(de.sample_idx)||[];ye.push(de),oe.set(de.sample_idx,ye)}return oe},[s]),B=w.useMemo(()=>{if(!t)return new Map;const oe=new Map;for(const de of t)oe.set(de.group_id,de);return oe},[t]),Y=w.useMemo(()=>{if(!n)return new Map;const oe=new Map;for(const de of n)oe.set(de.sample_idx,de);return oe},[n]),V=w.useMemo(()=>{if(!e)return[];const oe=new Map,de=new Map;for(const Me of e){const fe=oe.get(Me.sample_idx)||[];fe.push(Me),oe.set(Me.sample_idx,fe),de.set(Me.sample_idx,Me.group_id)}const ye=[];for(const[Me,fe]of oe){const Se=[...fe].sort((He,Be)=>He.turn_order-Be.turn_order),me=de.get(Me)??-1,Pe=B.get(me)??null,ce=Y.get(Me);ye.push({sample_idx:Me,group_id:me,prompt:Pe,turns:Se,reward:(ce==null?void 0:ce.reward)??null,advantage:(ce==null?void 0:ce.advantage)??null,total_tokens:(ce==null?void 0:ce.total_tokens)??null,raw_string:(ce==null?void 0:ce.raw_string)??null})}let ge=ye.sort((Me,fe)=>Me.sample_idx-fe.sample_idx);return m!==null&&(ge=ge.filter(Me=>Me.group_id===m)),x!==null&&(ge=ge.filter(Me=>Me.sample_idx===x)),ge},[e,B,Y,m,x]),[q,G]=hn(b),$=V[0],Q=($==null?void 0:$.sample_idx)??null,K=w.useMemo(()=>Q!==null?L.get(Q)??[]:[],[L,Q]),re=w.useMemo(()=>Q!==null?O.get(Q)??[]:[],[O,Q]),U=w.useMemo(()=>Q!==null?F.get(Q)??[]:[],[F,Q]);w.useEffect(()=>{!$||x===null||G({sample:$,rolloutMetrics:K,goldenAnswers:re})},[$,K,re,x,G]);const H=x!==null&&(q==null?void 0:q.sample.sample_idx)===x?q:null,X=$||(H==null?void 0:H.sample),j=$?K:(H==null?void 0:H.rolloutMetrics)||[],le=$?re:(H==null?void 0:H.goldenAnswers)||[],se=$?U:[],J=w.useRef(null);w.useEffect(()=>{if(l==null||J.current===l)return;const oe=document.getElementById(`sample-${l}`);oe&&(oe.scrollIntoView({behavior:"smooth",block:"start"}),J.current=l)},[l,V]);const ee=a!==void 0?a:(ie=e==null?void 0:e[0])==null?void 0:ie.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"})}):!X&&!o?f.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:f.jsx("p",{children:"No rollouts data available"})}):X?f.jsx("div",{className:"space-y-4 min-w-0",children:f.jsx(L_e,{sample:X,rolloutMetrics:j,goldenAnswers:le,infoTurns:se,availableMetricNames:k,showGoTo:c,goToStep:ee,goToBasePath:d,goToStepParam:p,collapseAllSignal:_,expandAllSignal:S,defaultSectionsOpen:M,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:D,formatThinkBlocks:R},X.sample_idx)}):null}function L_e({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 ge,Me;const[M,C]=hn(Rce),A=M.length===0,N=M.length===1&&M[0]==="__none__",D=fe=>A?!0:N?!1:M.includes(fe),R=fe=>{C(Se=>{if(Se.length===0)return i.filter(ce=>ce!==fe);const me=Se.filter(ce=>ce!=="__none__");if(me.length===0)return[fe];if(me.includes(fe)){const ce=me.filter(He=>He!==fe);return ce.length===0?["__none__"]:ce}const Pe=[...me,fe];return i.length>0&&Pe.length>=i.length?[]:Pe})},L=w.useMemo(()=>[...e].sort((fe,Se)=>fe.metric_name.localeCompare(Se.metric_name)),[e]),k=w.useMemo(()=>M.length===0?L:L.filter(fe=>M.includes(fe.metric_name)),[L,M]),O=w.useMemo(()=>n.filter(fe=>fe.value!=null&&fe.value!==""),[n]),F=((ge=t.prompt)==null?void 0:ge.env)??null,B=dT(),Y=()=>{o!=null&&B(`${a}?${l}=${o}&group=${t.group_id}&sample=${t.sample_idx}`)},V=w.useMemo(()=>{if(!r||r.length===0)return new Map;const fe=new Map;for(const Se of r){const me=fe.get(Se.turn_order)||[];me.push(Se),fe.set(Se.turn_order,me)}return fe},[r]),[q,G]=w.useState(!1),[$,Q]=w.useState(!1),[K,re]=w.useState(p),[U,H]=w.useState({}),[X,j]=w.useState(c),[le,se]=w.useState(d),J=t.turns.length;if(c!==X){j(c),G(!1),Q(!1),re(!1);const fe={};for(let Se=0;Se<J;Se++)fe[Se]=!1;H(fe)}if(d!==le){se(d),G(!0),Q(!0),re(!0);const fe={};for(let Se=0;Se<J;Se++)fe[Se]=!0;H(fe)}const ee=fe=>{H(Se=>({...Se,[fe]:!Se[fe]}))},ie=F?m==null?void 0:m.get(F):void 0,oe=[];F&&oe.push({label:"Env",value:F});const de=t.turns.filter(fe=>fe.turn_type==="model").length;if(de>1&&oe.push({label:"Turns",value:String(de)}),t.reward!==null){const fe=T6(t.reward,(ie==null?void 0:ie.min)??null,(ie==null?void 0:ie.max)??null);oe.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:fe})}if(t.advantage!==null){const fe=T6(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);oe.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:fe})}const ye=[];for(const fe of k){const Se=fe.env??F,me=q_e(x,Se,fe.metric_name),Pe=T6(fe.value,(me==null?void 0:me.min)??null,(me==null?void 0:me.max)??null,me==null?void 0:me.invert);ye.push({label:q4(fe.metric_name),value:$_e(fe.value),highlight:Pe?void 0:fe.value===1?"positive":fe.value===0?"negative":void 0,rangeColor:Pe})}return f.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(oe.length>0||ye.length>0||s)&&f.jsxs("div",{className:"mb-2 space-y-0.5",children:[(oe.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(En,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:Y,disabled:o==null,children:"Go to"}),oe.map((fe,Se)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Se>0&&f.jsx("span",{className:"text-foreground/20",children:"·"}),f.jsx("span",{className:"text-muted-foreground",children:fe.label}),f.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:fe.rangeColor?{color:fe.rangeColor}:void 0,children:fe.value})]},fe.label)),i.length>0&&f.jsxs(oo,{children:[f.jsx(ao,{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(kr,{className:"h-3 w-3"})]})}),f.jsxs(lo,{align:"start",className:"w-max max-w-[400px]",children:[f.jsx(ua,{onSelect:fe=>{fe.preventDefault(),C([])},children:"Select All"}),f.jsx(ua,{onSelect:fe=>{fe.preventDefault(),C(["__none__"])},children:"Unselect All"}),f.jsx(Bs,{}),i.map(fe=>f.jsx(Er,{checked:D(fe),onCheckedChange:()=>R(fe),onSelect:Se=>Se.preventDefault(),children:q4(fe)},fe))]})]})]}),ye.length>0&&f.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:ye.map((fe,Se)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[f.jsx("span",{className:"text-muted-foreground",children:fe.label}),f.jsx("span",{className:bt("font-medium tabular-nums",!fe.rangeColor&&fe.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!fe.rangeColor&&fe.highlight==="negative"&&"text-red-500 dark:text-red-400",!fe.rangeColor&&!fe.highlight&&"text-foreground/80"),style:fe.rangeColor?{color:fe.rangeColor}:void 0,children:fe.value}),Se<ye.length-1&&f.jsx("span",{className:"text-foreground/20",children:"·"})]},fe.label))})]}),O.length>0&&f.jsxs(Pi,{open:q,onOpenChange:G,className:"mb-2",children:[f.jsx(Di,{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"}),!q&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:O.map(fe=>`${q4(fe.key)}: ${fe.value}`).join(" · ")}),f.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:f.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")})})]})})}),f.jsx(Ii,{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:O.map((fe,Se)=>f.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[Se>0&&f.jsx("span",{className:"text-foreground/20",children:"·"}),f.jsx("span",{className:"text-muted-foreground",children:q4(fe.key)}),f.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&fe.value?f.jsx(c5,{content:fe.value,renderOptions:_}):fe.value})]},fe.key))})})})]}),((Me=t.prompt)==null?void 0:Me.system_prompt)&&f.jsxs(Pi,{open:$,onOpenChange:Q,className:"mb-2",children:[f.jsx(Di,{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"}),!$&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:S6(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(M6,{text:t.prompt.system_prompt}),f.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!$&&"-rotate-90")})]})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"py-2",children:f.jsx(w6,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&f.jsxs(Pi,{open:K,onOpenChange:re,className:"mb-2",children:[f.jsx(Di,{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:S6(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(M6,{text:t.prompt.prompt}),f.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")})]})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"py-2",children:f.jsx(w6,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((fe,Se)=>{const me=U[Se]??p,Pe=fe.turn_type==="model"?t.turns.slice(0,Se).filter(ce=>ce.turn_type==="model").length:null;return f.jsxs(Pi,{open:me,onOpenChange:()=>ee(Se),className:"mb-2",children:[f.jsx(Di,{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:z_e(fe.turn_type)}),!me&&f.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:S6(fe.content,60,fe.turn_type==="model"&&S)}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[fe.tokens!=null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[fe.tokens.toLocaleString()," tokens"]}),Pe!==null&&f.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Pe]}),f.jsx(M6,{text:fe.content}),f.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!me&&"-rotate-90")})]})]})})}),f.jsx(Ii,{children:f.jsxs("div",{className:"py-2",children:[f.jsx(w6,{content:fe.content,renderOptions:_,enableThinkBlocks:fe.turn_type==="model"&&S}),(()=>{const ce=V.get(fe.turn_order);return!ce||ce.length===0?null:f.jsx("div",{className:"mt-2 space-y-1",children:ce.map((He,Be)=>f.jsx(j_e,{info:He,renderOptions:_},`${He.info_key}-${Be}`))})})()]})})]},`${fe.sample_idx}-${fe.turn_order}`)})]})}function j_e({info:t,renderOptions:e=[]}){const[n,r]=w.useState(!1);return f.jsxs(Pi,{open:n,onOpenChange:r,children:[f.jsx(Di,{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(kr,{className:bt("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(Ii,{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(c5,{content:t.info_value,renderOptions:e}):f.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function z_e(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function F_e(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function S6(t,e=60,n=!0){if(!t)return"";const i=(n?F_e(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function U_e(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 B_e(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function Mj({content:t}){const[e,n]=w.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:B_e(t)}),f.jsx("span",{children:"</think>"}),f.jsx(tm,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&f.jsx(kr,{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 H_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 V_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 G_e({code:t,language:e}){const[n,r]=w.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(Nm,{className:"h-3 w-3"}):f.jsx(VT,{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 W_e({content:t}){const e="katex-scroll",n=H_e(t);return f.jsx("div",{className:bt("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=hR.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 Tj({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(r_e),s.push(O_e)),f.jsx("div",{className:bt("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(eye,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?f.jsx(W_e,{content:t}):f.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function c5({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=V_e(t);if(s.some(o=>o.type==="code"))return f.jsx(f.Fragment,{children:s.map((o,a)=>o.type==="code"?f.jsx(G_e,{code:o.value,language:o.language},a):f.jsx(Tj,{content:o.value,renderMarkdown:n,renderLatex:r},a))})}return f.jsx(Tj,{content:t,renderMarkdown:n,renderLatex:r})}function w6({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=w.useMemo(()=>n?U_e(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(c5,{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(c5,{content:s.value,renderOptions:e},o):f.jsx(Mj,{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(Mj,{content:s.value},o))})}function M6({text:t}){const[e,n]=w.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(Nm,{className:"h-3.5 w-3.5 text-foreground/30"}):f.jsx(VT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function q4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function $_e(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function q_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 T6(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 RC({rawString:t,totalTokens:e,turns:n}){const[r,i]=w.useState(!1),[s,o]=w.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(nd,{children:[f.jsx(qT,{asChild:!0,children:f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),f.jsxs(rd,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[f.jsx(iu,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(su,{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(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:a,children:[r?f.jsx(Nm,{className:"size-3"}):f.jsx(VT,{className:"size-3"}),r?"Copied":"Copy"]}),f.jsx(N1,{variant:"outline",size:"sm",pressed:s,onPressedChange:o,className:"text-xs",children:"Line breaks"})]})}),f.jsx(Px,{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 X_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 Y_e(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function K_e(t){const e=w.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=w.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=w.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=w.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=w.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=w.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 Z_e({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var ee,ie,oe,de,ye;const[o,a]=w.useState(!1),{data:l,isLoading:c,error:d}=uW(t,e,n,o,r),{data:p}=gd(t,o&&!!t,!1),m=r?((ee=p==null?void 0:p.summary)==null?void 0:ee.eval_env_details)??((ie=p==null?void 0:p.config)==null?void 0:ie.eval_env_details):(oe=p==null?void 0:p.config)==null?void 0:oe.environments,x=r||(de=p==null?void 0:p.summary)==null?void 0:de.env_details,b=w.useMemo(()=>Uw(m),[m]),_=w.useMemo(()=>{const ge=Mp(m),Me=Mp(x),fe=Bw(p==null?void 0:p.data_metric_ranges);return Tp(Tp(ge,Me),fe)},[m,x,p==null?void 0:p.data_metric_ranges]),S=w.useMemo(()=>{var Se;const ge=(Se=p==null?void 0:p.config)==null?void 0:Se.group_size,Me=typeof ge=="object"&&ge!==null&&"value"in ge?Number(ge.value):Number(ge);if(!Me||isNaN(Me)||Me<=1)return null;const fe=Math.sqrt(Me-1);return{min:-fe,max:fe}},[(ye=p==null?void 0:p.config)==null?void 0:ye.group_size]),M=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:C,mappedRollouts:A,mappedSamplesData:N,mappedRolloutMetrics:D,mappedGoldenAnswers:R,mappedInfoTurns:L}=K_e(M),k=w.useMemo(()=>{var Me;if(!l||l.kind!=="eval")return null;const ge=(Me=l.samples_data)==null?void 0:Me[0];return ge?{groupId:ge.group_id,sampleIdx:ge.sample_idx}:null},[l]),O=(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,F=dT(),B=w.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]),Y=()=>{B&&(a(!1),F(B))},[V,q]=w.useState(0),[G,$]=w.useState(0),[Q,K]=w.useState(!0),[re,U]=hn(UT),[H,X]=hn(BT),j=re.length+(H?1:0),le=ge=>{U(Me=>Me.includes(ge)?Me.filter(fe=>fe!==ge):[...Me,ge])},se=w.useMemo(()=>{if(!l)return null;const ge=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?N:l.kind==="eval"?l.samples_data:null;if(!ge)return null;const Me=l.kind==="eval"?(k==null?void 0:k.sampleIdx)??n:n;return ge.find(fe=>fe.sample_idx===Me)??null},[l,N,n,k]),J=!c&&!d&&l&&l.kind!==null;return f.jsxs(nd,{open:o,onOpenChange:a,children:[f.jsx(qT,{asChild:!0,children:s??f.jsx(En,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),f.jsxs(rd,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[f.jsx(iu,{children:f.jsxs(su,{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}`}),O&&f.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[O,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(M==null?void 0:M.discard_reason)&&f.jsx(uy,{variant:Y_e(M.discard_reason),className:"text-xs",children:X_e(M.discard_reason)}),B&&f.jsx(En,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:Y,children:"Go to"}),J&&f.jsxs(f.Fragment,{children:[(se==null?void 0:se.raw_string)&&f.jsx(RC,{rawString:se.raw_string,totalTokens:se.total_tokens,turns:se.turns??void 0}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{q(ge=>ge+1),K(!1)},children:"Collapse All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{$(ge=>ge+1),K(!0)},children:"Expand All"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsxs(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",j>0&&` (${j})`]})}),f.jsxs(lo,{align:"start",className:"w-auto",children:[f.jsx(Er,{checked:H,onCheckedChange:ge=>X(!!ge),onSelect:ge=>ge.preventDefault(),children:"Format Think"}),f.jsx(Er,{checked:re.includes("markdown"),onCheckedChange:()=>le("markdown"),onSelect:ge=>ge.preventDefault(),children:"Markdown"}),f.jsx(Er,{checked:re.includes("latex"),onCheckedChange:()=>le("latex"),onSelect:ge=>ge.preventDefault(),children:"LaTeX"}),f.jsx(Er,{checked:re.includes("code"),onCheckedChange:()=>le("code"),onSelect:ge=>ge.preventDefault(),children:"Code"})]})]})]})]})}),d&&f.jsx(ld,{className:"border-destructive",children:f.jsx(lh,{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(ld,{children:f.jsxs(lh,{className:"pt-6 space-y-3",children:[f.jsx(op,{className:"h-5 w-40"}),f.jsx(op,{className:"h-32 w-full"}),f.jsx(op,{className:"h-24 w-full"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(op,{className:"h-6 w-20"}),f.jsx(op,{className:"h-6 w-20"}),f.jsx(op,{className:"h-6 w-20"})]})]})}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts"&&f.jsx(I1,{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:V,expandAllSignal:G,defaultSectionsOpen:Q,renderOptions:re,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts_discarded"&&f.jsx(I1,{prompts:C,data:A,samplesData:N,rolloutMetrics:D,goldenAnswers:R,infoTurns:L,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:V,expandAllSignal:G,defaultSectionsOpen:Q,renderOptions:re,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)==="eval"&&f.jsx(I1,{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:(k==null?void 0:k.groupId)??e,filterSampleIdx:(k==null?void 0:k.sampleIdx)??n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:V,expandAllSignal:G,defaultSectionsOpen:Q,renderOptions:re,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)===null&&f.jsx(ld,{children:f.jsx(lh,{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 Q_e=.005;function J_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 fs(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 C6(t){return t.toLocaleString("en-US")}function FX(t,e,n=[]){return[{label:"Duration",value:fs(e)},...t.prompt_tokens!==void 0?[{label:"Prompt tokens",value:C6(t.prompt_tokens)}]:[],...t.rollout_tokens!==void 0?[{label:"Rollout tokens",value:C6(t.rollout_tokens)}]:[],...t.max_tokens!==void 0&&t.max_tokens!==null?[{label:"Max tokens",value:C6(t.max_tokens)}]:[],...n,...t.queue_time!==void 0&&t.queue_time!==null?[{label:"Queue time",value:fs(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:fs(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:fs(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:fs(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:fs(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:fs(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 eSe(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 tSe(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 nSe(t,e,n){return n?tSe(t,e):eSe(t,e)}const rSe=new Set;function UX(t){var n;const e=(n=gC[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function iSe(t,e=Q_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 sSe({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:M=12,groupSize:C=1,freeLaneAfterGeneration:A=!1}){const N=qn(zT),D=w.useMemo(()=>{const $=(m??[]).filter(K=>Number.isFinite(K));return $.length>0?$:o?Object.keys(o).map(Number).filter(K=>Number.isFinite(K)).sort((K,re)=>K-re):[]},[m,o]),R=s-i,L=w.useMemo(()=>!t||t.length===0?[]:t.filter($=>$.timestamp>=i&&$.timestamp<s),[t,i,s]),k=w.useMemo(()=>!e||e.length===0?[]:e.filter($=>$.start_time<s&&$.end_time>i),[e,i,s]),O=w.useMemo(()=>!n||n.length===0?[]:n.filter($=>{const Q=$.end_time+($.environment_response_time??0)+($.compute_reward_time??0);return $.start_time<s&&Q>i}),[n,i,s]),{eventsByRank:F,ranks:B}=w.useMemo(()=>{const $={};k.forEach(K=>{$[K.rank]||($[K.rank]=[]),$[K.rank].push(K)});const Q=Object.keys($).map(Number).sort((K,re)=>K-re);return{eventsByRank:$,ranks:Q}},[k]),{eventsByServer:Y,servers:V}=w.useMemo(()=>{const $={};O.forEach(K=>{$[K.server]||($[K.server]=[]),$[K.server].push(K)});const Q=Object.keys($).map(Number).sort((K,re)=>K-re);return{eventsByServer:$,servers:Q}},[O]),q=S>0?S:Math.max(1,V.length),G=Math.max(1,Math.floor(M/q*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:[(V.length>0||S>0)&&f.jsx(cSe,{servers:V.length>0?V:Array.from({length:S},($,Q)=>Q),eventsByServer:Y,intervalStart:i,intervalDuration:R,lanesPerServer:G,inferenceServerNodeMap:_,totalSetupNodes:b,isLoading:r,freeLaneAfterGeneration:A}),f.jsx(oSe,{events:L,intervalStart:i,intervalDuration:R,isLoading:r}),f.jsx(ASe,{ranks:B,eventsByRank:F,intervalStart:i,intervalDuration:R,intervalEnd:s,trainerGpuMetricsByGpuIndex:o,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:l,trainerAvailableGpuMetrics:c,selectedMetricNames:d,onSelectedMetricNamesChange:p,trainerSystemGpuIndices:D,trainerRankInfoByRank:x,totalSetupNodes:b,isLoading:r})]})})}function oSe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=w.useState(!0),[o,a]=w.useState(null),[l,c]=w.useState(null),d=l??o,{thresholdSeconds:p,displayLabel:m}=w.useMemo(()=>J_e(n),[n]),{sortedEvents:x,windowByOriginalIndex:b}=w.useMemo(()=>iSe(t,p),[t,p]),_=w.useMemo(()=>{const S=[],M=new Map;return t.forEach(C=>{const A=i8(C.event_type),N=M.get(A);N!==void 0?S[N].count++:(M.set(A,S.length),S.push({displayName:A,color:r8(C.event_type),count:1}))}),S},[t]);return f.jsxs(Pi,{open:i,onOpenChange:s,children:[f.jsx(Di,{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(kr,{className:bt("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(gl,{className:"size-3.5 text-muted-foreground"})]})})}),f.jsx(Ii,{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:M,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:M}}),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:pp(0)}),f.jsx("span",{children:pp(n/2)}),f.jsx("span",{children:pp(n)})]}),f.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((S,M)=>f.jsx(aSe,{event:S,intervalStart:e,intervalDuration:n,sortedEvents:x,closeEventWindow:b.get(M),thresholdLabel:m,highlightedDisplayName:d},`${S.timestamp}-${M}`))})]})})]})})]})}function aSe({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=qn(gs),d=r8(t.event_type),m=(i?Math.max(0,i.end-i.start):0)>0,x=i8(t.event_type),b=o===null?null:x===o;return f.jsx(Pc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:b===!1?nSe(d,.8,c):d,zIndex:b===!0?20:1},interactive:m,tooltip:f.jsx(lSe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function lSe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=a=>{const l=i8(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=w.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=r8(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 cSe({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:o,isLoading:a,freeLaneAfterGeneration:l=!1}){var Ke;const[x,b]=w.useState(!0),[_,S]=hn(Mce),[M,C]=hn(zT),[A,N]=hn(Sce),[D,R]=hn(ZG),[L,k]=hn(wce),O=qn(gs),F=O?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",[B,Y]=hn(Tce),[V,q]=hn(Cce),[G,$]=hn(bce),[Q,K]=hn(JG),re=qn(bl),U=8,H=t.length>U,X=w.useMemo(()=>{if(!H)return[];const je=[];for(let Te=0;Te<t.length;Te+=U){const Xe=t.slice(Te,Te+U),ht=Te,ke=Math.min(Te+U,t.length)-1;je.push({label:`${ht} – ${ke}`,servers:Xe})}return je},[t,H]),j=H?Math.min(G,Math.max(0,X.length-1)):0;w.useEffect(()=>{H&&G!==j&&$(j)},[H,G,j,$]);const le=H?((Ke=X[j])==null?void 0:Ke.servers)??t.slice(0,U):t,se=w.useMemo(()=>typeof o=="number"&&Number.isFinite(o)?o>1:s?new Set(Object.values(s).filter(Te=>Te!==null)).size>1:!1,[s,o]),J=w.useMemo(()=>{const je=new Set,Te=[];for(const Xe of Object.values(e))for(const ht of Xe){if(ht.event_type!=="request"||ht.sample_id==null||ht.group_id==null)continue;const ke=`${ht.group_id}:${ht.sample_id}`;je.has(ke)||(je.add(ke),Te.push({group_id:ht.group_id,sample_idx:ht.sample_id}))}return Te},[e]),{data:ee}=s8(re??"",J,!!re&&J.length>0&&M),ie=!M||J.length===0||!!ee,oe=!M||ie,de=w.useMemo(()=>{const je=new Map;return ee==null||ee.statuses.forEach(Te=>{je.set(`${Te.group_id}:${Te.sample_idx}`,Te.kind)}),je},[ee]),ye=w.useMemo(()=>{let je=i;for(const Te of Object.values(e))for(const Xe of Te)Xe.event_type==="request"&&Xe.lane!=null&&Xe.lane+1>je&&(je=Xe.lane+1);return je},[e,i]),ge=Math.max(1,t.length),Me=Math.max(1,Math.floor(V/ge)),fe=ye,Se=Math.max(1,Math.ceil(fe/Me)),me=Math.min(B,Math.max(0,Se-1));w.useEffect(()=>{B!==me&&Y(me)},[B,me,Y]);const Pe=me*Me,ce=Me,He=Math.min(Pe+Me-1,fe-1),Be=w.useMemo(()=>{let je=0;for(const Te of Object.values(e))je+=Te.length;return je},[e]),Ge=w.useMemo(()=>({servers:le,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[le,e,n,r,i]),We=w.useMemo(()=>`${n}:${r}:${le.join(",")}:${Be}:${M}`,[n,r,le,Be,M]),[ae,Z]=w.useState(null),[he,be]=w.useState(null),[we,ve]=w.useState(null);oe&&(ae!==Ge||he!==de||we!==We)&&(Z(Ge),be(de),ve(We));const Re=M&&we!==null&&We!==we,Ae=w.useCallback(je=>{if(je.event_type==="request"&&!(je.sample_id===void 0||je.group_id===void 0)){if((Q==null?void 0:Q.sampleId)===je.sample_id){K(null);return}K({sampleId:je.sample_id,groupId:je.group_id,isEval:je.is_eval})}},[Q,K]),Oe=w.useMemo(()=>{if(!L)return[];const je=[];for(const[Te,Xe]of Object.entries(e)){const ht=Number(Te);for(const ke of Xe){if(ke.event_type!=="request")continue;const et=ke.compute_reward_time;if(et==null||et<=0)continue;const ct=ke.environment_response_time,yt=ke.end_time+(ct!=null&&ct>0?ct:0);je.push({startTime:yt,duration:et,sourceEvent:ke,server:ht})}}return je.sort((Te,Xe)=>Te.startTime-Xe.startTime),je},[L,e]),{packedRewardItems:qe,rewardLaneCount:Fe}=w.useMemo(()=>{if(Oe.length===0)return{packedRewardItems:[],rewardLaneCount:0};const je=[],Te=[];for(const Xe of Oe){let ht=!1;for(let ke=0;ke<je.length;ke++)if(je[ke]<=Xe.startTime){je[ke]=Xe.startTime+Xe.duration,Te.push({...Xe,lane:ke}),ht=!0;break}ht||(Te.push({...Xe,lane:je.length}),je.push(Xe.startTime+Xe.duration))}return{packedRewardItems:Te,rewardLaneCount:je.length}},[Oe]);return f.jsxs(Pi,{open:x,onOpenChange:b,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Di,{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(kr,{className:bt("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(gl,{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(je=>Math.max(2,je-4)),disabled:_<=2,children:f.jsx(Fue,{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(je=>Math.min(42,je+4)),disabled:_>=42,children:f.jsx(hp,{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:()=>Y(je=>Math.max(0,je-1)),disabled:me<=0,children:f.jsx(e8,{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:fe===0?"0":`${Pe}–${He}`}),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:()=>Y(je=>Math.min(Se-1,je+1)),disabled:me>=Se-1,children:f.jsx(kr,{className:"h-3 w-3"})})]}),f.jsxs(oo,{children:[f.jsx(ao,{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(aW,{className:"h-3.5 w-3.5"})})}),f.jsxs(lo,{align:"end",children:[f.jsx(om,{children:"Max Lanes"}),f.jsx(Bs,{}),[64,128,256,512,1024].map(je=>f.jsx(Er,{checked:V===je,onCheckedChange:()=>{q(je),Y(0)},children:je},je))]})]}),H&&f.jsxs(NS,{value:String(j),onValueChange:je=>$(Number(je)),children:[f.jsx(RS,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(kS,{})}),f.jsx(PS,{children:X.map((je,Te)=>f.jsxs(DS,{value:String(Te),children:["Servers ",je.label]},Te))})]}),f.jsx(N1,{variant:"selecting",size:"sm",pressed:M,onPressedChange:C,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),f.jsx(N1,{variant:"selecting",size:"sm",pressed:A,onPressedChange:N,className:"text-xs px-2 h-7",children:"Show Weight Update"}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(N1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:R,className:"text-xs px-2 h-7 rounded-r-none",children:"Show Compute Reward"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsx("button",{className:bt("flex items-center justify-center h-7 w-6 rounded-r-[min(var(--radius-md),12px)] transition-colors",D?"bg-primary text-secondary hover:bg-primary/90":"bg-accent text-muted-foreground hover:text-accent-foreground hover:bg-muted"),children:f.jsx(kr,{className:"h-3 w-3"})})}),f.jsx(lo,{align:"end",children:f.jsx(Er,{checked:L,onCheckedChange:k,children:"Separate"})})]})]})]})]}),f.jsxs(Ii,{children:[f.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const je=ae??(oe?Ge:null),Te=he??(oe?de:null);if(!je||!Te)return null;const Xe=Re?!0:ie;return f.jsx("div",{className:`transition-opacity ${Re?"opacity-60":"opacity-100"}`,children:f.jsx("div",{className:"space-y-3",children:je.servers.map(ht=>f.jsx(MSe,{server:ht,nodeId:(s==null?void 0:s[ht])??null,showNodeLabel:se,events:je.eventsByServer[ht]||[],intervalStart:je.intervalStart,intervalDuration:je.intervalDuration,numLanes:je.lanesPerServer,selectedRequest:Q,sampleStatusByKey:Te,highlightDiscarded:M,discardStatusReady:Xe,onEventClick:Ae,showWeightUpdate:A,showComputeReward:D&&!L,laneHeight:_,laneStart:Pe,maxLanesToShow:ce,freeLaneAfterGeneration:l},ht))})})})():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"})}),L&&qe.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:"Compute Reward"}),f.jsx("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:Fe*_+Math.max(0,Fe-1)*2},children:qe.map((je,Te)=>{const Xe=n+r,ht=je.startTime+je.duration;if(je.startTime>=Xe||ht<=n)return null;const ke=Math.max(je.startTime,n),et=Math.min(ht,Xe),ct=Math.max(0,(ke-n)/r*100),yt=Math.max(.3,(et-ke)/r*100),lt=je.lane*(_+2),Je=gR(je.sourceEvent,"reward",Q,de,M,ie,O);return f.jsx(Pc,{className:"absolute group cursor-pointer",style:{left:`${ct}%`,width:`${Math.min(yt,100-ct)}%`,top:lt,height:_,backgroundColor:Je.color,borderRadius:"1px",border:F,boxSizing:"border-box",opacity:Je.opacity},onClick:()=>Ae(je.sourceEvent),tooltip:f.jsx(au,{title:je.sourceEvent.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:je.sourceEvent.sample_id!==void 0?`Sample ${je.sourceEvent.sample_id}`:void 0,color:Je.color,details:[{label:"Duration",value:fs(je.duration*1e3)},...je.sourceEvent.group_id!==void 0?[{label:"Group",value:String(je.sourceEvent.group_id)}]:[],{label:"Server",value:String(je.server)},{label:"Lane",value:String(je.lane)}]})},`cr-${Te}`)})})]}),f.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[f.jsx("span",{children:pp(0)}),f.jsx("span",{children:pp(r/2)}),f.jsx("span",{children:pp(r)})]})]})]})}const uSe="#075985",dSe="#047857",BX="#0284c7",HX="#10b981",VX="#a1a1a1",GX="#555555",WX="#b0b0b0",$X="#4a4a4a",fSe="#0c4a6e",hSe="#065f46",qX="#8a8a8a",XX="#606060",pSe="#0ea5e9",mSe="#ababab",gSe="#555555",xSe="#0ea5e9",vSe="#ababab",ySe="#555555",bSe="#34d399",_Se="#ababab",SSe="#555555",YX="#0369a1",KX="#0369a1",ZX="#047857",QX="#0284c7",JX="#0284c7",eY="#10b981",tY="#b3b3b3",nY="#505050",rY="#b3b3b3",iY="#505050",sY="#b3b3b3",oY="#505050";function wSe({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((B,Y)=>B-Y),p=qn(zT),m=qn(gs),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=w.useMemo(()=>d.map(B=>({group_id:r,sample_idx:B})),[r,d.join(",")]),{data:M}=s8(i,S,!!i&&S.length>0&&p),C=!p||S.length===0||!!M,A=w.useMemo(()=>!p||!(M!=null&&M.statuses)?!1:M.statuses.some(B=>B.kind==="rollouts_discarded"),[p,M]),N=w.useMemo(()=>{for(const B of Object.values(t))if(B.some(Y=>Y.is_eval))return!0;return!1},[t]),D=w.useMemo(()=>{for(const B of Object.values(t))if(B.some(Y=>Y.is_canceled))return!0;return!1},[t]),R=D?m?$X:WX:A?m?GX:VX:N?HX:BX,L=16,k=3,O=d.length*L+(d.length-1)*k,F=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:F,gap:k},children:d.map(B=>{const Y=B===e;return f.jsx(Z_e,{runPath:i,groupId:r,sampleId:B,isEval:c,isCanceled:D,children:f.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${Y?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:L,width:34},children:B})},B)})}),f.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:O},children:d.map((B,Y)=>{const V=t[B],q=B===e,G=Y*(L+k),$=q?D?m?XX:qX:A?m?"#9ca3af":"#6b7280":N?hSe:fSe:R,Q=[...V].sort((X,j)=>X.start_time-j.start_time),K=(s==null?void 0:s[B])??[],re=(o==null?void 0:o[B])??0,U=[];for(let X=0;X<Q.length&&X<K.length;X++){const j=K[X].time;j>0&&U.push({start:Q[X].end_time,duration:j,idx:X})}let H=0;if(re>0&&Q.length>0&&(H=Q[Q.length-1].end_time,K.length>=Q.length)){const j=K[Q.length-1];j&&j.time>0&&(H+=j.time)}return f.jsxs("div",{className:"absolute left-0 right-0",style:{top:G,height:L},children:[V.map((X,j)=>{const se=(X.start_time-n.start)/n.duration*100,J=X.end_time-X.start_time,ee=J*1e3,ie=Math.max(.5,J/n.duration*100);return f.jsx(Pc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${se}%`,width:`${Math.min(ie,100-se)}%`,backgroundColor:$,borderRadius:"1px",border:D?b:x,boxSizing:"border-box"},onClick:a?()=>a(B):void 0,tooltip:f.jsx(au,{title:X.sample_id!==void 0?`Sample ${X.sample_id}`:X.group_id!==void 0?`Group ${X.group_id}`:"Request",titleSecondary:X.group_id!==void 0?`Group ${X.group_id}`:null,color:$,statusLabel:D?{text:"Canceled",className:"text-muted-foreground"}:A?{text:"Discarded",className:"text-red-700"}:null,details:FX(X,ee,[{label:"Server",value:String(X.server)},...l&&X.node_id!==null&&X.node_id!==void 0?[{label:"Node",value:String(X.node_id)}]:[]]),startTime:X.start_time,endTime:X.end_time})},`req-${j}`)}),U.map(X=>{const le=(X.start-n.start)/n.duration*100,se=Math.max(.3,X.duration/n.duration*100),J=X.duration*1e3,ee=q?A?m?"#9ca3af":"#6b7280":YX:A?m?nY:tY:QX;return f.jsx(Pc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${le}%`,width:`${Math.min(se,100-le)}%`,backgroundColor:ee,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(B):void 0,tooltip:f.jsx(au,{title:"Env Response",titleSecondary:`Turn ${X.idx}`,color:ee,details:[{label:"Duration",value:fs(J)}]})},`env-${X.idx}`)}),re>0&&Q.length>0&&(()=>{const j=(H-n.start)/n.duration*100,le=Math.max(.3,re/n.duration*100),se=re*1e3,J=q?A?m?"#9ca3af":"#6b7280":c?ZX:KX:A?c?m?oY:sY:m?iY:rY:c?eY:JX;return f.jsx(Pc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${j}%`,width:`${Math.min(le,100-j)}%`,backgroundColor:J,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(B):void 0,tooltip:f.jsx(au,{title:c?"Compute Metrics":"Compute Reward",color:J,details:[{label:"Duration",value:fs(se)}]})})})()]},B)})})]}),f.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:F},children:[f.jsx("span",{children:fs(0)}),f.jsx("span",{children:fs(n.duration/2*1e3)}),f.jsx("span",{children:fs(n.duration*1e3)})]})]}):f.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:O+24},children:f.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function MSe({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:M=!1}){const C=qn(gs),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,R=w.useMemo(()=>r.filter(K=>K.event_type==="weight_broadcast"),[r]),L=w.useMemo(()=>r.filter(K=>K.event_type==="request"),[r]),{assignedEvents:k,actualNumLanes:O}=w.useMemo(()=>{const K=[],re=[];for(const H of L)H.lane!=null&&H.lane>=0?K.push({...H,lane:H.lane}):re.push(H);if(re.length>0){const H=[...re].sort((j,le)=>j.start_time-le.start_time),X=[];for(const j of H){const le=M?j.end_time+(j.environment_response_time??0):j.end_time+(j.environment_response_time??0)+(j.compute_reward_time??0);let se=!1;for(let J=0;J<X.length;J++)if(X[J]<=j.start_time){X[J]=le,K.push({...j,lane:J}),se=!0;break}if(!se){const J=X.length;X.push(le),K.push({...j,lane:J})}}}const U=K.reduce((H,X)=>Math.max(H,X.lane),-1);return{assignedEvents:K,actualNumLanes:Math.max(o,U+1)}},[L,o,M]),F=i+s,B=b,Y=S!==void 0?Math.min(_+S,O):O,V=Math.max(0,Y-_),q=V*B+Math.max(0,V-1)*2,G=w.useMemo(()=>Array.from({length:V},(K,re)=>re),[V]),{laneEventsByIndex:$,idlePeriodsByLane:Q}=w.useMemo(()=>{const K=Array.from({length:O},()=>[]);for(const U of k){const H=U.lane;K[H]&&K[H].push(U)}const re=K.map(U=>{const H=[];if(U.length>0){U[0].start_time>i&&H.push({start:i,end:U[0].start_time,duration:U[0].start_time-i});for(let j=0;j<U.length-1;j++){const le=U[j].end_time,se=U[j+1].start_time;le<se&&H.push({start:le,end:se,duration:se-le})}const X=U[U.length-1];X.end_time<F&&H.push({start:X.end_time,end:F,duration:F-X.end_time})}else H.push({start:i,end:F,duration:s});return H});return{laneEventsByIndex:K,idlePeriodsByLane:re}},[k,i,F,s,O]);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:q},children:[G.map(K=>{const re=K+_,U=K*(B+2),H=$[re]||[],X=Q[re]||[];return f.jsxs("div",{className:"absolute left-0 right-0",style:{top:U,height:B},children:[X.map((j,le)=>{const se=Math.max(j.start,i),J=Math.min(j.end,F),ee=J-se,ie=(se-i)/s*100,oe=ee/s*100;if(oe<.5||ie>=100||J<=se)return null;const de=C?n8:MS;return f.jsx(Pc,{className:"absolute top-0 bottom-0 group",style:{left:`${ie}%`,width:`${Math.min(oe,100-ie)}%`,backgroundColor:de,borderRadius:"1px"},tooltip:f.jsx(au,{title:"Idle",color:de,details:[{label:"Duration",value:fs(j.duration*1e3)},{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[],{label:"Lane",value:String(re)}]})},`idle-${le}`)}),H.map((j,le)=>{const se=j.environment_response_time,J=j.compute_reward_time,ee=gR(j,"env",a,l,c,d,C),ie=gR(j,"reward",a,l,c,d,C);return f.jsxs(w.Fragment,{children:[f.jsx(ESe,{event:j,server:t,nodeId:D,lane:re,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onClick:()=>p(j)}),se!=null&&se>0&&(()=>{const oe=i+s,de=j.end_time,ye=de+se;if(de>=oe||ye<=i)return null;const ge=Math.max(de,i),Me=Math.min(ye,oe),fe=Math.max(0,(ge-i)/s*100),Se=Math.max(.3,(Me-ge)/s*100),me=se*1e3;return f.jsx(Pc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${fe}%`,width:`${Math.min(Se,100-fe)}%`,backgroundColor:ee.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:ee.opacity},onClick:()=>p(j),tooltip:f.jsx(au,{title:"Env Response",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:ee.color,details:[{label:"Duration",value:fs(me)},...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(re)}]})})})(),x&&J!=null&&J>0&&(()=>{const oe=i+s,de=j.end_time+(se!=null&&se>0?se:0),ye=de+J;if(de>=oe||ye<=i)return null;const ge=Math.max(de,i),Me=Math.min(ye,oe),fe=Math.max(0,(ge-i)/s*100),Se=Math.max(.3,(Me-ge)/s*100),me=J*1e3,Pe=M?Math.max(3,Math.round(B*.4)):void 0,ce=M?Math.round((B-Pe)/2):void 0;return f.jsx(Pc,{className:"absolute group cursor-pointer",style:{left:`${fe}%`,width:`${Math.min(Se,100-fe)}%`,backgroundColor:ie.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:ie.opacity,...M?{top:ce,height:Pe,zIndex:2}:{top:0,bottom:0}},onClick:()=>p(j),tooltip:f.jsx(au,{title:j.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:ie.color,details:[{label:"Duration",value:fs(me)},...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(re)}]})})})()]},`event-${le}`)})]},re)}),m&&R.map((K,re)=>{const U=K.start_time-i,H=Math.max(0,U/s*100),j=(K.end_time-K.start_time)*1e3,le=Math.max(K.start_time,i),se=K.end_time-le,J=Math.max(.5,se/s*100),ee=lW(K.event_type);return f.jsx(Pc,{className:"absolute group cursor-default",style:{top:0,left:`${H}%`,width:`${Math.min(J,100-H)}%`,height:q,backgroundColor:ee,borderRadius:"2px",border:N,boxSizing:"border-box",opacity:.6},tooltip:f.jsx(au,{title:"Weight Broadcast",color:ee,details:[...K.step!=null?[{label:"Step",value:String(K.step)}]:[],{label:"Duration",value:fs(j)},{label:"Server",value:String(t)},...D!==void 0?[{label:"Node",value:String(D)}]:[]],startTime:K.start_time,endTime:K.end_time})},`wb-${re}`)})]})})]})}function TSe(t,e,n=!0,r=!0,i=!1){if(t.event_type!=="request")return lW(t.event_type);if(t.is_canceled)return i?wS:QT;if(!n)return t.is_eval?EA:H_;if(!r)return i?SS:_S;if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?EA:H_;const s=`${t.group_id}:${t.sample_id}`;return e.get(s)==="rollouts_discarded"?i?SS:_S:t.is_eval?EA:H_}function CSe(t,e,n,r=!0,i=!0,s=!1){const o=TSe(t,n,r,i,s);if(!e)return{color:o,opacity:1};const a=o===_S||o===SS,l=o===QT||o===wS;return t.sample_id===e.sampleId?l?{color:s?XX:qX,opacity:1}:a?{color:s?"#9ca3af":"#6b7280",opacity:1}:{color:t.is_eval?dSe:uSe,opacity:1}:t.group_id===e.groupId?l?{color:s?$X:WX,opacity:1}:a?{color:s?GX:VX,opacity:1}:{color:t.is_eval?HX:BX,opacity:1}:{color:o,opacity:.55}}function gR(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?gSe:mSe:a?o?SSe:_Se:o?ySe:vSe:e==="env"?pSe:a?bSe:xSe;return n?t.sample_id===n.sampleId?l?{color:o?"#9ca3af":"#6b7280",opacity:1}:{color:e==="env"?YX:a?ZX:KX,opacity:1}:t.group_id===n.groupId?{color:l?e==="env"?o?nY:tY:a?o?oY:sY:o?iY:rY:e==="env"?QX:a?eY:JX,opacity:1}:{color:c,opacity:.35}:{color:c,opacity:.85}}function ESe({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:a,highlightDiscarded:l,discardStatusReady:c,onClick:d}){const p=qn(gs),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,M=Math.max(t.start_time,i),A=(t.end_time-M)/s*100,{color:N,opacity:D}=CSe(t,o,a,l,c,p),R=t.event_type==="request"&&t.sample_id!==void 0,L=(()=>{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 k=`${t.group_id}:${t.sample_id}`;if(a.get(k)==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"}}return null})();return f.jsx(Pc,{className:`absolute top-0 bottom-0 group ${R?"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:R?d:void 0,tooltip:f.jsx(au,{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:L,details:t.event_type==="request"?FX(t,S,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:fs(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 ASe({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 ee;const[_,S]=w.useState(!0),[M,C]=hn(QG),[A,N]=hn(_ce),D=w.useMemo(()=>{const ie=new Set;return(l??[]).forEach(oe=>{typeof oe=="string"&&ie.add(oe)}),Array.from(ie)},[l]),[R,L]=w.useState([]),k=((p==null?void 0:p.length)??0)===0;k&&R.length>0?L([]):!k&&D.length>0&&R!==D&&L(D);const O=w.useMemo(()=>k?[]:D.length>0?D:R,[k,D,R]),F=w.useMemo(()=>Array.from(new Set((c??[]).filter(ie=>typeof ie=="string"&&ie.trim().length>0))),[c]),B=w.useMemo(()=>O.length===0?F:F.filter(ie=>O.includes(ie)),[O,F]),Y=w.useMemo(()=>{const ie=Object.keys(m??{}).map(Number).filter(oe=>Number.isFinite(oe)).sort((oe,de)=>oe-de);return ie.length>0?ie:!p||p.length===0?[]:p.map((oe,de)=>de)},[m,p]),V=w.useMemo(()=>{const ie=new Set;return t.forEach(oe=>ie.add(oe)),Y.forEach(oe=>ie.add(oe)),Array.from(ie).sort((oe,de)=>oe-de)},[t,Y]),q=8,G=V.length>q,$=w.useMemo(()=>{if(!G)return[];const ie=[];for(let oe=0;oe<V.length;oe+=q){const de=V.slice(oe,oe+q),ye=oe+1,ge=Math.min(oe+q,V.length);ie.push({label:`${ye} – ${ge}`,ranks:de})}return ie},[V,G]),Q=G?Math.min(A,Math.max(0,$.length-1)):0;w.useEffect(()=>{G&&A!==Q&&N(Q)},[G,A,Q,N]);const K=G?((ee=$[Q])==null?void 0:ee.ranks)??V.slice(0,q):V;w.useMemo(()=>new Set(K),[K]);const re=w.useMemo(()=>{const ie=new Map;return Object.entries(e).forEach(([oe,de])=>{const ye=new Set;de.forEach(ge=>{if(!ge.event_type.includes("/"))return;const Me=ge.event_type.split("/")[0];ye.add(`${Me}|${ge.step}`)}),ie.set(Number(oe),ye)}),ie},[e]),U=w.useMemo(()=>{const ie=new Map;return K.forEach(oe=>{var ge;const de=((ge=m==null?void 0:m[oe])==null?void 0:ge.node_id)??null,ye=de===null?"__unknown__":String(de);ie.has(ye)||ie.set(ye,{nodeId:de,ranks:[]}),ie.get(ye).ranks.push(oe)}),Array.from(ie.values()).map(oe=>({nodeId:oe.nodeId,ranks:oe.ranks.sort((de,ye)=>de-ye)})).sort((oe,de)=>oe.nodeId===null&&de.nodeId===null?0:oe.nodeId===null?1:de.nodeId===null?-1:oe.nodeId-de.nodeId)},[K,m]),H=w.useMemo(()=>typeof x=="number"&&Number.isFinite(x)?x>1:U.filter(oe=>oe.nodeId!==null).length>1,[U,x]),X=w.useCallback(ie=>{var de;ie.event_type.includes("/")||!(((de=re.get(ie.rank))==null?void 0:de.has(`${ie.event_type}|${ie.step}`))??!1)||C(ye=>(ye==null?void 0:ye.eventType)===ie.event_type&&(ye==null?void 0:ye.rank)===ie.rank&&(ye==null?void 0:ye.step)===ie.step?null:{eventType:ie.event_type,rank:ie.rank,step:ie.step})},[re,C]),j=w.useCallback((ie,oe)=>{const de=B,ge=oe===!0?de.includes(ie)?de:[...de,ie]:de.filter(Me=>Me!==ie);d==null||d(ge)},[B,d]),le=w.useCallback(()=>d==null?void 0:d([...O]),[O,d]),se=w.useCallback(()=>d==null?void 0:d([]),[d]),J=w.useCallback(ie=>{const oe=m==null?void 0:m[ie],de=(oe==null?void 0:oe.local_rank)??(p?p[ie]:void 0),ye=(o==null?void 0:o[ie])??(de!==void 0&&s?s[de]??[]:void 0);return f.jsx(kSe,{rank:ie,nodeId:(oe==null?void 0:oe.node_id)??null,showNodeLabel:H,events:e[ie]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:M,onEventClick:X,childEventKeys:re.get(ie)??rSe,systemGpuIndex:de,gpuMetrics:ye,selectedMetricNames:B,gpuMetricsIsLoading:a??!1},ie)},[re,B,e,X,r,i,n,M,s,o,a,m,p,H]);return f.jsxs(Pi,{open:_,onOpenChange:S,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Di,{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(kr,{className:bt("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(gl,{className:"size-3.5 text-muted-foreground"})})]})}),_&&f.jsxs(f.Fragment,{children:[G&&f.jsxs(NS,{value:String(Q),onValueChange:ie=>N(Number(ie)),children:[f.jsx(RS,{size:"sm",className:"text-xs h-7 gap-1",children:f.jsx(kS,{})}),f.jsx(PS,{children:$.map((ie,oe)=>f.jsxs(DS,{value:String(oe),children:["GPUs ",ie.label]},oe))})]}),f.jsxs(oo,{children:[f.jsx(ao,{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:B.length}),f.jsx(kr,{className:"h-3 w-3 text-muted-foreground"})]})}),f.jsxs(lo,{align:"start",className:"w-64",children:[f.jsx(om,{children:"Trainer GPU Plots"}),f.jsx(Bs,{}),f.jsx(ua,{onSelect:ie=>{ie.preventDefault(),le()},className:"text-xs",children:"Select All"}),f.jsx(ua,{onSelect:ie=>{ie.preventDefault(),se()},className:"text-xs",children:"Unselect All"}),f.jsx(Bs,{}),O.length>0?O.map(ie=>f.jsx(Er,{checked:B.includes(ie),onCheckedChange:oe=>j(ie,oe),onSelect:oe=>oe.preventDefault(),className:"text-xs",children:UX(ie)},ie)):f.jsx(ua,{disabled:!0,className:"text-xs text-muted-foreground",children:a?"Loading plots...":"No plots available"})]})]})]})]}),f.jsxs(Ii,{children:[f.jsx("div",{className:"space-y-4",children:K.length>0?H?U.map(ie=>f.jsx(NSe,{nodeId:ie.nodeId,rankCount:ie.ranks.length,children:ie.ranks.map(oe=>J(oe))},ie.nodeId===null?"__unknown__":String(ie.nodeId))):K.map(ie=>J(ie)):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:pp(0)}),f.jsx("span",{children:pp(r/2)}),f.jsx("span",{children:pp(r)})]})]})]})}function NSe({nodeId:t,rankCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return f.jsxs(Pi,{open:r,onOpenChange:i,children:[f.jsx(Di,{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(kr,{className:bt("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(Ii,{children:f.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function kSe({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=w.useMemo(()=>[...r.filter(D=>!D.event_type.includes("/"))].sort((D,R)=>D.start_time-R.start_time),[r]),_=w.useMemo(()=>aY(b,i,o),[b,i,o]),S=w.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]),M=w.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,R)=>D-R):d!==void 0?[d]:[]},[p,d]),C=n&&e!==null&&e!==void 0?`Rank ${t} Node ${e}`:`Rank ${t}`,A=w.useMemo(()=>{if(M.length===0)return;const N={};return M.forEach(D=>{N[D]=C}),N},[M,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(RSe,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:a!==null},`idle-${D}`)),b.map((N,D)=>{const R=(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,L=c.has(`${N.event_type}|${N.step}`),k=a!==null&&!R;return f.jsx(PSe,{event:N,intervalStart:i,intervalDuration:s,isSelected:R,isDimmed:k,hasChildren:L,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${D}`)})]}),M.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:UX(N)}),f.jsx(Q$,{metricName:N,data:S[N]??[],gpuIndices:M,intervalStart:i,intervalEnd:o,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:x})]},N))]})]})}function RSe({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const o=qn(gs)?n8:MS,l=(t.start-n)/r*100,c=t.duration/r*100;return c<.5||l<0||l>=100?null:f.jsx(Pc,{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(au,{title:"Idle",color:o,details:[{label:"Duration",value:fs(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function PSe({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,_=V2(t.event_type),S=cW(t.event_type,t.step,t.microbatch,t.minibatch);return f.jsx(Pc,{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(au,{title:S.primary,titleSecondary:S.secondary,color:_,details:[{label:"Duration",value:fs(p)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function DSe({parentEvent:t,childEvents:e}){const n=qn(gs),r=[...e].sort((l,c)=>l.start_time-c.start_time),i=t.start_time,s=t.end_time,o=s-i,a=aY(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=V2(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:fs(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(Pc,{className:"absolute top-px bottom-px group",style:{left:`${p}%`,width:`${Math.min(m,100-p)}%`,backgroundColor:MS,borderRadius:"1px",opacity:.5},tooltip:f.jsx(au,{title:"Gap",color:MS,details:[{label:"Duration",value:fs(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),_=V2(l.event_type),S=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type;return f.jsx(Pc,{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(au,{title:S||l.event_type,color:_,capitalize:!0,details:[{label:"Duration",value:fs(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:fs(0)}),f.jsx("span",{children:fs(o/2*1e3)}),f.jsx("span",{children:fs(o*1e3)})]})]})}function au({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 Pc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[o,a]=w.useState(!1),[l,c]=w.useState(!1),[d,p]=w.useState({x:0,y:0}),[m,x]=w.useState(null),b=w.useRef(null),_=w.useRef(null),S=o||l,M=l&&m?m:d;w.useLayoutEffect(()=>{const A=b.current;if(!S||!A)return;const N=A.getBoundingClientRect(),D=8;let R=M.x-N.width/2;R+N.width+D>window.innerWidth&&(R=window.innerWidth-N.width-D),R<D&&(R=D);let L=M.y-N.height-12;L<D&&(L=M.y+16),L+N.height+D>window.innerHeight&&(L=window.innerHeight-N.height-D),A.style.left=`${R}px`,A.style.top=`${L}px`,A.style.visibility="visible"},[S,M]),w.useEffect(()=>{if(!l)return;const A=D=>{var L,k;const R=D.target;(L=b.current)!=null&&L.contains(R)||(k=_.current)!=null&&k.contains(R)||(c(!1),x(null))},N=setTimeout(()=>{document.addEventListener("pointerdown",A)},0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",A)}},[l]);const C=w.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?$l.createPortal(f.jsx("div",{ref:b,className:"fixed",style:{left:M.x,top:M.y,zIndex:99999,visibility:"hidden",pointerEvents:l?"auto":"none"},children:r}),document.body):null]})}function aY(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 p9({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]=w.useState(s.toString());w.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(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:f.jsx(mue,{className:"h-3.5 w-3.5"})}),f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:f.jsx(HT,{className:"h-3.5 w-3.5"})}),f.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[f.jsx(ah,{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(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:f.jsx(tm,{className:"h-3.5 w-3.5"})}),f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:f.jsx(xue,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const Hw="183",Hg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Vg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},lY=0,xR=1,cY=2,ISe=3,uY=0,O1=1,eS=2,Yg=3,Cp=0,Kl=1,ru=2,ch=0,ux=1,vR=2,yR=3,bR=4,dY=5,OSe=6,z0=100,fY=101,hY=102,pY=103,mY=104,gY=200,xY=201,vY=202,yY=203,u5=204,d5=205,bY=206,_Y=207,SY=208,wY=209,MY=210,TY=211,CY=212,EY=213,AY=214,f5=0,h5=1,p5=2,bx=3,m5=4,g5=5,x5=6,v5=7,Vw=0,NY=1,kY=2,hu=0,m9=1,g9=2,x9=3,PC=4,v9=5,y9=6,b9=7,_R="attached",RY="detached",DC=300,hh=301,xm=302,tS=303,nS=304,qy=306,FS=1e3,Dc=1001,US=1002,Po=1003,_9=1004,LSe=1004,v1=1005,jSe=1005,rs=1006,rS=1007,zSe=1007,rh=1008,FSe=1008,Gl=1009,S9=1010,w9=1011,yy=1012,IC=1013,hd=1014,Yl=1015,ph=1016,OC=1017,LC=1018,by=1020,M9=35902,T9=35899,C9=1021,E9=1022,vl=1023,mh=1026,Z0=1027,jC=1028,Gw=1029,_x=1030,zC=1031,USe=1032,FC=1033,iS=33776,sS=33777,oS=33778,aS=33779,y5=35840,b5=35841,_5=35842,S5=35843,w5=36196,M5=37492,T5=37496,C5=37488,E5=37489,A5=37490,N5=37491,k5=37808,R5=37809,P5=37810,D5=37811,I5=37812,O5=37813,L5=37814,j5=37815,z5=37816,F5=37817,U5=37818,B5=37819,H5=37820,V5=37821,G5=36492,W5=36494,$5=36495,q5=36283,X5=36284,Y5=36285,K5=36286,PY=2200,DY=2201,IY=2202,BS=2300,Z5=2301,d2=2302,SR=2303,Kg=2400,Zg=2401,HS=2402,UC=2500,A9=2501,BSe=0,HSe=1,VSe=2,OY=3200,LY=3201,GSe=3202,WSe=3203,Im=0,jY=1,dp="",xl="srgb",vm="srgb-linear",VS="linear",Hi="srgb",$Se="",qSe="rg",XSe="ga",YSe=0,Gg=7680,KSe=7681,ZSe=7682,QSe=7683,JSe=34055,ewe=34056,twe=5386,nwe=512,rwe=513,iwe=514,swe=515,owe=516,awe=517,lwe=518,wR=519,zY=512,FY=513,UY=514,BC=515,BY=516,HY=517,HC=518,VY=519,GS=35044,cwe=35048,uwe=35040,dwe=35045,fwe=35049,hwe=35041,pwe=35046,mwe=35050,gwe=35042,xwe="100",MR="300 es",lu=2e3,Sx=2001,vwe={COMPUTE:"compute",RENDER:"render"},ywe={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},bwe={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},_we={TEXTURE_COMPARE:"depthTextureCompare"};function Swe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const wwe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function y1(t,e){return new wwe[t](e)}function GY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function WS(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function WY(){const t=WS("canvas");return t.style.display="block",t}const Cj={};let ym=null;function Mwe(t){ym=t}function Twe(){return ym}function $S(...t){const e="THREE."+t.shift();ym?ym("log",e,...t):console.log(e,...t)}function $Y(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 Sn(...t){t=$Y(t);const e="THREE."+t.shift();if(ym)ym("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Wn(...t){t=$Y(t);const e="THREE."+t.shift();if(ym)ym("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function qS(...t){const e=t.join(" ");e in Cj||(Cj[e]=!0,Sn(...t))}function Cwe(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 Ewe={[f5]:h5,[p5]:x5,[m5]:v5,[bx]:g5,[h5]:f5,[x5]:p5,[v5]:m5,[g5]:bx};let Mh=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 fl=["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 Ej=1234567;const dx=Math.PI/180,_y=180/Math.PI;function pu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fl[t&255]+fl[t>>8&255]+fl[t>>16&255]+fl[t>>24&255]+"-"+fl[e&255]+fl[e>>8&255]+"-"+fl[e>>16&15|64]+fl[e>>24&255]+"-"+fl[n&63|128]+fl[n>>8&255]+"-"+fl[n>>16&255]+fl[n>>24&255]+fl[r&255]+fl[r>>8&255]+fl[r>>16&255]+fl[r>>24&255]).toLowerCase()}function fr(t,e,n){return Math.max(e,Math.min(n,t))}function N9(t,e){return(t%e+e)%e}function Awe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Nwe(t,e,n){return t!==e?(n-t)/(e-t):0}function lS(t,e,n){return(1-n)*t+n*e}function kwe(t,e,n,r){return lS(t,e,1-Math.exp(-n*r))}function Rwe(t,e=1){return e-Math.abs(N9(t,e*2)-e)}function Pwe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Dwe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Iwe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Owe(t,e){return t+Math.random()*(e-t)}function Lwe(t){return t*(.5-Math.random())}function jwe(t){t!==void 0&&(Ej=t);let e=Ej+=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 zwe(t){return t*dx}function Fwe(t){return t*_y}function Uwe(t){return(t&t-1)===0&&t!==0}function Bwe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Hwe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vwe(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:Sn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Wl(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 jr(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 qY={DEG2RAD:dx,RAD2DEG:_y,generateUUID:pu,clamp:fr,euclideanModulo:N9,mapLinear:Awe,inverseLerp:Nwe,lerp:lS,damp:kwe,pingpong:Rwe,smoothstep:Pwe,smootherstep:Dwe,randInt:Iwe,randFloat:Owe,randFloatSpread:Lwe,seededRandom:jwe,degToRad:zwe,radToDeg:Fwe,isPowerOfTwo:Uwe,ceilPowerOfTwo:Bwe,floorPowerOfTwo:Hwe,setQuaternionFromProperEuler:Vwe,normalize:jr,denormalize:Wl};class Wt{constructor(e=0,n=0){Wt.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=fr(this.x,e.x,n.x),this.y=fr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=fr(this.x,e,n),this.y=fr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(fr(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(fr(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 Ya{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 M=1-a;if(S<.9995){const C=Math.acos(S),A=Math.sin(C);M=Math.sin(M*C)/A,a=Math.sin(a*C)/A,l=l*M+m*a,c=c*M+x*a,d=d*M+b*a,p=p*M+_*a}else{l=l*M+m*a,c=c*M+x*a,d=d*M+b*a,p=p*M+_*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:Sn("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(fr(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 Ve{constructor(e=0,n=0,r=0){Ve.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(Aj.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Aj.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=fr(this.x,e.x,n.x),this.y=fr(this.y,e.y,n.y),this.z=fr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=fr(this.x,e,n),this.y=fr(this.y,e,n),this.z=fr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(fr(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 E6.copy(this).projectOnVector(e),this.sub(E6)}reflect(e){return this.sub(E6.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(fr(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 E6=new Ve,Aj=new Ya;class Cr{constructor(e,n,r,i,s,o,a,l,c){Cr.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],M=i[6],C=i[1],A=i[4],N=i[7],D=i[2],R=i[5],L=i[8];return s[0]=o*_+a*C+l*D,s[3]=o*S+a*A+l*R,s[6]=o*M+a*N+l*L,s[1]=c*_+d*C+p*D,s[4]=c*S+d*A+p*R,s[7]=c*M+d*N+p*L,s[2]=m*_+x*C+b*D,s[5]=m*S+x*A+b*R,s[8]=m*M+x*N+b*L,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(A6.makeScale(e,n)),this}rotate(e){return this.premultiply(A6.makeRotation(-e)),this}translate(e,n){return this.premultiply(A6.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 A6=new Cr,Nj=new Cr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),kj=new Cr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gwe(){const t={enabled:!0,workingColorSpace:vm,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Hi&&(i.r=vp(i.r),i.g=vp(i.g),i.b=vp(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===Hi&&(i.r=L1(i.r),i.g=L1(i.g),i.b=L1(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===dp?VS: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 qS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return qS("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({[vm]:{primaries:e,whitePoint:r,transfer:VS,toXYZ:Nj,fromXYZ:kj,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:xl},outputColorSpaceConfig:{drawingBufferColorSpace:xl}},[xl]:{primaries:e,whitePoint:r,transfer:Hi,toXYZ:Nj,fromXYZ:kj,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:xl}}}),t}const li=Gwe();function vp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function L1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Vv;class XY{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{Vv===void 0&&(Vv=WS("canvas")),Vv.width=e.width,Vv.height=e.height;const i=Vv.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Vv}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=WS("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]=vp(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(vp(n[r]/255)*255):n[r]=vp(n[r]);return{data:n,width:e.width,height:e.height}}else return Sn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Wwe=0;class Q0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wwe++}),this.uuid=pu(),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(N6(i[o].image)):s.push(N6(i[o]))}else s=N6(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function N6(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?XY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Sn("Texture: Unable to serialize Texture."),{})}let $we=0;const k6=new Ve;class so extends Mh{constructor(e=so.DEFAULT_IMAGE,n=so.DEFAULT_MAPPING,r=Dc,i=Dc,s=rs,o=rh,a=vl,l=Gl,c=so.DEFAULT_ANISOTROPY,d=dp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$we++}),this.uuid=pu(),this.name="",this.source=new Q0(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 Wt(0,0),this.repeat=new Wt(1,1),this.center=new Wt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Cr,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(k6).x}get height(){return this.source.getSize(k6).y}get depth(){return this.source.getSize(k6).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){Sn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){Sn(`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!==DC)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case FS:e.x=e.x-Math.floor(e.x);break;case Dc:e.x=e.x<0?0:1;break;case US: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 FS:e.y=e.y-Math.floor(e.y);break;case Dc:e.y=e.y<0?0:1;break;case US: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++}}so.DEFAULT_IMAGE=null;so.DEFAULT_MAPPING=DC;so.DEFAULT_ANISOTROPY=1;class hi{constructor(e=0,n=0,r=0,i=1){hi.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],M=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+M-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(c+1)/2,N=(x+1)/2,D=(M+1)/2,R=(d+m)/4,L=(p+_)/4,k=(b+S)/4;return A>N&&A>D?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=R/r,s=L/r):N>D?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=R/i,s=k/i):D<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(D),r=L/s,i=k/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+M-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=fr(this.x,e.x,n.x),this.y=fr(this.y,e.y,n.y),this.z=fr(this.z,e.z,n.z),this.w=fr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=fr(this.x,e,n),this.y=fr(this.y,e,n),this.z=fr(this.z,e,n),this.w=fr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(fr(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 k9 extends Mh{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 hi(0,0,e,n),this.scissorTest=!1,this.viewport=new hi(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new so(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 Q0(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 mu extends k9{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class VC extends so{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=Po,this.minFilter=Po,this.wrapR=Dc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class qwe extends mu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new VC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class GC extends so{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=Po,this.minFilter=Po,this.wrapR=Dc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xwe extends mu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new GC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ur{constructor(e,n,r,i,s,o,a,l,c,d,p,m,x,b,_,S){ur.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 M=this.elements;return M[0]=e,M[4]=n,M[8]=r,M[12]=i,M[1]=s,M[5]=o,M[9]=a,M[13]=l,M[2]=c,M[6]=d,M[10]=p,M[14]=m,M[3]=x,M[7]=b,M[11]=_,M[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 ur().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/Gv.setFromMatrixColumn(e,0).length(),s=1/Gv.setFromMatrixColumn(e,1).length(),o=1/Gv.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(Ywe,e,Kwe)}lookAt(e,n,r){const i=this.elements;return Zc.subVectors(e,n),Zc.lengthSq()===0&&(Zc.z=1),Zc.normalize(),T0.crossVectors(r,Zc),T0.lengthSq()===0&&(Math.abs(r.z)===1?Zc.x+=1e-4:Zc.z+=1e-4,Zc.normalize(),T0.crossVectors(r,Zc)),T0.normalize(),X4.crossVectors(Zc,T0),i[0]=T0.x,i[4]=X4.x,i[8]=Zc.x,i[1]=T0.y,i[5]=X4.y,i[9]=Zc.y,i[2]=T0.z,i[6]=X4.z,i[10]=Zc.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],M=r[14],C=r[3],A=r[7],N=r[11],D=r[15],R=i[0],L=i[4],k=i[8],O=i[12],F=i[1],B=i[5],Y=i[9],V=i[13],q=i[2],G=i[6],$=i[10],Q=i[14],K=i[3],re=i[7],U=i[11],H=i[15];return s[0]=o*R+a*F+l*q+c*K,s[4]=o*L+a*B+l*G+c*re,s[8]=o*k+a*Y+l*$+c*U,s[12]=o*O+a*V+l*Q+c*H,s[1]=d*R+p*F+m*q+x*K,s[5]=d*L+p*B+m*G+x*re,s[9]=d*k+p*Y+m*$+x*U,s[13]=d*O+p*V+m*Q+x*H,s[2]=b*R+_*F+S*q+M*K,s[6]=b*L+_*B+S*G+M*re,s[10]=b*k+_*Y+S*$+M*U,s[14]=b*O+_*V+S*Q+M*H,s[3]=C*R+A*F+N*q+D*K,s[7]=C*L+A*B+N*G+D*re,s[11]=C*k+A*Y+N*$+D*U,s[15]=C*O+A*V+N*Q+D*H,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],M=e[15],C=l*x-c*m,A=a*x-c*p,N=a*m-l*p,D=o*x-c*d,R=o*m-l*d,L=o*p-a*d;return n*(_*C-S*A+M*N)-r*(b*C-S*D+M*R)+i*(b*A-_*D+M*L)-s*(b*N-_*R+S*L)}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],M=e[15],C=n*a-r*o,A=n*l-i*o,N=n*c-s*o,D=r*l-i*a,R=r*c-s*a,L=i*c-s*l,k=d*_-p*b,O=d*S-m*b,F=d*M-x*b,B=p*S-m*_,Y=p*M-x*_,V=m*M-x*S,q=C*V-A*Y+N*B+D*F-R*O+L*k;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const G=1/q;return e[0]=(a*V-l*Y+c*B)*G,e[1]=(i*Y-r*V-s*B)*G,e[2]=(_*L-S*R+M*D)*G,e[3]=(m*R-p*L-x*D)*G,e[4]=(l*F-o*V-c*O)*G,e[5]=(n*V-i*F+s*O)*G,e[6]=(S*N-b*L-M*A)*G,e[7]=(d*L-m*N+x*A)*G,e[8]=(o*Y-a*F+c*k)*G,e[9]=(r*F-n*Y-s*k)*G,e[10]=(b*R-_*N+M*C)*G,e[11]=(p*N-d*R-x*C)*G,e[12]=(a*O-o*B-l*k)*G,e[13]=(n*B-r*O+i*k)*G,e[14]=(_*A-b*D-S*C)*G,e[15]=(d*D-p*A+m*C)*G,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,M=a*p,C=l*c,A=l*d,N=l*p,D=r.x,R=r.y,L=r.z;return i[0]=(1-(_+M))*D,i[1]=(x+N)*D,i[2]=(b-A)*D,i[3]=0,i[4]=(x-N)*R,i[5]=(1-(m+M))*R,i[6]=(S+C)*R,i[7]=0,i[8]=(b+A)*L,i[9]=(S-C)*L,i[10]=(1-(m+_))*L,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=Gv.set(i[0],i[1],i[2]).length();const a=Gv.set(i[4],i[5],i[6]).length(),l=Gv.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Hd.copy(this);const c=1/o,d=1/a,p=1/l;return Hd.elements[0]*=c,Hd.elements[1]*=c,Hd.elements[2]*=c,Hd.elements[4]*=d,Hd.elements[5]*=d,Hd.elements[6]*=d,Hd.elements[8]*=p,Hd.elements[9]*=p,Hd.elements[10]*=p,n.setFromRotationMatrix(Hd),r.x=o,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,o,a=lu,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===lu)b=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Sx)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=lu,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===lu)b=-2/(o-s),_=-(o+s)/(o-s);else if(a===Sx)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 Gv=new Ve,Hd=new ur,Ywe=new Ve(0,0,0),Kwe=new Ve(1,1,1),T0=new Ve,X4=new Ve,Zc=new Ve,Rj=new ur,Pj=new Ya;class xu{constructor(e=0,n=0,r=0,i=xu.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(fr(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(-fr(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(fr(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(-fr(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(fr(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(-fr(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:Sn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return Rj.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Rj,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Pj.setFromEuler(this),this.setFromQuaternion(Pj,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}}xu.DEFAULT_ORDER="XYZ";class Sy{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 Zwe=0;const Dj=new Ve,Wv=new Ya,Jh=new ur,Y4=new Ve,h_=new Ve,Qwe=new Ve,Jwe=new Ya,Ij=new Ve(1,0,0),Oj=new Ve(0,1,0),Lj=new Ve(0,0,1),jj={type:"added"},e3e={type:"removed"},$v={type:"childadded",child:null},R6={type:"childremoved",child:null};class _i extends Mh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Zwe++}),this.uuid=pu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_i.DEFAULT_UP.clone();const e=new Ve,n=new xu,r=new Ya,i=new Ve(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 ur},normalMatrix:{value:new Cr}}),this.matrix=new ur,this.matrixWorld=new ur,this.matrixAutoUpdate=_i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Sy,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 Wv.setFromAxisAngle(e,n),this.quaternion.multiply(Wv),this}rotateOnWorldAxis(e,n){return Wv.setFromAxisAngle(e,n),this.quaternion.premultiply(Wv),this}rotateX(e){return this.rotateOnAxis(Ij,e)}rotateY(e){return this.rotateOnAxis(Oj,e)}rotateZ(e){return this.rotateOnAxis(Lj,e)}translateOnAxis(e,n){return Dj.copy(e).applyQuaternion(this.quaternion),this.position.add(Dj.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Ij,e)}translateY(e){return this.translateOnAxis(Oj,e)}translateZ(e){return this.translateOnAxis(Lj,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Jh.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Y4.copy(e):Y4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),h_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Jh.lookAt(h_,Y4,this.up):Jh.lookAt(Y4,h_,this.up),this.quaternion.setFromRotationMatrix(Jh),i&&(Jh.extractRotation(i.matrixWorld),Wv.setFromRotationMatrix(Jh),this.quaternion.premultiply(Wv.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Wn("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(jj),$v.child=e,this.dispatchEvent($v),$v.child=null):Wn("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(e3e),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),Jh.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Jh.multiply(e.parent.matrixWorld)),e.applyMatrix4(Jh),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(jj),$v.child=e,this.dispatchEvent($v),$v.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(h_,e,Qwe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(h_,Jwe,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 Ve(0,1,0);_i.DEFAULT_MATRIX_AUTO_UPDATE=!0;_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class b1 extends _i{constructor(){super(),this.isGroup=!0,this.type="Group"}}const t3e={type:"move"};class f2{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new b1,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 b1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ve,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ve),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new b1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ve,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ve),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),M=this._getHandJoint(c,_);S!==null&&(M.matrix.fromArray(S.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.matrixWorldNeedsUpdate=!0,M.jointRadius=S.radius),M.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(t3e)))}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 b1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const YY={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},C0={h:0,s:0,l:0},K4={h:0,s:0,l:0};function P6(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 Nn{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=xl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,li.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=li.workingColorSpace){return this.r=e,this.g=n,this.b=r,li.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=li.workingColorSpace){if(e=N9(e,1),n=fr(n,0,1),r=fr(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=P6(o,s,e+1/3),this.g=P6(o,s,e),this.b=P6(o,s,e-1/3)}return li.colorSpaceToWorking(this,i),this}setStyle(e,n=xl){function r(s){s!==void 0&&parseFloat(s)<1&&Sn("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:Sn("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);Sn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=xl){const r=YY[e.toLowerCase()];return r!==void 0?this.setHex(r,n):Sn("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=vp(e.r),this.g=vp(e.g),this.b=vp(e.b),this}copyLinearToSRGB(e){return this.r=L1(e.r),this.g=L1(e.g),this.b=L1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xl){return li.workingToColorSpace(hl.copy(this),e),Math.round(fr(hl.r*255,0,255))*65536+Math.round(fr(hl.g*255,0,255))*256+Math.round(fr(hl.b*255,0,255))}getHexString(e=xl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=li.workingColorSpace){li.workingToColorSpace(hl.copy(this),n);const r=hl.r,i=hl.g,s=hl.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=li.workingColorSpace){return li.workingToColorSpace(hl.copy(this),n),e.r=hl.r,e.g=hl.g,e.b=hl.b,e}getStyle(e=xl){li.workingToColorSpace(hl.copy(this),e);const n=hl.r,r=hl.g,i=hl.b;return e!==xl?`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(C0),this.setHSL(C0.h+e,C0.s+n,C0.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(C0),e.getHSL(K4);const r=lS(C0.h,K4.h,n),i=lS(C0.s,K4.s,n),s=lS(C0.l,K4.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 hl=new Nn;Nn.NAMES=YY;class WC{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new Nn(e),this.density=n}clone(){return new WC(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class $C{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new Nn(e),this.near=n,this.far=r}clone(){return new $C(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let R9=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 xu,this.environmentIntensity=1,this.environmentRotation=new xu,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 Vd=new Ve,ep=new Ve,D6=new Ve,tp=new Ve,qv=new Ve,Xv=new Ve,zj=new Ve,I6=new Ve,O6=new Ve,L6=new Ve,j6=new hi,z6=new hi,F6=new hi;class Rc{constructor(e=new Ve,n=new Ve,r=new Ve){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Vd.subVectors(e,n),i.cross(Vd);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){Vd.subVectors(i,n),ep.subVectors(r,n),D6.subVectors(e,n);const o=Vd.dot(Vd),a=Vd.dot(ep),l=Vd.dot(D6),c=ep.dot(ep),d=ep.dot(D6),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,tp)===null?!1:tp.x>=0&&tp.y>=0&&tp.x+tp.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,tp)===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,tp.x),l.addScaledVector(o,tp.y),l.addScaledVector(a,tp.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return j6.setScalar(0),z6.setScalar(0),F6.setScalar(0),j6.fromBufferAttribute(e,n),z6.fromBufferAttribute(e,r),F6.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(j6,s.x),o.addScaledVector(z6,s.y),o.addScaledVector(F6,s.z),o}static isFrontFacing(e,n,r,i){return Vd.subVectors(r,n),ep.subVectors(e,n),Vd.cross(ep).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 Vd.subVectors(this.c,this.b),ep.subVectors(this.a,this.b),Vd.cross(ep).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Rc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Rc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Rc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Rc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Rc.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;qv.subVectors(i,r),Xv.subVectors(s,r),I6.subVectors(e,r);const l=qv.dot(I6),c=Xv.dot(I6);if(l<=0&&c<=0)return n.copy(r);O6.subVectors(e,i);const d=qv.dot(O6),p=Xv.dot(O6);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(qv,o);L6.subVectors(e,s);const x=qv.dot(L6),b=Xv.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(Xv,a);const S=d*b-x*p;if(S<=0&&p-d>=0&&x-b>=0)return zj.subVectors(s,i),a=(p-d)/(p-d+(x-b)),n.copy(i).addScaledVector(zj,a);const M=1/(S+_+m);return o=_*M,a=m*M,n.copy(r).addScaledVector(qv,o).addScaledVector(Xv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Do{constructor(e=new Ve(1/0,1/0,1/0),n=new Ve(-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(Gd.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Gd.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=Gd.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,Gd):Gd.fromBufferAttribute(s,o),Gd.applyMatrix4(e.matrixWorld),this.expandByPoint(Gd);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Z4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Z4.copy(r.boundingBox)),Z4.applyMatrix4(e.matrixWorld),this.union(Z4)}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,Gd),Gd.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(p_),Q4.subVectors(this.max,p_),Yv.subVectors(e.a,p_),Kv.subVectors(e.b,p_),Zv.subVectors(e.c,p_),E0.subVectors(Kv,Yv),A0.subVectors(Zv,Kv),Mg.subVectors(Yv,Zv);let n=[0,-E0.z,E0.y,0,-A0.z,A0.y,0,-Mg.z,Mg.y,E0.z,0,-E0.x,A0.z,0,-A0.x,Mg.z,0,-Mg.x,-E0.y,E0.x,0,-A0.y,A0.x,0,-Mg.y,Mg.x,0];return!U6(n,Yv,Kv,Zv,Q4)||(n=[1,0,0,0,1,0,0,0,1],!U6(n,Yv,Kv,Zv,Q4))?!1:(J4.crossVectors(E0,A0),n=[J4.x,J4.y,J4.z],U6(n,Yv,Kv,Zv,Q4))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gd).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gd).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:(np[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),np[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),np[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),np[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),np[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),np[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),np[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),np[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(np),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 np=[new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve],Gd=new Ve,Z4=new Do,Yv=new Ve,Kv=new Ve,Zv=new Ve,E0=new Ve,A0=new Ve,Mg=new Ve,p_=new Ve,Q4=new Ve,J4=new Ve,Tg=new Ve;function U6(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Tg.fromArray(t,s);const a=i.x*Math.abs(Tg.x)+i.y*Math.abs(Tg.y)+i.z*Math.abs(Tg.z),l=e.dot(Tg),c=n.dot(Tg),d=r.dot(Tg);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const fp=n3e();function n3e(){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 Cc(t){Math.abs(t)>65504&&Sn("DataUtils.toHalfFloat(): Value out of range."),t=fr(t,-65504,65504),fp.floatView[0]=t;const e=fp.uint32View[0],n=e>>23&511;return fp.baseTable[n]+((e&8388607)>>fp.shiftTable[n])}function z_(t){const e=t>>10;return fp.uint32View[0]=fp.mantissaTable[fp.offsetTable[e]+(t&1023)]+fp.exponentTable[e],fp.floatView[0]}class r3e{static toHalfFloat(e){return Cc(e)}static fromHalfFloat(e){return z_(e)}}const $o=new Ve,eM=new Wt;let i3e=0;class $i{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:i3e++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=GS,this.updateRanges=[],this.gpuType=Yl,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++)eM.fromBufferAttribute(this,n),eM.applyMatrix3(e),this.setXY(n,eM.x,eM.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)$o.fromBufferAttribute(this,n),$o.applyMatrix3(e),this.setXYZ(n,$o.x,$o.y,$o.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)$o.fromBufferAttribute(this,n),$o.applyMatrix4(e),this.setXYZ(n,$o.x,$o.y,$o.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)$o.fromBufferAttribute(this,n),$o.applyNormalMatrix(e),this.setXYZ(n,$o.x,$o.y,$o.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)$o.fromBufferAttribute(this,n),$o.transformDirection(e),this.setXYZ(n,$o.x,$o.y,$o.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=Wl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=jr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Wl(n,this.array)),n}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Wl(n,this.array)),n}setY(e,n){return this.normalized&&(n=jr(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=Wl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=jr(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=Wl(n,this.array)),n}setW(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(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!==GS&&(e.usage=this.usage),e}}class s3e extends $i{constructor(e,n,r){super(new Int8Array(e),n,r)}}class o3e extends $i{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class a3e extends $i{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class l3e extends $i{constructor(e,n,r){super(new Int16Array(e),n,r)}}class P9 extends $i{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class c3e extends $i{constructor(e,n,r){super(new Int32Array(e),n,r)}}class D9 extends $i{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class u3e extends $i{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=z_(this.array[e*this.itemSize]);return this.normalized&&(n=Wl(n,this.array)),n}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize]=Cc(n),this}getY(e){let n=z_(this.array[e*this.itemSize+1]);return this.normalized&&(n=Wl(n,this.array)),n}setY(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+1]=Cc(n),this}getZ(e){let n=z_(this.array[e*this.itemSize+2]);return this.normalized&&(n=Wl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+2]=Cc(n),this}getW(e){let n=z_(this.array[e*this.itemSize+3]);return this.normalized&&(n=Wl(n,this.array)),n}setW(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+3]=Cc(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array)),this.array[e+0]=Cc(n),this.array[e+1]=Cc(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array)),this.array[e+0]=Cc(n),this.array[e+1]=Cc(r),this.array[e+2]=Cc(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(s,this.array)),this.array[e+0]=Cc(n),this.array[e+1]=Cc(r),this.array[e+2]=Cc(i),this.array[e+3]=Cc(s),this}}class In extends $i{constructor(e,n,r){super(new Float32Array(e),n,r)}}const d3e=new Do,m_=new Ve,B6=new Ve;class Qo{constructor(e=new Ve,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):d3e.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;m_.subVectors(e,this.center);const n=m_.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(m_,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):(B6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(m_.copy(e.center).add(B6)),this.expandByPoint(m_.copy(e.center).sub(B6))),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 f3e=0;const $u=new ur,H6=new _i,Qv=new Ve,Qc=new Do,g_=new Do,Ma=new Ve;class Ar extends Mh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:f3e++}),this.uuid=pu(),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(Swe(e)?D9:P9)(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 Cr().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 $u.makeRotationFromQuaternion(e),this.applyMatrix4($u),this}rotateX(e){return $u.makeRotationX(e),this.applyMatrix4($u),this}rotateY(e){return $u.makeRotationY(e),this.applyMatrix4($u),this}rotateZ(e){return $u.makeRotationZ(e),this.applyMatrix4($u),this}translate(e,n,r){return $u.makeTranslation(e,n,r),this.applyMatrix4($u),this}scale(e,n,r){return $u.makeScale(e,n,r),this.applyMatrix4($u),this}lookAt(e){return H6.lookAt(e),H6.updateMatrix(),this.applyMatrix4(H6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qv).negate(),this.translate(Qv.x,Qv.y,Qv.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 In(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&&Sn("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 Do);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ve(-1/0,-1/0,-1/0),new Ve(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];Qc.setFromBufferAttribute(s),this.morphTargetsRelative?(Ma.addVectors(this.boundingBox.min,Qc.min),this.boundingBox.expandByPoint(Ma),Ma.addVectors(this.boundingBox.max,Qc.max),this.boundingBox.expandByPoint(Ma)):(this.boundingBox.expandByPoint(Qc.min),this.boundingBox.expandByPoint(Qc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Wn('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 Qo);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Wn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Ve,1/0);return}if(e){const r=this.boundingSphere.center;if(Qc.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];g_.setFromBufferAttribute(a),this.morphTargetsRelative?(Ma.addVectors(Qc.min,g_.min),Qc.expandByPoint(Ma),Ma.addVectors(Qc.max,g_.max),Qc.expandByPoint(Ma)):(Qc.expandByPoint(g_.min),Qc.expandByPoint(g_.max))}Qc.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)Ma.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(Ma));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++)Ma.fromBufferAttribute(a,c),l&&(Qv.fromBufferAttribute(e,c),Ma.add(Qv)),i=Math.max(i,r.distanceToSquared(Ma))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Wn('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){Wn("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 $i(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let k=0;k<r.count;k++)a[k]=new Ve,l[k]=new Ve;const c=new Ve,d=new Ve,p=new Ve,m=new Wt,x=new Wt,b=new Wt,_=new Ve,S=new Ve;function M(k,O,F){c.fromBufferAttribute(r,k),d.fromBufferAttribute(r,O),p.fromBufferAttribute(r,F),m.fromBufferAttribute(s,k),x.fromBufferAttribute(s,O),b.fromBufferAttribute(s,F),d.sub(c),p.sub(c),x.sub(m),b.sub(m);const B=1/(x.x*b.y-b.x*x.y);isFinite(B)&&(_.copy(d).multiplyScalar(b.y).addScaledVector(p,-x.y).multiplyScalar(B),S.copy(p).multiplyScalar(x.x).addScaledVector(d,-b.x).multiplyScalar(B),a[k].add(_),a[O].add(_),a[F].add(_),l[k].add(S),l[O].add(S),l[F].add(S))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let k=0,O=C.length;k<O;++k){const F=C[k],B=F.start,Y=F.count;for(let V=B,q=B+Y;V<q;V+=3)M(e.getX(V+0),e.getX(V+1),e.getX(V+2))}const A=new Ve,N=new Ve,D=new Ve,R=new Ve;function L(k){D.fromBufferAttribute(i,k),R.copy(D);const O=a[k];A.copy(O),A.sub(D.multiplyScalar(D.dot(O))).normalize(),N.crossVectors(R,O);const B=N.dot(l[k])<0?-1:1;o.setXYZW(k,A.x,A.y,A.z,B)}for(let k=0,O=C.length;k<O;++k){const F=C[k],B=F.start,Y=F.count;for(let V=B,q=B+Y;V<q;V+=3)L(e.getX(V+0)),L(e.getX(V+1)),L(e.getX(V+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 $i(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 Ve,s=new Ve,o=new Ve,a=new Ve,l=new Ve,c=new Ve,d=new Ve,p=new Ve;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++)Ma.fromBufferAttribute(e,n),Ma.normalize(),e.setXYZ(n,Ma.x,Ma.y,Ma.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 M=0;M<d;M++)m[b++]=c[x++]}return new $i(m,d,p)}if(this.index===null)return Sn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Ar,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 qC{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=GS,this.updateRanges=[],this.version=0,this.uuid=pu()}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=pu()),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=pu()),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 zl=new Ve;class cu{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++)zl.fromBufferAttribute(this,n),zl.applyMatrix4(e),this.setXYZ(n,zl.x,zl.y,zl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)zl.fromBufferAttribute(this,n),zl.applyNormalMatrix(e),this.setXYZ(n,zl.x,zl.y,zl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)zl.fromBufferAttribute(this,n),zl.transformDirection(e),this.setXYZ(n,zl.x,zl.y,zl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Wl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=jr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=jr(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=Wl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Wl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Wl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Wl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=jr(n,this.array),r=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(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){$S("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 $i(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 cu(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){$S("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 h3e=0;class wl extends Mh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:h3e++}),this.uuid=pu(),this.name="",this.type="Material",this.blending=ux,this.side=Cp,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=u5,this.blendDst=d5,this.blendEquation=z0,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Nn(0,0,0),this.blendAlpha=0,this.depthFunc=bx,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gg,this.stencilZFail=Gg,this.stencilZPass=Gg,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){Sn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){Sn(`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!==ux&&(r.blending=this.blending),this.side!==Cp&&(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!==u5&&(r.blendSrc=this.blendSrc),this.blendDst!==d5&&(r.blendDst=this.blendDst),this.blendEquation!==z0&&(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!==bx&&(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!==wR&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Gg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Gg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Gg&&(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 I9 extends wl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Nn(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 Jv;const x_=new Ve,e1=new Ve,t1=new Ve,n1=new Wt,v_=new Wt,KY=new ur,tM=new Ve,y_=new Ve,nM=new Ve,Fj=new Wt,V6=new Wt,Uj=new Wt;class ZY extends _i{constructor(e=new I9){if(super(),this.isSprite=!0,this.type="Sprite",Jv===void 0){Jv=new Ar;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 qC(n,5);Jv.setIndex([0,1,2,0,2,3]),Jv.setAttribute("position",new cu(r,3,0,!1)),Jv.setAttribute("uv",new cu(r,2,3,!1))}this.geometry=Jv,this.material=e,this.center=new Wt(.5,.5),this.count=1}raycast(e,n){e.camera===null&&Wn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),e1.setFromMatrixScale(this.matrixWorld),KY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),t1.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&e1.multiplyScalar(-t1.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;rM(tM.set(-.5,-.5,0),t1,o,e1,i,s),rM(y_.set(.5,-.5,0),t1,o,e1,i,s),rM(nM.set(.5,.5,0),t1,o,e1,i,s),Fj.set(0,0),V6.set(1,0),Uj.set(1,1);let a=e.ray.intersectTriangle(tM,y_,nM,!1,x_);if(a===null&&(rM(y_.set(-.5,.5,0),t1,o,e1,i,s),V6.set(0,1),a=e.ray.intersectTriangle(tM,nM,y_,!1,x_),a===null))return;const l=e.ray.origin.distanceTo(x_);l<e.near||l>e.far||n.push({distance:l,point:x_.clone(),uv:Rc.getInterpolation(x_,tM,y_,nM,Fj,V6,Uj,new Wt),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 rM(t,e,n,r,i,s){n1.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(v_.x=s*n1.x-i*n1.y,v_.y=i*n1.x+s*n1.y):v_.copy(n1),t.copy(e),t.x+=v_.x,t.y+=v_.y,t.applyMatrix4(KY)}const iM=new Ve,Bj=new Ve;class QY 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){iM.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(iM);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){iM.setFromMatrixPosition(e.matrixWorld),Bj.setFromMatrixPosition(this.matrixWorld);const r=iM.distanceTo(Bj)/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 rp=new Ve,G6=new Ve,sM=new Ve,N0=new Ve,W6=new Ve,oM=new Ve,$6=new Ve;class Ux{constructor(e=new Ve,n=new Ve(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,rp)),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=rp.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(rp.copy(this.origin).addScaledVector(this.direction,n),rp.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){G6.copy(e).add(n).multiplyScalar(.5),sM.copy(n).sub(e).normalize(),N0.copy(this.origin).sub(G6);const s=e.distanceTo(n)*.5,o=-this.direction.dot(sM),a=N0.dot(this.direction),l=-N0.dot(sM),c=N0.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(sM,m),x}intersectSphere(e,n){rp.subVectors(e.center,this.origin);const r=rp.dot(this.direction),i=rp.dot(rp)-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,rp)!==null}intersectTriangle(e,n,r,i,s){W6.subVectors(n,e),oM.subVectors(r,e),$6.crossVectors(W6,oM);let o=this.direction.dot($6),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;N0.subVectors(this.origin,e);const l=a*this.direction.dot(oM.crossVectors(N0,oM));if(l<0)return null;const c=a*this.direction.dot(W6.cross(N0));if(c<0||l+c>o)return null;const d=-a*N0.dot($6);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 Dp extends wl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Nn(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 xu,this.combine=Vw,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 Hj=new ur,Cg=new Ux,aM=new Qo,Vj=new Ve,lM=new Ve,cM=new Ve,uM=new Ve,q6=new Ve,dM=new Ve,Gj=new Ve,fM=new Ve;class Hs extends _i{constructor(e=new Ar,n=new Dp){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){dM.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=a[l],p=s[l];d!==0&&(q6.fromBufferAttribute(p,e),o?dM.addScaledVector(q6,d):dM.addScaledVector(q6.sub(n),d))}n.add(dM)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),aM.copy(r.boundingSphere),aM.applyMatrix4(s),Cg.copy(e.ray).recast(e.near),!(aM.containsPoint(Cg.origin)===!1&&(Cg.intersectSphere(aM,Vj)===null||Cg.origin.distanceToSquared(Vj)>(e.far-e.near)**2))&&(Hj.copy(s).invert(),Cg.copy(e.ray).applyMatrix4(Hj),!(r.boundingBox!==null&&Cg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Cg)))}_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],M=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 R=a.getX(N),L=a.getX(N+1),k=a.getX(N+2);i=hM(this,M,e,r,c,d,p,R,L,k),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,M=_;S<M;S+=3){const C=a.getX(S),A=a.getX(S+1),N=a.getX(S+2);i=hM(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],M=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 R=N,L=N+1,k=N+2;i=hM(this,M,e,r,c,d,p,R,L,k),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,M=_;S<M;S+=3){const C=S,A=S+1,N=S+2;i=hM(this,o,e,r,c,d,p,C,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}}}function p3e(t,e,n,r,i,s,o,a){let l;if(e.side===Kl?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===Cp,a),l===null)return null;fM.copy(a),fM.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(fM);return c<n.near||c>n.far?null:{distance:c,point:fM.clone(),object:t}}function hM(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,lM),t.getVertexPosition(l,cM),t.getVertexPosition(c,uM);const d=p3e(t,e,n,r,lM,cM,uM,Gj);if(d){const p=new Ve;Rc.getBarycoord(Gj,lM,cM,uM,p),i&&(d.uv=Rc.getInterpolatedAttribute(i,a,l,c,p,new Wt)),s&&(d.uv1=Rc.getInterpolatedAttribute(s,a,l,c,p,new Wt)),o&&(d.normal=Rc.getInterpolatedAttribute(o,a,l,c,p,new Ve),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new Ve,materialIndex:0};Rc.getNormal(lM,cM,uM,m.normal),d.face=m,d.barycoord=p}return d}const Wj=new Ve,$j=new hi,qj=new hi,m3e=new Ve,Xj=new ur,pM=new Ve,X6=new Qo,Yj=new ur,Y6=new Ux;class JY extends Hs{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=_R,this.bindMatrix=new ur,this.bindMatrixInverse=new ur,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Do),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,pM),this.boundingBox.expandByPoint(pM)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Qo),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,pM),this.boundingSphere.expandByPoint(pM)}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(),X6.copy(this.boundingSphere),X6.applyMatrix4(i),e.ray.intersectsSphere(X6)!==!1&&(Yj.copy(i).invert(),Y6.copy(e.ray).applyMatrix4(Yj),!(this.boundingBox!==null&&Y6.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,Y6)))}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 hi,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===_R?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===RY?this.bindMatrixInverse.copy(this.bindMatrix).invert():Sn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;$j.fromBufferAttribute(i.attributes.skinIndex,e),qj.fromBufferAttribute(i.attributes.skinWeight,e),Wj.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=qj.getComponent(s);if(o!==0){const a=$j.getComponent(s);Xj.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(m3e.copy(Wj).applyMatrix4(Xj),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class O9 extends _i{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ef extends so{constructor(e=null,n=1,r=1,i,s,o,a,l,c=Po,d=Po,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 Kj=new ur,g3e=new ur;class XC{constructor(e=[],n=[]){this.uuid=pu(),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){Sn("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 ur)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new ur;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:g3e;Kj.multiplyMatrices(a,n[s]),Kj.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new XC(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 ef(n,e,e,vl,Yl);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&&(Sn("Skeleton: No bone found with UUID:",s),o=new O9),this.bones.push(o),this.boneInverses.push(new ur().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 wx extends $i{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 r1=new ur,Zj=new ur,mM=[],Qj=new Do,x3e=new ur,b_=new Hs,__=new Qo;class eK extends Hs{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new wx(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,x3e)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Do),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,r1),Qj.copy(e.boundingBox).applyMatrix4(r1),this.boundingBox.union(Qj)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Qo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,r1),__.copy(e.boundingSphere).applyMatrix4(r1),this.boundingSphere.union(__)}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(b_.geometry=this.geometry,b_.material=this.material,b_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),__.copy(this.boundingSphere),__.applyMatrix4(r),e.ray.intersectsSphere(__)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,r1),Zj.multiplyMatrices(r,r1),b_.matrixWorld=Zj,b_.raycast(e,mM);for(let o=0,a=mM.length;o<a;o++){const l=mM[o];l.instanceId=s,l.object=this,n.push(l)}mM.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new wx(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 ef(new Float32Array(i*this.count),i,this.count,jC,Yl));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 K6=new Ve,v3e=new Ve,y3e=new Cr;class lp{constructor(e=new Ve(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=K6.subVectors(r,n).cross(v3e.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(K6),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||y3e.getNormalMatrix(e),i=this.coplanarPoint(K6).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 Eg=new Qo,b3e=new Wt(.5,.5),gM=new Ve;class Xy{constructor(e=new lp,n=new lp,r=new lp,i=new lp,s=new lp,o=new lp){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=lu,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],M=s[11],C=s[12],A=s[13],N=s[14],D=s[15];if(i[0].setComponents(c-o,x-d,M-b,D-C).normalize(),i[1].setComponents(c+o,x+d,M+b,D+C).normalize(),i[2].setComponents(c+a,x+p,M+_,D+A).normalize(),i[3].setComponents(c-a,x-p,M-_,D-A).normalize(),r)i[4].setComponents(l,m,S,N).normalize(),i[5].setComponents(c-l,x-m,M-S,D-N).normalize();else if(i[4].setComponents(c-l,x-m,M-S,D-N).normalize(),n===lu)i[5].setComponents(c+l,x+m,M+S,D+N).normalize();else if(n===Sx)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(),Eg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Eg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Eg)}intersectsSprite(e){Eg.center.set(0,0,0);const n=b3e.distanceTo(e.center);return Eg.radius=.7071067811865476+n,Eg.applyMatrix4(e.matrixWorld),this.intersectsSphere(Eg)}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(gM.x=i.normal.x>0?e.max.x:e.min.x,gM.y=i.normal.y>0?e.max.y:e.min.y,gM.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gM)<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 jf=new ur,zf=new Xy;class YC{constructor(){this.coordinateSystem=lu}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(jf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),zf.setFromProjectionMatrix(jf,i.coordinateSystem,i.reversedDepth),zf.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(jf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),zf.setFromProjectionMatrix(jf,i.coordinateSystem,i.reversedDepth),zf.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(jf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),zf.setFromProjectionMatrix(jf,i.coordinateSystem,i.reversedDepth),zf.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(jf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),zf.setFromProjectionMatrix(jf,i.coordinateSystem,i.reversedDepth),zf.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(jf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),zf.setFromProjectionMatrix(jf,i.coordinateSystem,i.reversedDepth),zf.containsPoint(e))return!0}return!1}clone(){return new YC}}function Z6(t,e){return t-e}function _3e(t,e){return t.z-e.z}function S3e(t,e){return e.z-t.z}class w3e{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 Mc=new ur,M3e=new Nn(1,1,1),Jj=new Xy,T3e=new YC,xM=new Do,Ag=new Qo,S_=new Ve,ez=new Ve,C3e=new Ve,Q6=new w3e,pl=new Hs,vM=[];function E3e(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 Ng(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 tK extends Hs{constructor(e,n,r=n*2,i){super(new Ar,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 ef(n,e,e,vl,Yl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new ef(n,e,e,Gw,hd);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 ef(n,e,e,vl,Yl);r.colorSpace=li.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 $i(d,l,c);n.setAttribute(s,p)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new $i(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 Do);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,Mc),this.getBoundingBoxAt(s,xM).applyMatrix4(Mc),e.union(xM)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Qo);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,Mc),this.getBoundingSphereAt(s,Ag).applyMatrix4(Mc),e.union(Ag)}}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(Z6),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=r):(i=this._instanceInfo.length,this._instanceInfo.push(r));const s=this._matricesTexture;Mc.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(M3e.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(Z6),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);E3e(p,m,l);const x=p.itemSize;for(let b=p.count,_=c;b<_;b++){const S=l+b;for(let M=0;M<x;M++)m.setComponent(S,M,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 Do,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(S_.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 Qo;this.getBoundingBoxAt(e,xM),xM.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)),S_.fromBufferAttribute(a,p),l=Math.max(l,s.center.distanceToSquared(S_))}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(Z6);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);Ng(this._multiDrawCounts,i),Ng(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(),Ng(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),Ng(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),Ng(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 Ar,this._initializeGeometry(s));const o=this.geometry;s.index&&Ng(s.index.array,o.index.array);for(const a in s.attributes)Ng(s.attributes[a].array,o.attributes[a].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;pl.material=this.material,pl.geometry.index=o.index,pl.geometry.attributes=o.attributes,pl.geometry.boundingBox===null&&(pl.geometry.boundingBox=new Do),pl.geometry.boundingSphere===null&&(pl.geometry.boundingSphere=new Qo);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];pl.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(a,pl.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,pl.geometry.boundingBox),this.getBoundingSphereAt(c,pl.geometry.boundingSphere),pl.raycast(e,vM);for(let p=0,m=vM.length;p<m;p++){const x=vM[p];x.object=this,x.batchId=a,n.push(x)}vM.length=0}pl.material=null,pl.geometry.index=null,pl.geometry.attributes={},pl.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?T3e:Jj;x&&!r.isArrayCamera&&(Mc.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),Jj.setFromProjectionMatrix(Mc,r.coordinateSystem,r.reversedDepth));let M=0;if(this.sortObjects){Mc.copy(this.matrixWorld).invert(),S_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(Mc),ez.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(Mc);for(let N=0,D=c.length;N<D;N++)if(c[N].visible&&c[N].active){const R=c[N].geometryIndex;this.getMatrixAt(N,Mc),this.getBoundingSphereAt(R,Ag).applyMatrix4(Mc);let L=!1;if(x&&(L=!S.intersectsSphere(Ag,r)),!L){const k=m[R],O=C3e.subVectors(Ag.center,S_).dot(ez);Q6.push(k.start,k.count,O,N)}}const C=Q6.list,A=this.customSort;A===null?C.sort(s.transparent?S3e:_3e):A.call(this,C,r);for(let N=0,D=C.length;N<D;N++){const R=C[N];d[M]=R.start*a*l,p[M]=R.count*l,_[M]=R.index,M++}Q6.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,Mc),this.getBoundingSphereAt(N,Ag).applyMatrix4(Mc),D=!S.intersectsSphere(Ag,r)),!D){const R=m[N];d[M]=R.start*a*l,p[M]=R.count*l,_[M]=C,M++}}b.needsUpdate=!0,this._multiDrawCount=M,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class Jl extends wl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Nn(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 Q5=new Ve,J5=new Ve,tz=new ur,w_=new Ux,yM=new Qo,J6=new Ve,nz=new Ve;let bm=class extends _i{constructor(e=new Ar,n=new Jl){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++)Q5.fromBufferAttribute(n,i-1),J5.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=Q5.distanceTo(J5);e.setAttribute("lineDistance",new In(r,1))}else Sn("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(),yM.copy(r.boundingSphere),yM.applyMatrix4(i),yM.radius+=s,e.ray.intersectsSphere(yM)===!1)return;tz.copy(i).invert(),w_.copy(e.ray).applyMatrix4(tz);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 M=d.getX(_),C=d.getX(_+1),A=bM(this,e,w_,l,M,C,_);A&&n.push(A)}if(this.isLineLoop){const _=d.getX(b-1),S=d.getX(x),M=bM(this,e,w_,l,_,S,b-1);M&&n.push(M)}}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 M=bM(this,e,w_,l,_,_+1,_);M&&n.push(M)}if(this.isLineLoop){const _=bM(this,e,w_,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 bM(t,e,n,r,i,s,o){const a=t.geometry.attributes.position;if(Q5.fromBufferAttribute(a,i),J5.fromBufferAttribute(a,s),n.distanceSqToSegment(Q5,J5,J6,nz)>r)return;J6.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(J6);if(!(c<e.near||c>e.far))return{distance:c,point:nz.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const rz=new Ve,iz=new Ve;class Th extends bm{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)rz.fromBufferAttribute(n,i),iz.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+rz.distanceTo(iz);e.setAttribute("lineDistance",new In(r,1))}else Sn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class nK extends bm{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class L9 extends wl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Nn(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 sz=new ur,TR=new Ux,_M=new Qo,SM=new Ve;class rK extends _i{constructor(e=new Ar,n=new L9){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(),_M.copy(r.boundingSphere),_M.applyMatrix4(i),_M.radius+=s,e.ray.intersectsSphere(_M)===!1)return;sz.copy(i).invert(),TR.copy(e.ray).applyMatrix4(sz);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);SM.fromBufferAttribute(p,S),oz(SM,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++)SM.fromBufferAttribute(p,b),oz(SM,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 oz(t,e,n,r,i,s,o){const a=TR.distanceSqToPoint(t);if(a<n){const l=new Ve;TR.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 iK extends so{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 A3e extends iK{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 N3e extends so{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Po,this.minFilter=Po,this.generateMipmaps=!1,this.needsUpdate=!0}}class KC extends so{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 k3e extends KC{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Dc,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class R3e extends KC{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,hh),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Ww extends so{constructor(e=[],n=hh,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 P3e extends so{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 wy extends so{constructor(e,n,r=hd,i,s,o,a=Po,l=Po,c,d=mh,p=1){if(d!==mh&&d!==Z0)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 Q0(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 sK extends wy{constructor(e,n=hd,r=hh,i,s,o=Po,a=Po,l,c=mh){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 j9 extends so{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Bx extends Ar{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 In(c,3)),this.setAttribute("normal",new In(d,3)),this.setAttribute("uv",new In(p,2));function b(_,S,M,C,A,N,D,R,L,k,O){const F=N/L,B=D/k,Y=N/2,V=D/2,q=R/2,G=L+1,$=k+1;let Q=0,K=0;const re=new Ve;for(let U=0;U<$;U++){const H=U*B-V;for(let X=0;X<G;X++){const j=X*F-Y;re[_]=j*C,re[S]=H*A,re[M]=q,c.push(re.x,re.y,re.z),re[_]=0,re[S]=0,re[M]=R>0?1:-1,d.push(re.x,re.y,re.z),p.push(X/L),p.push(1-U/k),Q+=1}}for(let U=0;U<k;U++)for(let H=0;H<L;H++){const X=m+H+G*U,j=m+H+G*(U+1),le=m+(H+1)+G*(U+1),se=m+(H+1)+G*U;l.push(X,j,se),l.push(j,le,se),K+=6}a.addGroup(x,K,O),x+=K,m+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bx(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class ZC extends Ar{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 Ve,M=new Ve;for(let C=0;C<=b;C++){let A=0,N=0,D=0,R=0;if(C<=r){const O=C/r,F=O*Math.PI/2;N=-d-e*Math.cos(F),D=e*Math.sin(F),R=-e*Math.cos(F),A=O*p}else if(C<=r+s){const O=(C-r)/s;N=-d+O*n,D=e,R=0,A=p+O*m}else{const O=(C-r-s)/r,F=O*Math.PI/2;N=d+e*Math.sin(F),D=e*Math.cos(F),R=e*Math.sin(F),A=p+m+O*p}const L=Math.max(0,Math.min(1,A/x));let k=0;C===0?k=.5/i:C===b&&(k=-.5/i);for(let O=0;O<=i;O++){const F=O/i,B=F*Math.PI*2,Y=Math.sin(B),V=Math.cos(B);M.x=-D*V,M.y=N,M.z=D*Y,a.push(M.x,M.y,M.z),S.set(-D*V,R,D*Y),S.normalize(),l.push(S.x,S.y,S.z),c.push(F+k,L)}if(C>0){const O=(C-1)*_;for(let F=0;F<i;F++){const B=O+F,Y=O+F+1,V=C*_+F,q=C*_+F+1;o.push(B,Y,V),o.push(Y,q,V)}}}this.setIndex(o),this.setAttribute("position",new In(a,3)),this.setAttribute("normal",new In(l,3)),this.setAttribute("uv",new In(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ZC(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class QC extends Ar{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 Ve,d=new Wt;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 In(o,3)),this.setAttribute("normal",new In(a,3)),this.setAttribute("uv",new In(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new QC(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class $w extends Ar{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 M=0;C(),o===!1&&(e>0&&A(!0),n>0&&A(!1)),this.setIndex(d),this.setAttribute("position",new In(p,3)),this.setAttribute("normal",new In(m,3)),this.setAttribute("uv",new In(x,2));function C(){const N=new Ve,D=new Ve;let R=0;const L=(n-e)/r;for(let k=0;k<=s;k++){const O=[],F=k/s,B=F*(n-e)+e;for(let Y=0;Y<=i;Y++){const V=Y/i,q=V*l+a,G=Math.sin(q),$=Math.cos(q);D.x=B*G,D.y=-F*r+S,D.z=B*$,p.push(D.x,D.y,D.z),N.set(G,L,$).normalize(),m.push(N.x,N.y,N.z),x.push(V,1-F),O.push(b++)}_.push(O)}for(let k=0;k<i;k++)for(let O=0;O<s;O++){const F=_[O][k],B=_[O+1][k],Y=_[O+1][k+1],V=_[O][k+1];(e>0||O!==0)&&(d.push(F,B,V),R+=3),(n>0||O!==s-1)&&(d.push(B,Y,V),R+=3)}c.addGroup(M,R,0),M+=R}function A(N){const D=b,R=new Wt,L=new Ve;let k=0;const O=N===!0?e:n,F=N===!0?1:-1;for(let Y=1;Y<=i;Y++)p.push(0,S*F,0),m.push(0,F,0),x.push(.5,.5),b++;const B=b;for(let Y=0;Y<=i;Y++){const q=Y/i*l+a,G=Math.cos(q),$=Math.sin(q);L.x=O*$,L.y=S*F,L.z=O*G,p.push(L.x,L.y,L.z),m.push(0,F,0),R.x=G*.5+.5,R.y=$*.5*F+.5,x.push(R.x,R.y),b++}for(let Y=0;Y<i;Y++){const V=D+Y,q=B+Y;N===!0?d.push(q,q+1,V):d.push(q+1,q,V),k+=3}c.addGroup(M,k,N===!0?1:2),M+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $w(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class qw extends $w{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 qw(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Om extends Ar{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 In(s,3)),this.setAttribute("normal",new In(s.slice(),3)),this.setAttribute("uv",new In(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(C){const A=new Ve,N=new Ve,D=new Ve;for(let R=0;R<n.length;R+=3)x(n[R+0],A),x(n[R+1],N),x(n[R+2],D),l(A,N,D,C)}function l(C,A,N,D){const R=D+1,L=[];for(let k=0;k<=R;k++){L[k]=[];const O=C.clone().lerp(N,k/R),F=A.clone().lerp(N,k/R),B=R-k;for(let Y=0;Y<=B;Y++)Y===0&&k===R?L[k][Y]=O:L[k][Y]=O.clone().lerp(F,Y/B)}for(let k=0;k<R;k++)for(let O=0;O<2*(R-k)-1;O++){const F=Math.floor(O/2);O%2===0?(m(L[k][F+1]),m(L[k+1][F]),m(L[k][F])):(m(L[k][F+1]),m(L[k+1][F+1]),m(L[k+1][F]))}}function c(C){const A=new Ve;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 Ve;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=M(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],R=Math.max(A,N,D),L=Math.min(A,N,D);R>.9&&L<.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 Ve,A=new Ve,N=new Ve,D=new Ve,R=new Wt,L=new Wt,k=new Wt;for(let O=0,F=0;O<s.length;O+=9,F+=6){C.set(s[O+0],s[O+1],s[O+2]),A.set(s[O+3],s[O+4],s[O+5]),N.set(s[O+6],s[O+7],s[O+8]),R.set(o[F+0],o[F+1]),L.set(o[F+2],o[F+3]),k.set(o[F+4],o[F+5]),D.copy(C).add(A).add(N).divideScalar(3);const B=S(D);_(R,F+0,C,B),_(L,F+2,A,B),_(k,F+4,N,B)}}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 M(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 Om(e.vertices,e.indices,e.radius,e.detail)}}class JC extends Om{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 JC(e.radius,e.detail)}}const wM=new Ve,MM=new Ve,eN=new Ve,TM=new Rc;class z9 extends Ar{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(dx*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:M}=TM;if(_.fromBufferAttribute(a,c[0]),S.fromBufferAttribute(a,c[1]),M.fromBufferAttribute(a,c[2]),TM.getNormal(eN),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(M.x*i)},${Math.round(M.y*i)},${Math.round(M.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],R=TM[d[C]],L=TM[d[A]],k=`${N}_${D}`,O=`${D}_${N}`;O in m&&m[O]?(eN.dot(m[O].normal)<=s&&(x.push(R.x,R.y,R.z),x.push(L.x,L.y,L.z)),m[O]=null):k in m||(m[k]={index0:c[C],index1:c[A],normal:eN.clone()})}}for(const b in m)if(m[b]){const{index0:_,index1:S}=m[b];wM.fromBufferAttribute(a,_),MM.fromBufferAttribute(a,S),x.push(wM.x,wM.y,wM.z),x.push(MM.x,MM.y,MM.z)}this.setAttribute("position",new In(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class lf{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Sn("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 Wt:new Ve);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 Ve,i=[],s=[],o=[],a=new Ve,l=new ur;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new Ve)}s[0]=new Ve,o[0]=new Ve;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(fr(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(fr(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 eE extends lf{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 Wt){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 oK extends eE{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function F9(){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 CM=new Ve,tN=new F9,nN=new F9,rN=new F9;class aK extends lf{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 Ve){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]:(CM.subVectors(i[0],i[1]).add(i[0]),c=CM);const p=i[a%s],m=i[(a+1)%s];if(this.closed||a+2<s?d=i[(a+2)%s]:(CM.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=CM),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=_),tN.initNonuniformCatmullRom(c.x,p.x,m.x,d.x,b,_,S),nN.initNonuniformCatmullRom(c.y,p.y,m.y,d.y,b,_,S),rN.initNonuniformCatmullRom(c.z,p.z,m.z,d.z,b,_,S)}else this.curveType==="catmullrom"&&(tN.initCatmullRom(c.x,p.x,m.x,d.x,this.tension),nN.initCatmullRom(c.y,p.y,m.y,d.y,this.tension),rN.initCatmullRom(c.z,p.z,m.z,d.z,this.tension));return r.set(tN.calc(l),nN.calc(l),rN.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 Ve().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function az(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 D3e(t,e){const n=1-t;return n*n*e}function I3e(t,e){return 2*(1-t)*t*e}function O3e(t,e){return t*t*e}function cS(t,e,n,r){return D3e(t,e)+I3e(t,n)+O3e(t,r)}function L3e(t,e){const n=1-t;return n*n*n*e}function j3e(t,e){const n=1-t;return 3*n*n*t*e}function z3e(t,e){return 3*(1-t)*t*t*e}function F3e(t,e){return t*t*t*e}function uS(t,e,n,r,i){return L3e(t,e)+j3e(t,n)+z3e(t,r)+F3e(t,i)}class U9 extends lf{constructor(e=new Wt,n=new Wt,r=new Wt,i=new Wt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Wt){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(uS(e,i.x,s.x,o.x,a.x),uS(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 lK extends lf{constructor(e=new Ve,n=new Ve,r=new Ve,i=new Ve){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Ve){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(uS(e,i.x,s.x,o.x,a.x),uS(e,i.y,s.y,o.y,a.y),uS(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 lf{constructor(e=new Wt,n=new Wt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Wt){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 Wt){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 cK extends lf{constructor(e=new Ve,n=new Ve){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new Ve){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 Ve){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 H9 extends lf{constructor(e=new Wt,n=new Wt,r=new Wt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Wt){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(cS(e,i.x,s.x,o.x),cS(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 V9 extends lf{constructor(e=new Ve,n=new Ve,r=new Ve){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Ve){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(cS(e,i.x,s.x,o.x),cS(e,i.y,s.y,o.y),cS(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 G9 extends lf{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Wt){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(az(a,l.x,c.x,d.x,p.x),az(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 Wt().fromArray(i))}return this}}var eT=Object.freeze({__proto__:null,ArcCurve:oK,CatmullRomCurve3:aK,CubicBezierCurve:U9,CubicBezierCurve3:lK,EllipseCurve:eE,LineCurve:B9,LineCurve3:cK,QuadraticBezierCurve:H9,QuadraticBezierCurve3:V9,SplineCurve:G9});class uK extends lf{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 eT[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 eT[i.type]().fromJSON(i))}return this}}class tT extends uK{constructor(e){super(),this.type="Path",this.currentPoint=new Wt,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 Wt(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new H9(this.currentPoint.clone(),new Wt(e,n),new Wt(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new U9(this.currentPoint.clone(),new Wt(e,n),new Wt(r,i),new Wt(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new G9(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 eE(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 nm extends tT{constructor(e){super(e),this.uuid=pu(),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 tT().fromJSON(i))}return this}}function U3e(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=dK(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=W3e(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 XS(s,o,n,a,l,c,0),o}function dK(t,e,n,r,i){let s;if(i===n4e(t,e,n,r)>0)for(let o=e;o<n;o+=r)s=lz(o/r|0,t[o],t[o+1],s);else for(let o=n-r;o>=e;o-=r)s=lz(o/r|0,t[o],t[o+1],s);return s&&My(s,s.next)&&(KS(s),s=s.next),s}function Mx(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(My(n,n.next)||ro(n.prev,n,n.next)===0)){if(KS(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function XS(t,e,n,r,i,s,o){if(!t)return;!o&&s&&K3e(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?H3e(t,r,i,s):B3e(t)){e.push(l.i,t.i,c.i),KS(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=V3e(Mx(t),e),XS(t,e,n,r,i,s,2)):o===2&&G3e(t,e,n,r,i,s):XS(Mx(t),e,n,r,i,s,1);break}}}function B3e(t){const e=t.prev,n=t,r=t.next;if(ro(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&&F_(i,a,s,l,o,c,b.x,b.y)&&ro(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function H3e(t,e,n,r){const i=t.prev,s=t,o=t.next;if(ro(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),M=CR(x,b,e,n,r),C=CR(_,S,e,n,r);let A=t.prevZ,N=t.nextZ;for(;A&&A.z>=M&&N&&N.z<=C;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&F_(a,d,l,p,c,m,A.x,A.y)&&ro(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&F_(a,d,l,p,c,m,N.x,N.y)&&ro(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;A&&A.z>=M;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&F_(a,d,l,p,c,m,A.x,A.y)&&ro(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&&F_(a,d,l,p,c,m,N.x,N.y)&&ro(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function V3e(t,e){let n=t;do{const r=n.prev,i=n.next.next;!My(r,i)&&hK(r,n,n.next,i)&&YS(r,i)&&YS(i,r)&&(e.push(r.i,n.i,i.i),KS(n),KS(n.next),n=t=i),n=n.next}while(n!==t);return Mx(n)}function G3e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&J3e(o,a)){let l=pK(o,a);o=Mx(o,o.next),l=Mx(l,l.next),XS(o,e,n,r,i,s,0),XS(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function W3e(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=dK(t,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(Q3e(c))}i.sort($3e);for(let s=0;s<i.length;s++)n=q3e(i[s],n);return n}function $3e(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 q3e(t,e){const n=X3e(t,e);if(!n)return e;const r=pK(n,t);return Mx(r,r.next),Mx(n,n.next)}function X3e(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,o;if(My(t,n))return n;do{if(My(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&&fK(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);YS(n,t)&&(p<d||p===d&&(n.x>o.x||n.x===o.x&&Y3e(o,n)))&&(o=n,d=p)}n=n.next}while(n!==a);return o}function Y3e(t,e){return ro(t.prev,t,e.prev)<0&&ro(e.next,t,t.next)<0}function K3e(t,e,n,r){let i=t;do i.z===0&&(i.z=CR(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,Z3e(i)}function Z3e(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 CR(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 Q3e(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 fK(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 F_(t,e,n,r,i,s,o,a){return!(t===o&&e===a)&&fK(t,e,n,r,i,s,o,a)}function J3e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!e4e(t,e)&&(YS(t,e)&&YS(e,t)&&t4e(t,e)&&(ro(t.prev,t,e.prev)||ro(t,e.prev,e))||My(t,e)&&ro(t.prev,t,t.next)>0&&ro(e.prev,e,e.next)>0)}function ro(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function My(t,e){return t.x===e.x&&t.y===e.y}function hK(t,e,n,r){const i=AM(ro(t,e,n)),s=AM(ro(t,e,r)),o=AM(ro(n,r,t)),a=AM(ro(n,r,e));return!!(i!==s&&o!==a||i===0&&EM(t,n,e)||s===0&&EM(t,r,e)||o===0&&EM(n,t,r)||a===0&&EM(n,e,r))}function EM(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 AM(t){return t>0?1:t<0?-1:0}function e4e(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&&hK(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function YS(t,e){return ro(t.prev,t,t.next)<0?ro(t,e,t.next)>=0&&ro(t,t.prev,e)>=0:ro(t,e,t.prev)<0||ro(t,t.next,e)<0}function t4e(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 pK(t,e){const n=ER(t.i,t.x,t.y),r=ER(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 lz(t,e,n,r){const i=ER(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 KS(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 ER(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function n4e(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 r4e{static triangulate(e,n,r=2){return U3e(e,n,r)}}class Jd{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 Jd.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];cz(e),uz(r,e);let o=e.length;n.forEach(cz);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,uz(r,n[l]);const a=r4e.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function cz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function uz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class tE extends Ar{constructor(e=new nm([new Wt(.5,.5),new Wt(-.5,.5),new Wt(-.5,-.5),new Wt(.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 In(i,3)),this.setAttribute("uv",new In(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 M=n.extrudePath,C=n.UVGenerator!==void 0?n.UVGenerator:i4e;let A,N=!1,D,R,L,k;if(M){A=M.getSpacedPoints(d),N=!0,m=!1;const fe=M.isCatmullRomCurve3?M.closed:!1;D=M.computeFrenetFrames(d,fe),R=new Ve,L=new Ve,k=new Ve}m||(S=0,x=0,b=0,_=0);const O=a.extractPoints(c);let F=O.shape;const B=O.holes;if(!Jd.isClockWise(F)){F=F.reverse();for(let fe=0,Se=B.length;fe<Se;fe++){const me=B[fe];Jd.isClockWise(me)&&(B[fe]=me.reverse())}}function V(fe){const me=10000000000000001e-36;let Pe=fe[0];for(let ce=1;ce<=fe.length;ce++){const He=ce%fe.length,Be=fe[He],Ge=Be.x-Pe.x,We=Be.y-Pe.y,ae=Ge*Ge+We*We,Z=Math.max(Math.abs(Be.x),Math.abs(Be.y),Math.abs(Pe.x),Math.abs(Pe.y)),he=me*Z*Z;if(ae<=he){fe.splice(He,1),ce--;continue}Pe=Be}}V(F),B.forEach(V);const q=B.length,G=F;for(let fe=0;fe<q;fe++){const Se=B[fe];F=F.concat(Se)}function $(fe,Se,me){return Se||Wn("ExtrudeGeometry: vec does not exist"),fe.clone().addScaledVector(Se,me)}const Q=F.length;function K(fe,Se,me){let Pe,ce,He;const Be=fe.x-Se.x,Ge=fe.y-Se.y,We=me.x-fe.x,ae=me.y-fe.y,Z=Be*Be+Ge*Ge,he=Be*ae-Ge*We;if(Math.abs(he)>Number.EPSILON){const be=Math.sqrt(Z),we=Math.sqrt(We*We+ae*ae),ve=Se.x-Ge/be,Re=Se.y+Be/be,Ae=me.x-ae/we,Oe=me.y+We/we,qe=((Ae-ve)*ae-(Oe-Re)*We)/(Be*ae-Ge*We);Pe=ve+Be*qe-fe.x,ce=Re+Ge*qe-fe.y;const Fe=Pe*Pe+ce*ce;if(Fe<=2)return new Wt(Pe,ce);He=Math.sqrt(Fe/2)}else{let be=!1;Be>Number.EPSILON?We>Number.EPSILON&&(be=!0):Be<-Number.EPSILON?We<-Number.EPSILON&&(be=!0):Math.sign(Ge)===Math.sign(ae)&&(be=!0),be?(Pe=-Ge,ce=Be,He=Math.sqrt(Z)):(Pe=Be,ce=Ge,He=Math.sqrt(Z/2))}return new Wt(Pe/He,ce/He)}const re=[];for(let fe=0,Se=G.length,me=Se-1,Pe=fe+1;fe<Se;fe++,me++,Pe++)me===Se&&(me=0),Pe===Se&&(Pe=0),re[fe]=K(G[fe],G[me],G[Pe]);const U=[];let H,X=re.concat();for(let fe=0,Se=q;fe<Se;fe++){const me=B[fe];H=[];for(let Pe=0,ce=me.length,He=ce-1,Be=Pe+1;Pe<ce;Pe++,He++,Be++)He===ce&&(He=0),Be===ce&&(Be=0),H[Pe]=K(me[Pe],me[He],me[Be]);U.push(H),X=X.concat(H)}let j;if(S===0)j=Jd.triangulateShape(G,B);else{const fe=[],Se=[];for(let me=0;me<S;me++){const Pe=me/S,ce=x*Math.cos(Pe*Math.PI/2),He=b*Math.sin(Pe*Math.PI/2)+_;for(let Be=0,Ge=G.length;Be<Ge;Be++){const We=$(G[Be],re[Be],He);oe(We.x,We.y,-ce),Pe===0&&fe.push(We)}for(let Be=0,Ge=q;Be<Ge;Be++){const We=B[Be];H=U[Be];const ae=[];for(let Z=0,he=We.length;Z<he;Z++){const be=$(We[Z],H[Z],He);oe(be.x,be.y,-ce),Pe===0&&ae.push(be)}Pe===0&&Se.push(ae)}}j=Jd.triangulateShape(fe,Se)}const le=j.length,se=b+_;for(let fe=0;fe<Q;fe++){const Se=m?$(F[fe],X[fe],se):F[fe];N?(L.copy(D.normals[0]).multiplyScalar(Se.x),R.copy(D.binormals[0]).multiplyScalar(Se.y),k.copy(A[0]).add(L).add(R),oe(k.x,k.y,k.z)):oe(Se.x,Se.y,0)}for(let fe=1;fe<=d;fe++)for(let Se=0;Se<Q;Se++){const me=m?$(F[Se],X[Se],se):F[Se];N?(L.copy(D.normals[fe]).multiplyScalar(me.x),R.copy(D.binormals[fe]).multiplyScalar(me.y),k.copy(A[fe]).add(L).add(R),oe(k.x,k.y,k.z)):oe(me.x,me.y,p/d*fe)}for(let fe=S-1;fe>=0;fe--){const Se=fe/S,me=x*Math.cos(Se*Math.PI/2),Pe=b*Math.sin(Se*Math.PI/2)+_;for(let ce=0,He=G.length;ce<He;ce++){const Be=$(G[ce],re[ce],Pe);oe(Be.x,Be.y,p+me)}for(let ce=0,He=B.length;ce<He;ce++){const Be=B[ce];H=U[ce];for(let Ge=0,We=Be.length;Ge<We;Ge++){const ae=$(Be[Ge],H[Ge],Pe);N?oe(ae.x,ae.y+A[d-1].y,A[d-1].x+me):oe(ae.x,ae.y,p+me)}}}J(),ee();function J(){const fe=i.length/3;if(m){let Se=0,me=Q*Se;for(let Pe=0;Pe<le;Pe++){const ce=j[Pe];de(ce[2]+me,ce[1]+me,ce[0]+me)}Se=d+S*2,me=Q*Se;for(let Pe=0;Pe<le;Pe++){const ce=j[Pe];de(ce[0]+me,ce[1]+me,ce[2]+me)}}else{for(let Se=0;Se<le;Se++){const me=j[Se];de(me[2],me[1],me[0])}for(let Se=0;Se<le;Se++){const me=j[Se];de(me[0]+Q*d,me[1]+Q*d,me[2]+Q*d)}}r.addGroup(fe,i.length/3-fe,0)}function ee(){const fe=i.length/3;let Se=0;ie(G,Se),Se+=G.length;for(let me=0,Pe=B.length;me<Pe;me++){const ce=B[me];ie(ce,Se),Se+=ce.length}r.addGroup(fe,i.length/3-fe,1)}function ie(fe,Se){let me=fe.length;for(;--me>=0;){const Pe=me;let ce=me-1;ce<0&&(ce=fe.length-1);for(let He=0,Be=d+S*2;He<Be;He++){const Ge=Q*He,We=Q*(He+1),ae=Se+Pe+Ge,Z=Se+ce+Ge,he=Se+ce+We,be=Se+Pe+We;ye(ae,Z,he,be)}}}function oe(fe,Se,me){l.push(fe),l.push(Se),l.push(me)}function de(fe,Se,me){ge(fe),ge(Se),ge(me);const Pe=i.length/3,ce=C.generateTopUV(r,i,Pe-3,Pe-2,Pe-1);Me(ce[0]),Me(ce[1]),Me(ce[2])}function ye(fe,Se,me,Pe){ge(fe),ge(Se),ge(Pe),ge(Se),ge(me),ge(Pe);const ce=i.length/3,He=C.generateSideWallUV(r,i,ce-6,ce-3,ce-2,ce-1);Me(He[0]),Me(He[1]),Me(He[3]),Me(He[1]),Me(He[2]),Me(He[3])}function ge(fe){i.push(l[fe*3+0]),i.push(l[fe*3+1]),i.push(l[fe*3+2])}function Me(fe){s.push(fe.x),s.push(fe.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 s4e(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 eT[i.type]().fromJSON(i)),new tE(r,e.options)}}const i4e={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 Wt(s,o),new Wt(a,l),new Wt(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],M=e[s*3+2];return Math.abs(a-d)<Math.abs(o-c)?[new Wt(o,1-l),new Wt(c,1-p),new Wt(m,1-b),new Wt(_,1-M)]:[new Wt(a,1-l),new Wt(d,1-p),new Wt(x,1-b),new Wt(S,1-M)]}};function s4e(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 nE extends Om{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 nE(e.radius,e.detail)}}class rE extends Ar{constructor(e=[new Wt(0,-.5),new Wt(.5,0),new Wt(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=fr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,p=new Ve,m=new Wt,x=new Ve,b=new Ve,_=new Ve;let S=0,M=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:S=e[C+1].x-e[C].x,M=e[C+1].y-e[C].y,x.x=M*1,x.y=-S,x.z=M*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,M=e[C+1].y-e[C].y,x.x=M*1,x.y=-S,x.z=M*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 R=0;R<=e.length-1;R++){p.x=e[R].x*N,p.y=e[R].y,p.z=e[R].x*D,o.push(p.x,p.y,p.z),m.x=C/n,m.y=R/(e.length-1),a.push(m.x,m.y);const L=l[3*R+0]*N,k=l[3*R+1],O=l[3*R+0]*D;c.push(L,k,O)}}for(let C=0;C<n;C++)for(let A=0;A<e.length-1;A++){const N=A+C*e.length,D=N,R=N+e.length,L=N+e.length+1,k=N+1;s.push(D,R,k),s.push(L,k,R)}this.setIndex(s),this.setAttribute("position",new In(o,3)),this.setAttribute("uv",new In(a,2)),this.setAttribute("normal",new In(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rE(e.points,e.segments,e.phiStart,e.phiLength)}}class Xw extends Om{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 Xw(e.radius,e.detail)}}class Ip extends Ar{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 M=0;M<d;M++){const C=M*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-M/l)}}for(let M=0;M<l;M++)for(let C=0;C<a;C++){const A=C+c*M,N=C+c*(M+1),D=C+1+c*(M+1),R=C+1+c*M;x.push(A,N,R),x.push(N,D,R)}this.setIndex(x),this.setAttribute("position",new In(b,3)),this.setAttribute("normal",new In(_,3)),this.setAttribute("uv",new In(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ip(e.width,e.height,e.widthSegments,e.heightSegments)}}class iE extends Ar{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 Ve,b=new Wt;for(let _=0;_<=i;_++){for(let S=0;S<=r;S++){const M=s+S/r*o;x.x=p*Math.cos(M),x.y=p*Math.sin(M),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 M=0;M<r;M++){const C=M+S,A=C,N=C+r+1,D=C+r+2,R=C+1;a.push(A,N,R),a.push(N,D,R)}}this.setIndex(a),this.setAttribute("position",new In(l,3)),this.setAttribute("normal",new In(c,3)),this.setAttribute("uv",new In(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class sE extends Ar{constructor(e=new nm([new Wt(0,.5),new Wt(-.5,-.5),new Wt(.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 In(i,3)),this.setAttribute("normal",new In(s,3)),this.setAttribute("uv",new In(o,2));function c(d){const p=i.length/3,m=d.extractPoints(n);let x=m.shape;const b=m.holes;Jd.isClockWise(x)===!1&&(x=x.reverse());for(let S=0,M=b.length;S<M;S++){const C=b[S];Jd.isClockWise(C)===!0&&(b[S]=C.reverse())}const _=Jd.triangulateShape(x,b);for(let S=0,M=b.length;S<M;S++){const C=b[S];x=x.concat(C)}for(let S=0,M=x.length;S<M;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,M=_.length;S<M;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 o4e(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 sE(r,e.curveSegments)}}function o4e(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 Yw extends Ar{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 Ve,m=new Ve,x=[],b=[],_=[],S=[];for(let M=0;M<=r;M++){const C=[],A=M/r;let N=0;M===0&&o===0?N=.5/n:M===r&&l===Math.PI&&(N=-.5/n);for(let D=0;D<=n;D++){const R=D/n;p.x=-e*Math.cos(i+R*s)*Math.sin(o+A*a),p.y=e*Math.cos(o+A*a),p.z=e*Math.sin(i+R*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(R+N,1-A),C.push(c++)}d.push(C)}for(let M=0;M<r;M++)for(let C=0;C<n;C++){const A=d[M][C+1],N=d[M][C],D=d[M+1][C],R=d[M+1][C+1];(M!==0||o>0)&&x.push(A,N,R),(M!==r-1||l<Math.PI)&&x.push(N,D,R)}this.setIndex(x),this.setAttribute("position",new In(b,3)),this.setAttribute("normal",new In(_,3)),this.setAttribute("uv",new In(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class oE extends Om{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 oE(e.radius,e.detail)}}class aE extends Ar{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 Ve,x=new Ve,b=new Ve;for(let _=0;_<=r;_++){const S=o+_/r*a;for(let M=0;M<=i;M++){const C=M/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(M/i),p.push(_/r)}}for(let _=1;_<=r;_++)for(let S=1;S<=i;S++){const M=(i+1)*_+S-1,C=(i+1)*(_-1)+S-1,A=(i+1)*(_-1)+S,N=(i+1)*_+S;l.push(M,C,N),l.push(C,A,N)}this.setIndex(l),this.setAttribute("position",new In(c,3)),this.setAttribute("normal",new In(d,3)),this.setAttribute("uv",new In(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class lE extends Ar{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 Ve,m=new Ve,x=new Ve,b=new Ve,_=new Ve,S=new Ve,M=new Ve;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),M.addVectors(b,x),_.crossVectors(S,M),M.crossVectors(_,S),_.normalize(),M.normalize();for(let D=0;D<=i;++D){const R=D/i*Math.PI*2,L=-n*Math.cos(R),k=n*Math.sin(R);p.x=x.x+(L*M.x+k*_.x),p.y=x.y+(L*M.y+k*_.y),p.z=x.z+(L*M.z+k*_.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),R=(i+1)*A+(N-1),L=(i+1)*A+N,k=(i+1)*(A-1)+N;a.push(D,R,k),a.push(R,L,k)}this.setIndex(a),this.setAttribute("position",new In(l,3)),this.setAttribute("normal",new In(c,3)),this.setAttribute("uv",new In(d,2));function C(A,N,D,R,L){const k=Math.cos(A),O=Math.sin(A),F=D/N*A,B=Math.cos(F);L.x=R*(2+B)*.5*k,L.y=R*(2+B)*O*.5,L.z=R*Math.sin(F)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lE(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class cE extends Ar{constructor(e=new V9(new Ve(-1,-1,0),new Ve(-1,1,0),new Ve(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 Ve,l=new Ve,c=new Wt;let d=new Ve;const p=[],m=[],x=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new In(p,3)),this.setAttribute("normal",new In(m,3)),this.setAttribute("uv",new In(x,2));function _(){for(let A=0;A<n;A++)S(A);S(s===!1?n:0),C(),M()}function S(A){d=e.getPointAt(A/n,d);const N=o.normals[A],D=o.binormals[A];for(let R=0;R<=i;R++){const L=R/i*Math.PI*2,k=Math.sin(L),O=-Math.cos(L);l.x=O*N.x+k*D.x,l.y=O*N.y+k*D.y,l.z=O*N.z+k*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 M(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),R=(i+1)*A+(N-1),L=(i+1)*A+N,k=(i+1)*(A-1)+N;b.push(D,R,k),b.push(R,L,k)}}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 cE(new eT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class W9 extends Ar{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new Ve,s=new Ve;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 M=a.getX(b+S),C=a.getX(b+(S+1)%3);i.fromBufferAttribute(o,M),s.fromBufferAttribute(o,C),dz(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),dz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new In(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function dz(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 fz=Object.freeze({__proto__:null,BoxGeometry:Bx,CapsuleGeometry:ZC,CircleGeometry:QC,ConeGeometry:qw,CylinderGeometry:$w,DodecahedronGeometry:JC,EdgesGeometry:z9,ExtrudeGeometry:tE,IcosahedronGeometry:nE,LatheGeometry:rE,OctahedronGeometry:Xw,PlaneGeometry:Ip,PolyhedronGeometry:Om,RingGeometry:iE,ShapeGeometry:sE,SphereGeometry:Yw,TetrahedronGeometry:oE,TorusGeometry:aE,TorusKnotGeometry:lE,TubeGeometry:cE,WireframeGeometry:W9});class mK extends wl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Nn(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 Ty(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?(Sn("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 Ul(t){const e={};for(let n=0;n<t.length;n++){const r=Ty(t[n]);for(const i in r)e[i]=r[i]}return e}function a4e(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function gK(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:li.workingColorSpace}const ZS={clone:Ty,merge:Ul};var l4e=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,c4e=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class vu extends wl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=l4e,this.fragmentShader=c4e,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=Ty(e.uniforms),this.uniformsGroups=a4e(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 $9 extends vu{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class q9 extends wl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Nn(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 Nn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(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 xu,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 xK extends q9{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 Wt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return fr(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 Nn(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 Nn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Nn(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 vK extends wl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Nn(16777215),this.specular=new Nn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Nn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xu,this.combine=Vw,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 yK extends wl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Nn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Nn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(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 bK extends wl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(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 _K extends wl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Nn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Nn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xu,this.combine=Vw,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 uE extends wl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=OY,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 dE extends wl{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 SK extends wl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Nn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Im,this.normalScale=new Wt(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 wK extends Jl{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 Qg(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function MK(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 AR(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 X9(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 u4e(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=Qg(p,c.times.constructor),c.values=Qg(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 d4e(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(M){return M.name===a.name&&M.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 M=d,C=p-d;_=a.values.slice(M,C)}else if(s>=a.times[b]){const M=b*p+d,C=M+p-d;_=a.values.slice(M,C)}else{const M=a.createInterpolant(),C=d,A=p-d;M.evaluate(s),_=M.resultBuffer.slice(C,A)}l==="quaternion"&&new Ya().fromArray(_).normalize().conjugate().toArray(_);const S=c.times.length;for(let M=0;M<S;++M){const C=M*x+m;if(l==="quaternion")Ya.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 f4e{static convertArray(e,n){return Qg(e,n)}static isTypedArray(e){return GY(e)}static getKeyframeOrder(e){return MK(e)}static sortedArray(e,n,r){return AR(e,n,r)}static flattenJSON(e,n,r,i){X9(e,n,r,i)}static subclip(e,n,r,i,s=30){return u4e(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return d4e(e,n,r,i)}}class Yy{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 TK extends Yy{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:Kg,endingEnd:Kg}}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 Zg:s=e,a=2*n-r;break;case HS: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 Zg:o=e,l=2*r-n;break;case HS: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,M=-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]=M*o[d+D]+C*o[c+D]+A*o[l+D]+N*o[p+D];return s}}class Y9 extends Yy{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 CK extends Yy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class EK extends Yy{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 M=0;M!==a;++M)s[M]=o[c+M]*S+o[l+M]*_;return s}const x=a*2,b=e-1;for(let _=0;_!==a;++_){const S=o[c+_],M=o[l+_],C=b*x+_*2,A=m[C],N=m[C+1],D=e*x+_*2,R=p[D],L=p[D+1];let k=(r-n)/(i-n),O,F,B,Y,V;for(let q=0;q<8;q++){O=k*k,F=O*k,B=1-k,Y=B*B,V=Y*B;const $=V*n+3*Y*k*A+3*B*O*R+F*i-r;if(Math.abs($)<1e-10)break;const Q=3*Y*(A-n)+6*B*k*(R-A)+3*O*(i-R);if(Math.abs(Q)<1e-10)break;k=k-$/Q,k=Math.max(0,Math.min(1,k))}s[_]=V*S+3*Y*k*N+3*B*O*L+F*M}return s}}class xd{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=Qg(n,this.TimeBufferType),this.values=Qg(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:Qg(e.times,Array),values:Qg(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new CK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Y9(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new TK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new EK(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case BS:n=this.InterpolantFactoryMethodDiscrete;break;case Z5:n=this.InterpolantFactoryMethodLinear;break;case d2:n=this.InterpolantFactoryMethodSmooth;break;case SR: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 Sn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return BS;case this.InterpolantFactoryMethodLinear:return Z5;case this.InterpolantFactoryMethodSmooth:return d2;case this.InterpolantFactoryMethodBezier:return SR}}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&&(Wn("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(Wn("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)){Wn("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Wn("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&GY(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){Wn("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()===d2,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}}xd.prototype.ValueTypeName="";xd.prototype.TimeBufferType=Float32Array;xd.prototype.ValueBufferType=Float32Array;xd.prototype.DefaultInterpolation=Z5;class Hx extends xd{constructor(e,n,r){super(e,n,r)}}Hx.prototype.ValueTypeName="bool";Hx.prototype.ValueBufferType=Array;Hx.prototype.DefaultInterpolation=BS;Hx.prototype.InterpolantFactoryMethodLinear=void 0;Hx.prototype.InterpolantFactoryMethodSmooth=void 0;class K9 extends xd{constructor(e,n,r,i){super(e,n,r,i)}}K9.prototype.ValueTypeName="color";class QS extends xd{constructor(e,n,r,i){super(e,n,r,i)}}QS.prototype.ValueTypeName="number";class AK extends Yy{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)Ya.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Kw extends xd{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new AK(this.times,this.values,this.getValueSize(),e)}}Kw.prototype.ValueTypeName="quaternion";Kw.prototype.InterpolantFactoryMethodSmooth=void 0;class Vx extends xd{constructor(e,n,r){super(e,n,r)}}Vx.prototype.ValueTypeName="string";Vx.prototype.ValueBufferType=Array;Vx.prototype.DefaultInterpolation=BS;Vx.prototype.InterpolantFactoryMethodLinear=void 0;Vx.prototype.InterpolantFactoryMethodSmooth=void 0;class JS extends xd{constructor(e,n,r,i){super(e,n,r,i)}}JS.prototype.ValueTypeName="vector";class ew{constructor(e="",n=-1,r=[],i=UC){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=pu(),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(p4e(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(xd.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=MK(l);l=AR(l,1,d),c=AR(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new QS(".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(Sn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Wn("AnimationClip: No animation in JSONLoader data."),null;const r=function(p,m,x,b,_){if(x.length!==0){const S=[],M=[];X9(x,S,M,b),S.length!==0&&_.push(new p(m,S,M))}},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=[],M=[];for(let C=0;C!==m[b].morphTargets.length;++C){const A=m[b];S.push(A.time),M.push(A.morphTarget===_?1:0)}i.push(new QS(".morphTargetInfluence["+_+"]",S,M))}l=x.length*o}else{const x=".bones["+n[p].name+"]";r(JS,x+".position",m,"pos",i),r(Kw,x+".quaternion",m,"rot",i),r(JS,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 h4e(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return QS;case"vector":case"vector2":case"vector3":case"vector4":return JS;case"color":return K9;case"quaternion":return Kw;case"bool":case"boolean":return Hx;case"string":return Vx}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function p4e(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=h4e(t.type);if(t.times===void 0){const n=[],r=[];X9(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 ih={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(hz(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!hz(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function hz(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Z9{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 NK=new Z9;class Uc{constructor(e){this.manager=e!==void 0?e:NK,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}}Uc.DEFAULT_MATERIAL_NAME="__DEFAULT";const ip={};class m4e extends Error{constructor(e,n){super(e),this.response=n}}class Ep extends Uc{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=ih.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(ip[e]!==void 0){ip[e].push({onLoad:n,onProgress:r,onError:i});return}ip[e]=[],ip[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&&Sn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=ip[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(M){C();function C(){p.read().then(({done:A,value:N})=>{if(A)M.close();else{_+=N.byteLength;const D=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:x});for(let R=0,L=d.length;R<L;R++){const k=d[R];k.onProgress&&k.onProgress(D)}M.enqueue(N),C()}},A=>{M.error(A)})}}});return new Response(S)}else throw new m4e(`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=>{ih.add(`file:${e}`,c);const d=ip[e];delete ip[e];for(let p=0,m=d.length;p<m;p++){const x=d[p];x.onLoad&&x.onLoad(c)}}).catch(c=>{const d=ip[e];if(d===void 0)throw this.manager.itemError(e),c;delete ip[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 g4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ep(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):Wn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=ew.parse(e[r]);n.push(i)}return n}}class x4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new KC,l=new Ep(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 i1=new WeakMap;class tw extends Uc{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=ih.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=i1.get(o);p===void 0&&(p=[],i1.set(o,p)),p.push({onLoad:n,onError:i})}return o}const a=WS("img");function l(){d(),n&&n(this);const p=i1.get(this)||[];for(let m=0;m<p.length;m++){const x=p[m];x.onLoad&&x.onLoad(this)}i1.delete(this),s.manager.itemEnd(e)}function c(p){d(),i&&i(p),ih.remove(`image:${e}`);const m=i1.get(this)||[];for(let x=0;x<m.length;x++){const b=m[x];b.onError&&b.onError(p)}i1.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),ih.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class v4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=new Ww;s.colorSpace=xl;const o=new tw(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 y4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new ef,a=new Ep(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:Dc,o.wrapT=c.wrapT!==void 0?c.wrapT:Dc,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=rh),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 b4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=new so,o=new tw(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 Lm extends _i{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Nn(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 kK extends Lm{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(_i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Nn(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 iN=new ur,pz=new Ve,mz=new Ve;class Q9{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 Wt(512,512),this.mapType=Gl,this.map=null,this.mapPass=null,this.matrix=new ur,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xy,this._frameExtents=new Wt(1,1),this._viewportCount=1,this._viewports=[new hi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;pz.setFromMatrixPosition(e.matrixWorld),n.position.copy(pz),mz.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(mz),n.updateMatrixWorld(),iN.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(iN,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Sx||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(iN)}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 NM=new Ve,kM=new Ya,Ff=new Ve;class fE extends _i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ur,this.projectionMatrix=new ur,this.projectionMatrixInverse=new ur,this.coordinateSystem=lu,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(NM,kM,Ff),Ff.x===1&&Ff.y===1&&Ff.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(NM,kM,Ff.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(NM,kM,Ff),Ff.x===1&&Ff.y===1&&Ff.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(NM,kM,Ff.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const k0=new Ve,gz=new Wt,xz=new Wt;class no extends fE{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=_y*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(dx*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return _y*2*Math.atan(Math.tan(dx*.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){k0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(k0.x,k0.y).multiplyScalar(-e/k0.z),k0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(k0.x,k0.y).multiplyScalar(-e/k0.z)}getViewSize(e,n){return this.getViewBounds(e,gz,xz),n.subVectors(xz,gz)}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(dx*.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 _4e extends Q9{constructor(){super(new no(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=_y*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 RK extends Lm{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 _4e}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 S4e extends Q9{constructor(){super(new no(90,1,.5,500)),this.isPointLightShadow=!0}}class PK extends Lm{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 S4e}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 tf extends fE{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 w4e extends Q9{constructor(){super(new tf(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DK extends Lm{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 w4e}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 IK extends Lm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class OK extends Lm{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 J9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Ve)}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 LK extends Lm{constructor(e=new J9,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 hE extends Uc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new Ep(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):Wn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&Sn("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 Nn().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 Nn().setHex(o.value);break;case"v2":i.uniforms[s].value=new Wt().fromArray(o.value);break;case"v3":i.uniforms[s].value=new Ve().fromArray(o.value);break;case"v4":i.uniforms[s].value=new hi().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Cr().fromArray(o.value);break;case"m4":i.uniforms[s].value=new ur().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 Wt().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 Wt().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 hE.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:mK,SpriteMaterial:I9,RawShaderMaterial:$9,ShaderMaterial:vu,PointsMaterial:L9,MeshPhysicalMaterial:xK,MeshStandardMaterial:q9,MeshPhongMaterial:vK,MeshToonMaterial:yK,MeshNormalMaterial:bK,MeshLambertMaterial:_K,MeshDepthMaterial:uE,MeshDistanceMaterial:dE,MeshBasicMaterial:Dp,MeshMatcapMaterial:SK,LineDashedMaterial:wK,LineBasicMaterial:Jl,Material:wl};return new n[e]}}class NR{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 pE extends Ar{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 jK extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ep(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):Wn(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],M=s(x,S.buffer),C=y1(S.type,M),A=new qC(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],M=new Uint32Array(S).buffer;return r[b]=M,M}const o=e.isInstancedBufferGeometry?new pE:new Ar,a=e.data.index;if(a!==void 0){const x=y1(a.type,a.array);o.setIndex(new $i(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 cu(S,b.itemSize,b.offset,b.normalized)}else{const S=y1(b.type,b.array),M=b.isInstancedBufferAttribute?wx:$i;_=new M(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,M=b.length;S<M;S++){const C=b[S];let A;if(C.isInterleavedBufferAttribute){const N=i(e.data,C.data);A=new cu(N,C.itemSize,C.offset,C.normalized)}else{const N=y1(C.type,C.array);A=new $i(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 Qo().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class M4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?NR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Ep(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)),Wn("ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?NR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Ep(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 nm().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 XC().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new jK;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 fz?a=fz[l.type].fromJSON(l,n):Sn(`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 hE;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=ew.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:y1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Z9(n);s=new tw(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],M=a(S);M!==null&&(M instanceof HTMLImageElement?x.push(M):x.push(new ef(M.data,M.width,M.height)))}i[p.uuid]=new Q0(x)}else{const x=a(p.url);i[p.uuid]=new Q0(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:y1(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new tw(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 ef(b.data,b.width,b.height)))}r[l.uuid]=new Q0(d)}else{const d=await s(l.url);r[l.uuid]=new Q0(d)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(Sn("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&&Sn('ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&Sn("ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let d;Array.isArray(c)?(d=new Ww,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new ef:d=new so,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,T4e)),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],vz),d.wrapT=r(a.wrap[1],vz)),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,yz)),a.magFilter!==void 0&&(d.magFilter=r(a.magFilter,yz)),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&&Sn("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&&Sn("ObjectLoader: Undefined material",S),x.push(r[S])}return x}return r[m]===void 0&&Sn("ObjectLoader: Undefined material",m),r[m]}}function c(m){return i[m]===void 0&&Sn("ObjectLoader: Undefined texture",m),i[m]}let d,p;switch(e.type){case"Scene":o=new R9,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Nn(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 $C(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new WC(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 no(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 tf(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 IK(e.color,e.intensity);break;case"DirectionalLight":o=new DK(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new PK(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new OK(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new RK(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new kK(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new J9().fromArray(e.sh);o=new LK(m,e.intensity);break;case"SkinnedMesh":d=a(e.geometry),p=l(e.material),o=new JY(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 Hs(d,p);break;case"InstancedMesh":d=a(e.geometry),p=l(e.material);const x=e.count,b=e.instanceMatrix,_=e.instanceColor;o=new eK(d,p,x),o.instanceMatrix=new wx(new Float32Array(b.array),16),_!==void 0&&(o.instanceColor=new wx(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":d=a(e.geometry),p=l(e.material),o=new tK(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 M=null,C=null;return S.boundingBox!==void 0&&(M=new Do().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(C=new Qo().fromJSON(S.boundingSphere)),{...S,boundingBox:M,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 Qo().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Do().fromJSON(e.boundingBox));break;case"LOD":o=new QY;break;case"Line":o=new bm(a(e.geometry),l(e.material));break;case"LineLoop":o=new nK(a(e.geometry),l(e.material));break;case"LineSegments":o=new Th(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new rK(a(e.geometry),l(e.material));break;case"Sprite":o=new ZY(l(e.material));break;case"Group":o=new b1;break;case"Bone":o=new O9;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 Ve().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?Sn("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 T4e={UVMapping:DC,CubeReflectionMapping:hh,CubeRefractionMapping:xm,EquirectangularReflectionMapping:tS,EquirectangularRefractionMapping:nS,CubeUVReflectionMapping:qy},vz={RepeatWrapping:FS,ClampToEdgeWrapping:Dc,MirroredRepeatWrapping:US},yz={NearestFilter:Po,NearestMipmapNearestFilter:_9,NearestMipmapLinearFilter:v1,LinearFilter:rs,LinearMipmapNearestFilter:rS,LinearMipmapLinearFilter:rh},sN=new WeakMap;class C4e extends Uc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Sn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Sn("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=ih.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{if(sN.has(o)===!0)i&&i(sN.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 ih.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),sN.set(l,c),ih.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});ih.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let RM;class eP{static getContext(){return RM===void 0&&(RM=new(window.AudioContext||window.webkitAudioContext)),RM}static setContext(e){RM=e}}class E4e extends Uc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ep(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);eP.getContext().decodeAudioData(c,function(p){n(p)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):Wn(l),s.manager.itemError(e)}}}const bz=new ur,_z=new ur,kg=new ur;class A4e{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new no,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new no,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,kg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(dx*n.fov*.5)/n.zoom;let a,l;_z.elements[12]=-i,bz.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,kg.elements[0]=2*n.near/(l-a),kg.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(kg),a=-o*n.aspect-s,l=o*n.aspect-s,kg.elements[0]=2*n.near/(l-a),kg.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(kg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(_z),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(bz)}}const s1=-90,o1=1;class zK extends _i{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new no(s1,o1,e,n);i.layers=this.layers,this.add(i);const s=new no(s1,o1,e,n);s.layers=this.layers,this.add(s);const o=new no(s1,o1,e,n);o.layers=this.layers,this.add(o);const a=new no(s1,o1,e,n);a.layers=this.layers,this.add(a);const l=new no(s1,o1,e,n);l.layers=this.layers,this.add(l);const c=new no(s1,o1,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===lu)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===Sx)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 FK extends no{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class UK{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=N4e.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 N4e(){this._document.hidden===!1&&this.reset()}const Rg=new Ve,oN=new Ya,k4e=new Ve,Pg=new Ve,Dg=new Ve;class R4e extends _i{constructor(){super(),this.type="AudioListener",this.context=eP.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new UK}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(Rg,oN,k4e),Pg.set(0,0,-1).applyQuaternion(oN),Dg.set(0,1,0).applyQuaternion(oN),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Rg.x,r),n.positionY.linearRampToValueAtTime(Rg.y,r),n.positionZ.linearRampToValueAtTime(Rg.z,r),n.forwardX.linearRampToValueAtTime(Pg.x,r),n.forwardY.linearRampToValueAtTime(Pg.y,r),n.forwardZ.linearRampToValueAtTime(Pg.z,r),n.upX.linearRampToValueAtTime(Dg.x,r),n.upY.linearRampToValueAtTime(Dg.y,r),n.upZ.linearRampToValueAtTime(Dg.z,r)}else n.setPosition(Rg.x,Rg.y,Rg.z),n.setOrientation(Pg.x,Pg.y,Pg.z,Dg.x,Dg.y,Dg.z)}}class BK 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){Sn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Sn("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){Sn("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){Sn("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){Sn("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?(Sn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Sn("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"?(Sn("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 Ig=new Ve,Sz=new Ya,P4e=new Ve,Og=new Ve;class D4e extends BK{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(Ig,Sz,P4e),Og.set(0,0,1).applyQuaternion(Sz);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Ig.x,r),n.positionY.linearRampToValueAtTime(Ig.y,r),n.positionZ.linearRampToValueAtTime(Ig.z,r),n.orientationX.linearRampToValueAtTime(Og.x,r),n.orientationY.linearRampToValueAtTime(Og.y,r),n.orientationZ.linearRampToValueAtTime(Og.z,r)}else n.setPosition(Ig.x,Ig.y,Ig.z),n.setOrientation(Og.x,Og.y,Og.z)}}class I4e{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 HK{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){Ya.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Ya.multiplyQuaternionsFlat(e,o,e,n,e,r),Ya.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 tP="\\[\\]\\.:\\/",O4e=new RegExp("["+tP+"]","g"),nP="[^"+tP+"]",L4e="[^"+tP.replace("\\.","")+"]",j4e=/((?:WC+[\/:])*)/.source.replace("WC",nP),z4e=/(WCOD+)?/.source.replace("WCOD",L4e),F4e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nP),U4e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nP),B4e=new RegExp("^"+j4e+z4e+F4e+U4e+"$"),H4e=["material","materials","bones","map"];class V4e{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(O4e,"")}static parseTrackName(e){const n=B4e.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);H4e.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){Sn("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){Wn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Wn("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){Wn("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){Wn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Wn("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){Wn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){Wn("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;Wn("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){Wn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Wn("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=V4e;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 G4e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=pu(),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 M=0,C=o;M!==C;++M){const A=s[M],N=A[_];let D=A[b];A[b]=N,D===void 0&&(D=new yi(m,r[M],i[M])),A[_]=D}}else e[b]!==a&&Wn("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],M=_[d];_[d]=S,_[p]=M}}}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,M=i;S!==M;++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 VK{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:Kg,endingEnd:Kg};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 UC: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===IY;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===PY){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=Zg,i.endingEnd=Zg):(e?i.endingStart=this.zeroSlopeAtStart?Zg:Kg:i.endingStart=HS,n?i.endingEnd=this.zeroSlopeAtEnd?Zg:Kg:i.endingEnd=HS)}_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 W4e=new Float32Array(1);class $4e extends Mh{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 HK(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 Y9(new Float32Array(2),new Float32Array(2),1,W4e),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"?ew.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=UC),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 VK(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"?ew.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 q4e extends k9{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new GC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rP{constructor(e){this.value=e}clone(){return new rP(this.value.clone===void 0?this.value:this.value.clone())}}let X4e=0;class Y4e extends Mh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:X4e++}),this.name="",this.usage=GS,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 nT extends qC{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 K4e{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 wz=new ur;class GK{constructor(e,n,r=0,i=1/0){this.ray=new Ux(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new Sy,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):Wn("Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return wz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(wz),this}intersectObject(e,n=!0,r=[]){return kR(e,this,r,n),r.sort(Mz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)kR(e[i],this,r,n);return r.sort(Mz),r}}function Mz(t,e){return t.distance-e.distance}function kR(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++)kR(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,Sn("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 RR{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=fr(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(fr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Z4e{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 iP{constructor(e,n,r,i){iP.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 Tz=new Wt;class Q4e{constructor(e=new Wt(1/0,1/0),n=new Wt(-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=Tz.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,Tz).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 Cz=new Ve,PM=new Ve,a1=new Ve,l1=new Ve,aN=new Ve,J4e=new Ve,eMe=new Ve;class $K{constructor(e=new Ve,n=new Ve){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){Cz.subVectors(e,this.start),PM.subVectors(this.end,this.start);const r=PM.dot(PM);let s=PM.dot(Cz)/r;return n&&(s=fr(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=J4e,r=eMe){const i=10000000000000001e-32;let s,o;const a=this.start,l=e.start,c=this.end,d=e.end;a1.subVectors(c,a),l1.subVectors(d,l),aN.subVectors(a,l);const p=a1.dot(a1),m=l1.dot(l1),x=l1.dot(aN);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=fr(o,0,1);else{const b=a1.dot(aN);if(m<=i)o=0,s=fr(-b/p,0,1);else{const _=a1.dot(l1),S=p*m-_*_;S!==0?s=fr((_*x-b*m)/S,0,1):s=0,o=(_*s+x)/m,o<0?(o=0,s=fr(-b/p,0,1)):o>1&&(o=1,s=fr((_-b)/p,0,1))}}return n.copy(a).addScaledVector(a1,s),r.copy(l).addScaledVector(l1,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 Ez=new Ve;class tMe extends _i{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Ar,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 In(i,3));const s=new Jl({fog:!1,toneMapped:!1});this.cone=new Th(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),Ez.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ez),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const R0=new Ve,DM=new ur,lN=new ur;class nMe extends Th{constructor(e){const n=qK(e),r=new Ar,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 In(i,3)),r.setAttribute("color",new In(s,3));const o=new Jl({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 Nn(255),l=new Nn(65280);this.setColors(a,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");lN.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(DM.multiplyMatrices(lN,a.matrixWorld),R0.setFromMatrixPosition(DM),i.setXYZ(o,R0.x,R0.y,R0.z),DM.multiplyMatrices(lN,a.parent.matrixWorld),R0.setFromMatrixPosition(DM),i.setXYZ(o+1,R0.x,R0.y,R0.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 qK(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...qK(t.children[n]));return e}class rMe extends Hs{constructor(e,n,r){const i=new Yw(n,4,2),s=new Dp({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 iMe=new Ve,Az=new Nn,Nz=new Nn;class sMe 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 Xw(n);i.rotateY(Math.PI*.5),this.material=new Dp({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 $i(o,3)),this.add(new Hs(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");Az.copy(this.light.color),Nz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?Az:Nz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(iMe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class oMe extends Th{constructor(e=10,n=10,r=4473924,i=8947848){r=new Nn(r),i=new Nn(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 Ar;d.setAttribute("position",new In(l,3)),d.setAttribute("color",new In(c,3));const p=new Jl({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class aMe extends Th{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new Nn(s),o=new Nn(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,M=Math.cos(_)*x;a.push(S,0,M),l.push(m.r,m.g,m.b),_=(b+1)/i*(Math.PI*2),S=Math.sin(_)*x,M=Math.cos(_)*x,a.push(S,0,M),l.push(m.r,m.g,m.b)}}const c=new Ar;c.setAttribute("position",new In(a,3)),c.setAttribute("color",new In(l,3));const d=new Jl({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const kz=new Ve,IM=new Ve,Rz=new Ve;class lMe 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 Ar;i.setAttribute("position",new In([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new Jl({fog:!1,toneMapped:!1});this.lightPlane=new bm(i,s),this.add(this.lightPlane),i=new Ar,i.setAttribute("position",new In([0,0,0,0,0,1],3)),this.targetLine=new bm(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),kz.setFromMatrixPosition(this.light.matrixWorld),IM.setFromMatrixPosition(this.light.target.matrixWorld),Rz.subVectors(IM,kz),this.lightPlane.lookAt(IM),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(IM),this.targetLine.scale.z=Rz.length()}}const OM=new Ve,vo=new fE;class cMe extends Th{constructor(e){const n=new Ar,r=new Jl({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 In(i,3)),n.setAttribute("color",new In(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 Nn(16755200),d=new Nn(16711680),p=new Nn(43775),m=new Nn(16777215),x=new Nn(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(vo.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===lu)s=-1,o=1;else if(this.camera.coordinateSystem===Sx)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);No("c",n,e,vo,0,0,s),No("t",n,e,vo,0,0,o),No("n1",n,e,vo,-r,-i,s),No("n2",n,e,vo,r,-i,s),No("n3",n,e,vo,-r,i,s),No("n4",n,e,vo,r,i,s),No("f1",n,e,vo,-r,-i,o),No("f2",n,e,vo,r,-i,o),No("f3",n,e,vo,-r,i,o),No("f4",n,e,vo,r,i,o),No("u1",n,e,vo,r*.7,i*1.1,s),No("u2",n,e,vo,-r*.7,i*1.1,s),No("u3",n,e,vo,0,i*2,s),No("cf1",n,e,vo,-r,0,o),No("cf2",n,e,vo,r,0,o),No("cf3",n,e,vo,0,-i,o),No("cf4",n,e,vo,0,i,o),No("cn1",n,e,vo,-r,0,s),No("cn2",n,e,vo,r,0,s),No("cn3",n,e,vo,0,-i,s),No("cn4",n,e,vo,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function No(t,e,n,r,i,s,o){OM.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],OM.x,OM.y,OM.z)}}const LM=new Do;class uMe extends Th{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 Ar;s.setIndex(new $i(r,1)),s.setAttribute("position",new $i(i,3)),super(s,new Jl({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&LM.setFromObject(this.object),LM.isEmpty())return;const e=LM.min,n=LM.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 dMe extends Th{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 Ar;s.setIndex(new $i(r,1)),s.setAttribute("position",new In(i,3)),super(s,new Jl({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 fMe extends bm{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 Ar;o.setAttribute("position",new In(s,3)),o.computeBoundingSphere(),super(o,new Jl({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 Ar;l.setAttribute("position",new In(a,3)),l.computeBoundingSphere(),this.add(new Hs(l,new Dp({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 Pz=new Ve;let jM,cN;class hMe extends _i{constructor(e=new Ve(0,0,1),n=new Ve(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",jM===void 0&&(jM=new Ar,jM.setAttribute("position",new In([0,0,0,0,1,0],3)),cN=new qw(.5,1,5,1),cN.translate(0,-.5,0)),this.position.copy(n),this.line=new bm(jM,new Jl({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Hs(cN,new Dp({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{Pz.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Pz,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 pMe extends Th{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 Ar;i.setAttribute("position",new In(n,3)),i.setAttribute("color",new In(r,3));const s=new Jl({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new Nn,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 mMe{constructor(){this.type="ShapePath",this.color=new Nn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new tT,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(M){const C=[];for(let A=0,N=M.length;A<N;A++){const D=M[A],R=new nm;R.curves=D.curves,C.push(R)}return C}function r(M,C){const A=C.length;let N=!1;for(let D=A-1,R=0;R<A;D=R++){let L=C[D],k=C[R],O=k.x-L.x,F=k.y-L.y;if(Math.abs(F)>Number.EPSILON){if(F<0&&(L=C[R],O=-O,k=C[D],F=-F),M.y<L.y||M.y>k.y)continue;if(M.y===L.y){if(M.x===L.x)return!0}else{const B=F*(M.x-L.x)-O*(M.y-L.y);if(B===0)return!0;if(B<0)continue;N=!N}}else{if(M.y!==L.y)continue;if(k.x<=M.x&&M.x<=L.x||L.x<=M.x&&M.x<=k.x)return!0}}return N}const i=Jd.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 nm,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 M=0,C=s.length;M<C;M++)a=s[M],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!d&&m[b]&&b++,m[b]={s:new nm,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 M=!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 R=0;R<D.length;R++){const L=D[R];let k=!0;for(let O=0;O<m.length;O++)r(L.p,m[O].p)&&(A!==O&&C++,k?(k=!1,p[O].push(L)):M=!0);k&&p[A].push(L)}}C>0&&M===!1&&(x=p)}let S;for(let M=0,C=m.length;M<C;M++){l=m[M].s,c.push(l),S=x[M];for(let A=0,N=S.length;A<N;A++)l.holes.push(S[A].h)}return c}}class gMe extends Mh{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){Sn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function xMe(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 vMe(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 yMe(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function PR(t,e,n,r){const i=bMe(r);switch(n){case C9:return t*e;case jC:return t*e/i.components*i.byteLength;case Gw:return t*e/i.components*i.byteLength;case _x:return t*e*2/i.components*i.byteLength;case zC:return t*e*2/i.components*i.byteLength;case E9:return t*e*3/i.components*i.byteLength;case vl:return t*e*4/i.components*i.byteLength;case FC:return t*e*4/i.components*i.byteLength;case iS:case sS:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case oS:case aS:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case b5:case S5:return Math.max(t,16)*Math.max(e,8)/4;case y5:case _5:return Math.max(t,8)*Math.max(e,8)/2;case w5:case M5:case C5:case E5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case T5:case A5:case N5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case k5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case R5:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case P5:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case D5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case I5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case O5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case L5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case j5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case z5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case F5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case U5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case B5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case H5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case V5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case G5:case W5:case $5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case q5:case X5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Y5:case K5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function bMe(t){switch(t){case Gl:case S9:return{byteLength:1,components:1};case yy:case w9:case ph:return{byteLength:2,components:1};case OC:case LC:return{byteLength:2,components:4};case hd:case IC:case Yl:return{byteLength:4,components:1};case M9:case T9:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class _Me{static contain(e,n){return xMe(e,n)}static cover(e,n){return vMe(e,n)}static fill(e){return yMe(e)}static getByteLength(e,n,r,i){return PR(e,n,r,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Hw}}));typeof window<"u"&&(window.__THREE__?Sn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Hw);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function XK(){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 SMe(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 wMe=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,MMe=`#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`,TMe=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,CMe=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,EMe=`#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`,AMe=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,NMe=`#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`,kMe=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,RMe=`#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`,PMe=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,DMe=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,IMe=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,OMe=`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`,LMe=`#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`,jMe=`#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`,zMe=`#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`,FMe=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,UMe=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,BMe=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,HMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,VMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,GMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,WMe=`#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`,$Me=`#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`,qMe=`#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`,XMe=`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`,YMe=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,KMe=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,ZMe=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,QMe=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,JMe="gl_FragColor = linearToOutputTexel( gl_FragColor );",e2e=`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 );
}`,t2e=`#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`,n2e=`#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`,r2e=`#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`,i2e=`#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`,s2e=`#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`,o2e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,a2e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,l2e=`#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`,c2e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,u2e=`#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
}`,d2e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,f2e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,h2e=`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`,p2e=`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`,m2e=`#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`,g2e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,x2e=`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`,v2e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,y2e=`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`,b2e=`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`,_2e=`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 );
}`,S2e=`
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`,w2e=`#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`,M2e=`#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`,T2e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,C2e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,E2e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,A2e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,N2e=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,k2e=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,R2e=`#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`,P2e=`#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`,D2e=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,I2e=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,O2e=`#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`,L2e=`#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`,j2e=`#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`,z2e=`#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`,F2e=`#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`,U2e=`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;`,B2e=`#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`,H2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,V2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,G2e=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,W2e=`#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`,$2e=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,q2e=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,X2e=`#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`,Y2e=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,K2e=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Z2e=`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
}`,Q2e=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,J2e=`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;`,e5e=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,t5e=`#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`,n5e=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,r5e=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,i5e=`#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`,s5e=`#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`,o5e=`#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`,a5e=`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;
}`,l5e=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,c5e=`#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`,u5e=`#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`,d5e=`#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`,f5e=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,h5e=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,p5e=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,m5e=`#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; }`,g5e=`#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`,x5e=`#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`,v5e=`#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`,y5e=`#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`,b5e=`#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`,_5e=`#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 S5e=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,w5e=`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>
}`,M5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,T5e=`#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>
}`,C5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,E5e=`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>
}`,A5e=`#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;
}`,N5e=`#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
}`,k5e=`#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;
}`,R5e=`#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 );
}`,P5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,D5e=`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>
}`,I5e=`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>
}`,O5e=`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>
}`,L5e=`#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>
}`,j5e=`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>
}`,z5e=`#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>
}`,F5e=`#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>
}`,U5e=`#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;
}`,B5e=`#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>
}`,H5e=`#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
}`,V5e=`#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
}`,G5e=`#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>
}`,W5e=`#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>
}`,$5e=`#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
}`,q5e=`#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>
}`,X5e=`#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>
}`,Y5e=`#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>
}`,K5e=`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>
}`,Z5e=`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>
}`,Q5e=`#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>
}`,J5e=`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>
}`,eTe=`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>
}`,tTe=`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>
}`,Or={alphahash_fragment:wMe,alphahash_pars_fragment:MMe,alphamap_fragment:TMe,alphamap_pars_fragment:CMe,alphatest_fragment:EMe,alphatest_pars_fragment:AMe,aomap_fragment:NMe,aomap_pars_fragment:kMe,batching_pars_vertex:RMe,batching_vertex:PMe,begin_vertex:DMe,beginnormal_vertex:IMe,bsdfs:OMe,iridescence_fragment:LMe,bumpmap_pars_fragment:jMe,clipping_planes_fragment:zMe,clipping_planes_pars_fragment:FMe,clipping_planes_pars_vertex:UMe,clipping_planes_vertex:BMe,color_fragment:HMe,color_pars_fragment:VMe,color_pars_vertex:GMe,color_vertex:WMe,common:$Me,cube_uv_reflection_fragment:qMe,defaultnormal_vertex:XMe,displacementmap_pars_vertex:YMe,displacementmap_vertex:KMe,emissivemap_fragment:ZMe,emissivemap_pars_fragment:QMe,colorspace_fragment:JMe,colorspace_pars_fragment:e2e,envmap_fragment:t2e,envmap_common_pars_fragment:n2e,envmap_pars_fragment:r2e,envmap_pars_vertex:i2e,envmap_physical_pars_fragment:m2e,envmap_vertex:s2e,fog_vertex:o2e,fog_pars_vertex:a2e,fog_fragment:l2e,fog_pars_fragment:c2e,gradientmap_pars_fragment:u2e,lightmap_pars_fragment:d2e,lights_lambert_fragment:f2e,lights_lambert_pars_fragment:h2e,lights_pars_begin:p2e,lights_toon_fragment:g2e,lights_toon_pars_fragment:x2e,lights_phong_fragment:v2e,lights_phong_pars_fragment:y2e,lights_physical_fragment:b2e,lights_physical_pars_fragment:_2e,lights_fragment_begin:S2e,lights_fragment_maps:w2e,lights_fragment_end:M2e,logdepthbuf_fragment:T2e,logdepthbuf_pars_fragment:C2e,logdepthbuf_pars_vertex:E2e,logdepthbuf_vertex:A2e,map_fragment:N2e,map_pars_fragment:k2e,map_particle_fragment:R2e,map_particle_pars_fragment:P2e,metalnessmap_fragment:D2e,metalnessmap_pars_fragment:I2e,morphinstance_vertex:O2e,morphcolor_vertex:L2e,morphnormal_vertex:j2e,morphtarget_pars_vertex:z2e,morphtarget_vertex:F2e,normal_fragment_begin:U2e,normal_fragment_maps:B2e,normal_pars_fragment:H2e,normal_pars_vertex:V2e,normal_vertex:G2e,normalmap_pars_fragment:W2e,clearcoat_normal_fragment_begin:$2e,clearcoat_normal_fragment_maps:q2e,clearcoat_pars_fragment:X2e,iridescence_pars_fragment:Y2e,opaque_fragment:K2e,packing:Z2e,premultiplied_alpha_fragment:Q2e,project_vertex:J2e,dithering_fragment:e5e,dithering_pars_fragment:t5e,roughnessmap_fragment:n5e,roughnessmap_pars_fragment:r5e,shadowmap_pars_fragment:i5e,shadowmap_pars_vertex:s5e,shadowmap_vertex:o5e,shadowmask_pars_fragment:a5e,skinbase_vertex:l5e,skinning_pars_vertex:c5e,skinning_vertex:u5e,skinnormal_vertex:d5e,specularmap_fragment:f5e,specularmap_pars_fragment:h5e,tonemapping_fragment:p5e,tonemapping_pars_fragment:m5e,transmission_fragment:g5e,transmission_pars_fragment:x5e,uv_pars_fragment:v5e,uv_pars_vertex:y5e,uv_vertex:b5e,worldpos_vertex:_5e,background_vert:S5e,background_frag:w5e,backgroundCube_vert:M5e,backgroundCube_frag:T5e,cube_vert:C5e,cube_frag:E5e,depth_vert:A5e,depth_frag:N5e,distance_vert:k5e,distance_frag:R5e,equirect_vert:P5e,equirect_frag:D5e,linedashed_vert:I5e,linedashed_frag:O5e,meshbasic_vert:L5e,meshbasic_frag:j5e,meshlambert_vert:z5e,meshlambert_frag:F5e,meshmatcap_vert:U5e,meshmatcap_frag:B5e,meshnormal_vert:H5e,meshnormal_frag:V5e,meshphong_vert:G5e,meshphong_frag:W5e,meshphysical_vert:$5e,meshphysical_frag:q5e,meshtoon_vert:X5e,meshtoon_frag:Y5e,points_vert:K5e,points_frag:Z5e,shadow_vert:Q5e,shadow_frag:J5e,sprite_vert:eTe,sprite_frag:tTe},wn={common:{diffuse:{value:new Nn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Cr},alphaMap:{value:null},alphaMapTransform:{value:new Cr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Cr}},envmap:{envMap:{value:null},envMapRotation:{value:new Cr},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 Cr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Cr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Cr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Cr},normalScale:{value:new Wt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Cr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Cr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Cr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Cr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Nn(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 Nn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Cr},alphaTest:{value:0},uvTransform:{value:new Cr}},sprite:{diffuse:{value:new Nn(16777215)},opacity:{value:1},center:{value:new Wt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Cr},alphaMap:{value:null},alphaMapTransform:{value:new Cr},alphaTest:{value:0}}},Zd={basic:{uniforms:Ul([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.fog]),vertexShader:Or.meshbasic_vert,fragmentShader:Or.meshbasic_frag},lambert:{uniforms:Ul([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.fog,wn.lights,{emissive:{value:new Nn(0)},envMapIntensity:{value:1}}]),vertexShader:Or.meshlambert_vert,fragmentShader:Or.meshlambert_frag},phong:{uniforms:Ul([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.fog,wn.lights,{emissive:{value:new Nn(0)},specular:{value:new Nn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Or.meshphong_vert,fragmentShader:Or.meshphong_frag},standard:{uniforms:Ul([wn.common,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.roughnessmap,wn.metalnessmap,wn.fog,wn.lights,{emissive:{value:new Nn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag},toon:{uniforms:Ul([wn.common,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.gradientmap,wn.fog,wn.lights,{emissive:{value:new Nn(0)}}]),vertexShader:Or.meshtoon_vert,fragmentShader:Or.meshtoon_frag},matcap:{uniforms:Ul([wn.common,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.fog,{matcap:{value:null}}]),vertexShader:Or.meshmatcap_vert,fragmentShader:Or.meshmatcap_frag},points:{uniforms:Ul([wn.points,wn.fog]),vertexShader:Or.points_vert,fragmentShader:Or.points_frag},dashed:{uniforms:Ul([wn.common,wn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Or.linedashed_vert,fragmentShader:Or.linedashed_frag},depth:{uniforms:Ul([wn.common,wn.displacementmap]),vertexShader:Or.depth_vert,fragmentShader:Or.depth_frag},normal:{uniforms:Ul([wn.common,wn.bumpmap,wn.normalmap,wn.displacementmap,{opacity:{value:1}}]),vertexShader:Or.meshnormal_vert,fragmentShader:Or.meshnormal_frag},sprite:{uniforms:Ul([wn.sprite,wn.fog]),vertexShader:Or.sprite_vert,fragmentShader:Or.sprite_frag},background:{uniforms:{uvTransform:{value:new Cr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Or.background_vert,fragmentShader:Or.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Cr}},vertexShader:Or.backgroundCube_vert,fragmentShader:Or.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Or.cube_vert,fragmentShader:Or.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Or.equirect_vert,fragmentShader:Or.equirect_frag},distance:{uniforms:Ul([wn.common,wn.displacementmap,{referencePosition:{value:new Ve},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Or.distance_vert,fragmentShader:Or.distance_frag},shadow:{uniforms:Ul([wn.lights,wn.fog,{color:{value:new Nn(0)},opacity:{value:1}}]),vertexShader:Or.shadow_vert,fragmentShader:Or.shadow_frag}};Zd.physical={uniforms:Ul([Zd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Cr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Cr},clearcoatNormalScale:{value:new Wt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Cr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Cr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Cr},sheen:{value:0},sheenColor:{value:new Nn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Cr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Cr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Cr},transmissionSamplerSize:{value:new Wt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Cr},attenuationDistance:{value:0},attenuationColor:{value:new Nn(0)},specularColor:{value:new Nn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Cr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Cr},anisotropyVector:{value:new Wt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Cr}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag};const zM={r:0,b:0,g:0},Lg=new xu,nTe=new ur;function rTe(t,e,n,r,i,s){const o=new Nn(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===qy)?(c===void 0&&(c=new Hs(new Bx(1,1,1),new vu({name:"BackgroundCubeMaterial",uniforms:Ty(Zd.backgroundCube.uniforms),vertexShader:Zd.backgroundCube.vertexShader,fragmentShader:Zd.backgroundCube.fragmentShader,side:Kl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(D,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Lg.copy(A.backgroundRotation),Lg.x*=-1,Lg.y*=-1,Lg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Lg.y*=-1,Lg.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(nTe.makeRotationFromEuler(Lg)),c.material.toneMapped=li.getTransfer(N.colorSpace)!==Hi,(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 Hs(new Ip(2,2),new vu({name:"BackgroundMaterial",uniforms:Ty(Zd.background.uniforms),vertexShader:Zd.background.vertexShader,fragmentShader:Zd.background.fragmentShader,side:Cp,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=li.getTransfer(N.colorSpace)!==Hi,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(zM,gK(t)),n.buffers.color.setClear(zM.r,zM.g,zM.b,A,s)}function M(){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:M}}function iTe(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(B,Y,V,q,G){let $=!1;const Q=p(B,q,V,Y);s!==Q&&(s=Q,c(s.object)),$=x(B,q,V,G),$&&b(B,q,V,G),G!==null&&e.update(G,t.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,N(B,Y,V,q),G!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return t.createVertexArray()}function c(B){return t.bindVertexArray(B)}function d(B){return t.deleteVertexArray(B)}function p(B,Y,V,q){const G=q.wireframe===!0;let $=r[Y.id];$===void 0&&($={},r[Y.id]=$);const Q=B.isInstancedMesh===!0?B.id:0;let K=$[Q];K===void 0&&(K={},$[Q]=K);let re=K[V.id];re===void 0&&(re={},K[V.id]=re);let U=re[G];return U===void 0&&(U=m(l()),re[G]=U),U}function m(B){const Y=[],V=[],q=[];for(let G=0;G<n;G++)Y[G]=0,V[G]=0,q[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Y,enabledAttributes:V,attributeDivisors:q,object:B,attributes:{},index:null}}function x(B,Y,V,q){const G=s.attributes,$=Y.attributes;let Q=0;const K=V.getAttributes();for(const re in K)if(K[re].location>=0){const H=G[re];let X=$[re];if(X===void 0&&(re==="instanceMatrix"&&B.instanceMatrix&&(X=B.instanceMatrix),re==="instanceColor"&&B.instanceColor&&(X=B.instanceColor)),H===void 0||H.attribute!==X||X&&H.data!==X.data)return!0;Q++}return s.attributesNum!==Q||s.index!==q}function b(B,Y,V,q){const G={},$=Y.attributes;let Q=0;const K=V.getAttributes();for(const re in K)if(K[re].location>=0){let H=$[re];H===void 0&&(re==="instanceMatrix"&&B.instanceMatrix&&(H=B.instanceMatrix),re==="instanceColor"&&B.instanceColor&&(H=B.instanceColor));const X={};X.attribute=H,H&&H.data&&(X.data=H.data),G[re]=X,Q++}s.attributes=G,s.attributesNum=Q,s.index=q}function _(){const B=s.newAttributes;for(let Y=0,V=B.length;Y<V;Y++)B[Y]=0}function S(B){M(B,0)}function M(B,Y){const V=s.newAttributes,q=s.enabledAttributes,G=s.attributeDivisors;V[B]=1,q[B]===0&&(t.enableVertexAttribArray(B),q[B]=1),G[B]!==Y&&(t.vertexAttribDivisor(B,Y),G[B]=Y)}function C(){const B=s.newAttributes,Y=s.enabledAttributes;for(let V=0,q=Y.length;V<q;V++)Y[V]!==B[V]&&(t.disableVertexAttribArray(V),Y[V]=0)}function A(B,Y,V,q,G,$,Q){Q===!0?t.vertexAttribIPointer(B,Y,V,G,$):t.vertexAttribPointer(B,Y,V,q,G,$)}function N(B,Y,V,q){_();const G=q.attributes,$=V.getAttributes(),Q=Y.defaultAttributeValues;for(const K in $){const re=$[K];if(re.location>=0){let U=G[K];if(U===void 0&&(K==="instanceMatrix"&&B.instanceMatrix&&(U=B.instanceMatrix),K==="instanceColor"&&B.instanceColor&&(U=B.instanceColor)),U!==void 0){const H=U.normalized,X=U.itemSize,j=e.get(U);if(j===void 0)continue;const le=j.buffer,se=j.type,J=j.bytesPerElement,ee=se===t.INT||se===t.UNSIGNED_INT||U.gpuType===IC;if(U.isInterleavedBufferAttribute){const ie=U.data,oe=ie.stride,de=U.offset;if(ie.isInstancedInterleavedBuffer){for(let ye=0;ye<re.locationSize;ye++)M(re.location+ye,ie.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let ye=0;ye<re.locationSize;ye++)S(re.location+ye);t.bindBuffer(t.ARRAY_BUFFER,le);for(let ye=0;ye<re.locationSize;ye++)A(re.location+ye,X/re.locationSize,se,H,oe*J,(de+X/re.locationSize*ye)*J,ee)}else{if(U.isInstancedBufferAttribute){for(let ie=0;ie<re.locationSize;ie++)M(re.location+ie,U.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=U.meshPerAttribute*U.count)}else for(let ie=0;ie<re.locationSize;ie++)S(re.location+ie);t.bindBuffer(t.ARRAY_BUFFER,le);for(let ie=0;ie<re.locationSize;ie++)A(re.location+ie,X/re.locationSize,se,H,X*J,X/re.locationSize*ie*J,ee)}}else if(Q!==void 0){const H=Q[K];if(H!==void 0)switch(H.length){case 2:t.vertexAttrib2fv(re.location,H);break;case 3:t.vertexAttrib3fv(re.location,H);break;case 4:t.vertexAttrib4fv(re.location,H);break;default:t.vertexAttrib1fv(re.location,H)}}}}C()}function D(){O();for(const B in r){const Y=r[B];for(const V in Y){const q=Y[V];for(const G in q){const $=q[G];for(const Q in $)d($[Q].object),delete $[Q];delete q[G]}}delete r[B]}}function R(B){if(r[B.id]===void 0)return;const Y=r[B.id];for(const V in Y){const q=Y[V];for(const G in q){const $=q[G];for(const Q in $)d($[Q].object),delete $[Q];delete q[G]}}delete r[B.id]}function L(B){for(const Y in r){const V=r[Y];for(const q in V){const G=V[q];if(G[B.id]===void 0)continue;const $=G[B.id];for(const Q in $)d($[Q].object),delete $[Q];delete G[B.id]}}}function k(B){for(const Y in r){const V=r[Y],q=B.isInstancedMesh===!0?B.id:0,G=V[q];if(G!==void 0){for(const $ in G){const Q=G[$];for(const K in Q)d(Q[K].object),delete Q[K];delete G[$]}delete V[q],Object.keys(V).length===0&&delete r[Y]}}}function O(){F(),o=!0,s!==i&&(s=i,c(s.object))}function F(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:O,resetDefaultState:F,dispose:D,releaseStatesOfGeometry:R,releaseStatesOfObject:k,releaseStatesOfProgram:L,initAttributes:_,enableAttribute:S,disableUnusedAttributes:C}}function sTe(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 oTe(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(L){return!(L!==vl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){const k=L===ph&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Gl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Yl&&!k)}function l(L){if(L==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="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&&(Sn("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),M=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),R=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:M,maxVertexUniforms:C,maxVaryings:A,maxFragmentUniforms:N,maxSamples:D,samples:R}}function aTe(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new lp,a=new Cr,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,M=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=M.clippingState||null;l.value=N,N=d(b,m,A,x);for(let D=0;D!==A;++D)N[D]=n[D];M.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 M=x+_*4,C=m.matrixWorldInverse;a.getNormalMatrix(C),(S===null||S.length<M)&&(S=new Float32Array(M));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 J0=4,Dz=[.125,.215,.35,.446,.526,.582],$g=20,lTe=256,M_=new tf,Iz=new Nn;let uN=null,dN=0,fN=0,hN=!1;const cTe=new Ve;class DR{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=cTe}=s;uN=this._renderer.getRenderTarget(),dN=this._renderer.getActiveCubeFace(),fN=this._renderer.getActiveMipmapLevel(),hN=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=jz(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lz(),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(uN,dN,fN),this._renderer.xr.enabled=hN,e.scissorTest=!1,c1(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===hh||e.mapping===xm?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),uN=this._renderer.getRenderTarget(),dN=this._renderer.getActiveCubeFace(),fN=this._renderer.getActiveMipmapLevel(),hN=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:ph,format:vl,colorSpace:vm,depthBuffer:!1},i=Oz(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Oz(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=uTe(s)),this._blurMaterial=fTe(s,e,n),this._ggxMaterial=dTe(s,e,n)}return i}_compileMaterial(e){const n=new Hs(new Ar,e);this._renderer.compile(n,M_)}_sceneToCubeUV(e,n,r,i,s){const l=new no(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(Iz),p.toneMapping=hu,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(i),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hs(new Bx,new Dp({name:"PMREM.Background",side:Kl,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,S=_.material;let M=!1;const C=e.background;C?C.isColor&&(S.color.copy(C),e.background=null,M=!0):(S.color.copy(Iz),M=!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;c1(i,N*D,A>2?D:0,D,D),p.setRenderTarget(i),M&&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===hh||e.mapping===xm;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=jz()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lz());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;c1(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,M_)}_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-J0?r-b+J0:0),M=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=b-n,c1(s,S,M,3*_,2*_),i.setRenderTarget(s),i.render(a,M_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,c1(e,S,M,3*_,2*_),i.setRenderTarget(e),i.render(a,M_)}_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"&&Wn("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*$g-1),_=s/b,S=isFinite(s)?1+Math.floor(d*_):$g;S>$g&&Sn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${$g}`);const M=[];let C=0;for(let L=0;L<$g;++L){const k=L/_,O=Math.exp(-k*k/2);M.push(O),L===0?C+=O:L<S&&(C+=2*O)}for(let L=0;L<M.length;L++)M[L]=M[L]/C;m.envMap.value=e.texture,m.samples.value=S,m.weights.value=M,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-J0?i-A+J0:0),R=4*(this._cubeSize-N);c1(n,D,R,3*N,2*N),l.setRenderTarget(n),l.render(p,M_)}}function uTe(t){const e=[],n=[],r=[];let i=t;const s=t-J0+1+Dz.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let l=1/a;o>t-J0?l=Dz[o-t+J0-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,M=1,C=new Float32Array(_*b*x),A=new Float32Array(S*b*x),N=new Float32Array(M*b*x);for(let R=0;R<x;R++){const L=R%3*2/3-1,k=R>2?0:-1,O=[L,k,0,L+2/3,k,0,L+2/3,k+1,0,L,k,0,L+2/3,k+1,0,L,k+1,0];C.set(O,_*b*R),A.set(m,S*b*R);const F=[R,R,R,R,R,R];N.set(F,M*b*R)}const D=new Ar;D.setAttribute("position",new $i(C,_)),D.setAttribute("uv",new $i(A,S)),D.setAttribute("faceIndex",new $i(N,M)),r.push(new Hs(D,null)),i>J0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function Oz(t,e,n){const r=new mu(t,e,n);return r.texture.mapping=qy,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function c1(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function dTe(t,e,n){return new vu({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:lTe,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:mE(),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:ch,depthTest:!1,depthWrite:!1})}function fTe(t,e,n){const r=new Float32Array($g),i=new Ve(0,1,0);return new vu({name:"SphericalGaussianBlur",defines:{n:$g,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:mE(),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:ch,depthTest:!1,depthWrite:!1})}function Lz(){return new vu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:mE(),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:ch,depthTest:!1,depthWrite:!1})}function jz(){return new vu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:mE(),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:ch,depthTest:!1,depthWrite:!1})}function mE(){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 sP extends mu{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 Ww(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 Bx(5,5,5),s=new vu({name:"CubemapFromEquirect",uniforms:Ty(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Kl,blending:ch});s.uniforms.tEquirect.value=n;const o=new Hs(i,s),a=n.minFilter;return n.minFilter===rh&&(n.minFilter=rs),new zK(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 hTe(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===tS||x===nS)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 sP(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===tS||x===nS,_=x===hh||x===xm;if(b||_){let S=n.get(m);const M=S!==void 0?S.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==M)return r===null&&(r=new DR(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 DR(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===tS?m.mapping=hh:x===nS&&(m.mapping=xm),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 pTe(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&&qS("WebGLRenderer: "+r+" extension not supported."),i}}}function mTe(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],R=C[A+1],L=C[A+2];m.push(D,R,R,L,L,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,R=A+1,L=A+2;m.push(D,R,R,L,L,D)}}const S=new(b.count>=65535?D9:P9)(m,1);S.version=_;const M=s.get(p);M&&e.remove(M),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 gTe(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 M=0;M<b;M++)S+=x[M];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 M=0;M<m.length;M++)c(m[M]/o,x[M],_[M]);else{S.multiDrawElementsInstancedWEBGL(r,x,0,s,m,0,_,0,b);let M=0;for(let C=0;C<b;C++)M+=x[C]*_[C];n.update(M,r,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=p}function xTe(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:Wn("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 vTe(t,e,n){const r=new WeakMap,i=new hi;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 F=function(){k.dispose(),r.delete(a),a.removeEventListener("dispose",F)};var x=F;m!==void 0&&m.texture.dispose();const b=a.morphAttributes.position!==void 0,_=a.morphAttributes.normal!==void 0,S=a.morphAttributes.color!==void 0,M=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,R=1;D>e.maxTextureSize&&(R=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const L=new Float32Array(D*R*4*p),k=new VC(L,D,R,p);k.type=Yl,k.needsUpdate=!0;const O=N*4;for(let B=0;B<p;B++){const Y=M[B],V=C[B],q=A[B],G=D*R*4*B;for(let $=0;$<Y.count;$++){const Q=$*O;b===!0&&(i.fromBufferAttribute(Y,$),L[G+Q+0]=i.x,L[G+Q+1]=i.y,L[G+Q+2]=i.z,L[G+Q+3]=0),_===!0&&(i.fromBufferAttribute(V,$),L[G+Q+4]=i.x,L[G+Q+5]=i.y,L[G+Q+6]=i.z,L[G+Q+7]=0),S===!0&&(i.fromBufferAttribute(q,$),L[G+Q+8]=i.x,L[G+Q+9]=i.y,L[G+Q+10]=i.z,L[G+Q+11]=q.itemSize===4?i.w:1)}}m={count:p,texture:k,size:new Wt(D,R)},r.set(a,m),a.addEventListener("dispose",F)}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 yTe(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 bTe={[m9]:"LINEAR_TONE_MAPPING",[g9]:"REINHARD_TONE_MAPPING",[x9]:"CINEON_TONE_MAPPING",[PC]:"ACES_FILMIC_TONE_MAPPING",[y9]:"AGX_TONE_MAPPING",[b9]:"NEUTRAL_TONE_MAPPING",[v9]:"CUSTOM_TONE_MAPPING"};function _Te(t,e,n,r,i){const s=new mu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),o=new mu(e,n,{type:ph,depthBuffer:!1,stencilBuffer:!1}),a=new Ar;a.setAttribute("position",new In([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new In([0,2,0,0,2,0],2));const l=new $9({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 Hs(a,l),d=new tf(-1,1,1,-1,0,1);let p=null,m=null,x=!1,b,_=null,S=[],M=!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,M=S.length>0&&S[0].isRenderPass===!0;const A=s.width,N=s.height;for(let D=0;D<S.length;D++){const R=S[D];R.setSize&&R.setSize(A,N)}},this.begin=function(C,A){if(x||C.toneMapping===hu&&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 M===!1&&C.setRenderTarget(s),b=C.toneMapping,C.toneMapping=hu,!0},this.hasRenderPass=function(){return M},this.end=function(C,A){C.toneMapping=b,x=!0;let N=s,D=o;for(let R=0;R<S.length;R++){const L=S[R];if(L.enabled!==!1&&(L.render(C,D,N,A),L.needsSwap!==!1)){const k=N;N=D,D=k}}if(p!==C.outputColorSpace||m!==C.toneMapping){p=C.outputColorSpace,m=C.toneMapping,l.defines={},li.getTransfer(p)===Hi&&(l.defines.SRGB_TRANSFER="");const R=bTe[m];R&&(l.defines[R]=""),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 YK=new so,IR=new wy(1,1),KK=new VC,ZK=new GC,QK=new Ww,zz=[],Fz=[],Uz=new Float32Array(16),Bz=new Float32Array(9),Hz=new Float32Array(4);function Ky(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=zz[i];if(s===void 0&&(s=new Float32Array(i),zz[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 ma(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 ga(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function gE(t,e){let n=Fz[e];n===void 0&&(n=new Int32Array(e),Fz[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function STe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function wTe(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(ma(n,e))return;t.uniform2fv(this.addr,e),ga(n,e)}}function MTe(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(ma(n,e))return;t.uniform3fv(this.addr,e),ga(n,e)}}function TTe(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(ma(n,e))return;t.uniform4fv(this.addr,e),ga(n,e)}}function CTe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ma(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ga(n,e)}else{if(ma(n,r))return;Hz.set(r),t.uniformMatrix2fv(this.addr,!1,Hz),ga(n,r)}}function ETe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ma(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ga(n,e)}else{if(ma(n,r))return;Bz.set(r),t.uniformMatrix3fv(this.addr,!1,Bz),ga(n,r)}}function ATe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ma(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ga(n,e)}else{if(ma(n,r))return;Uz.set(r),t.uniformMatrix4fv(this.addr,!1,Uz),ga(n,r)}}function NTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function kTe(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(ma(n,e))return;t.uniform2iv(this.addr,e),ga(n,e)}}function RTe(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(ma(n,e))return;t.uniform3iv(this.addr,e),ga(n,e)}}function PTe(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(ma(n,e))return;t.uniform4iv(this.addr,e),ga(n,e)}}function DTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ITe(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(ma(n,e))return;t.uniform2uiv(this.addr,e),ga(n,e)}}function OTe(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(ma(n,e))return;t.uniform3uiv(this.addr,e),ga(n,e)}}function LTe(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(ma(n,e))return;t.uniform4uiv(this.addr,e),ga(n,e)}}function jTe(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?(IR.compareFunction=n.isReversedDepthBuffer()?HC:BC,s=IR):s=YK,n.setTexture2D(e||s,i)}function zTe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||ZK,i)}function FTe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||QK,i)}function UTe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||KK,i)}function BTe(t){switch(t){case 5126:return STe;case 35664:return wTe;case 35665:return MTe;case 35666:return TTe;case 35674:return CTe;case 35675:return ETe;case 35676:return ATe;case 5124:case 35670:return NTe;case 35667:case 35671:return kTe;case 35668:case 35672:return RTe;case 35669:case 35673:return PTe;case 5125:return DTe;case 36294:return ITe;case 36295:return OTe;case 36296:return LTe;case 35678:case 36198:case 36298:case 36306:case 35682:return jTe;case 35679:case 36299:case 36307:return zTe;case 35680:case 36300:case 36308:case 36293:return FTe;case 36289:case 36303:case 36311:case 36292:return UTe}}function HTe(t,e){t.uniform1fv(this.addr,e)}function VTe(t,e){const n=Ky(e,this.size,2);t.uniform2fv(this.addr,n)}function GTe(t,e){const n=Ky(e,this.size,3);t.uniform3fv(this.addr,n)}function WTe(t,e){const n=Ky(e,this.size,4);t.uniform4fv(this.addr,n)}function $Te(t,e){const n=Ky(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function qTe(t,e){const n=Ky(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function XTe(t,e){const n=Ky(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function YTe(t,e){t.uniform1iv(this.addr,e)}function KTe(t,e){t.uniform2iv(this.addr,e)}function ZTe(t,e){t.uniform3iv(this.addr,e)}function QTe(t,e){t.uniform4iv(this.addr,e)}function JTe(t,e){t.uniform1uiv(this.addr,e)}function eCe(t,e){t.uniform2uiv(this.addr,e)}function tCe(t,e){t.uniform3uiv(this.addr,e)}function nCe(t,e){t.uniform4uiv(this.addr,e)}function rCe(t,e,n){const r=this.cache,i=e.length,s=gE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));let o;this.type===t.SAMPLER_2D_SHADOW?o=IR:o=YK;for(let a=0;a!==i;++a)n.setTexture2D(e[a]||o,s[a])}function iCe(t,e,n){const r=this.cache,i=e.length,s=gE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||ZK,s[o])}function sCe(t,e,n){const r=this.cache,i=e.length,s=gE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||QK,s[o])}function oCe(t,e,n){const r=this.cache,i=e.length,s=gE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||KK,s[o])}function aCe(t){switch(t){case 5126:return HTe;case 35664:return VTe;case 35665:return GTe;case 35666:return WTe;case 35674:return $Te;case 35675:return qTe;case 35676:return XTe;case 5124:case 35670:return YTe;case 35667:case 35671:return KTe;case 35668:case 35672:return ZTe;case 35669:case 35673:return QTe;case 5125:return JTe;case 36294:return eCe;case 36295:return tCe;case 36296:return nCe;case 35678:case 36198:case 36298:case 36306:case 35682:return rCe;case 35679:case 36299:case 36307:return iCe;case 35680:case 36300:case 36308:case 36293:return sCe;case 36289:case 36303:case 36311:case 36292:return oCe}}class lCe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=BTe(n.type)}}class cCe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=aCe(n.type)}}class uCe{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 pN=/(\w+)(\])?(\[|\.)?/g;function Vz(t,e){t.seq.push(e),t.map[e.id]=e}function dCe(t,e,n){const r=t.name,i=r.length;for(pN.lastIndex=0;;){const s=pN.exec(r),o=pN.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Vz(n,c===void 0?new lCe(a,t,e):new cCe(a,t,e));break}else{let p=n.map[a];p===void 0&&(p=new uCe(a),Vz(n,p)),n=p}}}class h2{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);dCe(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 Gz(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const fCe=37297;let hCe=0;function pCe(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 Wz=new Cr;function mCe(t){li._getMatrix(Wz,li.workingColorSpace,t);const e=`mat3( ${Wz.elements.map(n=>n.toFixed(4))} )`;switch(li.getTransfer(t)){case VS:return[e,"LinearTransferOETF"];case Hi:return[e,"sRGBTransferOETF"];default:return Sn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function $z(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+`

`+pCe(t.getShaderSource(e),a)}else return s}function gCe(t,e){const n=mCe(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const xCe={[m9]:"Linear",[g9]:"Reinhard",[x9]:"Cineon",[PC]:"ACESFilmic",[y9]:"AgX",[b9]:"Neutral",[v9]:"Custom"};function vCe(t,e){const n=xCe[e];return n===void 0?(Sn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const FM=new Ve;function yCe(){li.getLuminanceCoefficients(FM);const t=FM.x.toFixed(4),e=FM.y.toFixed(4),n=FM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function bCe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(U_).join(`
`)}function _Ce(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function SCe(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 U_(t){return t!==""}function qz(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 Xz(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const wCe=/^[ \t]*#include +<([\w\d./]+)>/gm;function OR(t){return t.replace(wCe,TCe)}const MCe=new Map;function TCe(t,e){let n=Or[e];if(n===void 0){const r=MCe.get(e);if(r!==void 0)n=Or[r],Sn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return OR(n)}const CCe=/#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 Yz(t){return t.replace(CCe,ECe)}function ECe(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 Kz(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 ACe={[O1]:"SHADOWMAP_TYPE_PCF",[Yg]:"SHADOWMAP_TYPE_VSM"};function NCe(t){return ACe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const kCe={[hh]:"ENVMAP_TYPE_CUBE",[xm]:"ENVMAP_TYPE_CUBE",[qy]:"ENVMAP_TYPE_CUBE_UV"};function RCe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":kCe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const PCe={[xm]:"ENVMAP_MODE_REFRACTION"};function DCe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":PCe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const ICe={[Vw]:"ENVMAP_BLENDING_MULTIPLY",[NY]:"ENVMAP_BLENDING_MIX",[kY]:"ENVMAP_BLENDING_ADD"};function OCe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":ICe[t.combine]||"ENVMAP_BLENDING_NONE"}function LCe(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 jCe(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=NCe(n),c=RCe(n),d=DCe(n),p=OCe(n),m=LCe(n),x=bCe(n),b=_Ce(s),_=i.createProgram();let S,M,C=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(U_).join(`
`),S.length>0&&(S+=`
`),M=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(U_).join(`
`),M.length>0&&(M+=`
`)):(S=[Kz(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(U_).join(`
`),M=[Kz(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!==hu?"#define TONE_MAPPING":"",n.toneMapping!==hu?Or.tonemapping_pars_fragment:"",n.toneMapping!==hu?vCe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Or.colorspace_pars_fragment,gCe("linearToOutputTexel",n.outputColorSpace),yCe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(U_).join(`
`)),o=OR(o),o=qz(o,n),o=Xz(o,n),a=OR(a),a=qz(a,n),a=Xz(a,n),o=Yz(o),a=Yz(a),n.isRawShaderMaterial!==!0&&(C=`#version 300 es
`,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+S,M=["#define varying in",n.glslVersion===MR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===MR?"":"#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(`
`)+`
`+M);const A=C+S+o,N=C+M+a,D=Gz(i,i.VERTEX_SHADER,A),R=Gz(i,i.FRAGMENT_SHADER,N);i.attachShader(_,D),i.attachShader(_,R),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function L(B){if(t.debug.checkShaderErrors){const Y=i.getProgramInfoLog(_)||"",V=i.getShaderInfoLog(D)||"",q=i.getShaderInfoLog(R)||"",G=Y.trim(),$=V.trim(),Q=q.trim();let K=!0,re=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,D,R);else{const U=$z(i,D,"vertex"),H=$z(i,R,"fragment");Wn("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

Program Info Log: `+G+`
`+U+`
`+H)}else G!==""?Sn("WebGLProgram: Program Info Log:",G):($===""||Q==="")&&(re=!1);re&&(B.diagnostics={runnable:K,programLog:G,vertexShader:{log:$,prefix:S},fragmentShader:{log:Q,prefix:M}})}i.deleteShader(D),i.deleteShader(R),k=new h2(i,_),O=SCe(i,_)}let k;this.getUniforms=function(){return k===void 0&&L(this),k};let O;this.getAttributes=function(){return O===void 0&&L(this),O};let F=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return F===!1&&(F=i.getProgramParameter(_,fCe)),F},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=hCe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=R,this}let zCe=0;class FCe{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 UCe(e),n.set(e,r)),r}}class UCe{constructor(e){this.id=zCe++,this.code=e,this.usedTimes=0}}function BCe(t,e,n,r,i,s){const o=new Sy,a=new FCe,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(k){return l.add(k),k===0?"uv":`uv${k}`}function _(k,O,F,B,Y){const V=B.fog,q=Y.geometry,G=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?B.environment:null,$=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Q=e.get(k.envMap||G,$),K=Q&&Q.mapping===qy?Q.image.height:null,re=x[k.type];k.precision!==null&&(m=r.getMaxPrecision(k.precision),m!==k.precision&&Sn("WebGLProgram.getParameters:",k.precision,"not supported, using",m,"instead."));const U=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,H=U!==void 0?U.length:0;let X=0;q.morphAttributes.position!==void 0&&(X=1),q.morphAttributes.normal!==void 0&&(X=2),q.morphAttributes.color!==void 0&&(X=3);let j,le,se,J;if(re){const Ue=Zd[re];j=Ue.vertexShader,le=Ue.fragmentShader}else j=k.vertexShader,le=k.fragmentShader,a.update(k),se=a.getVertexShaderID(k),J=a.getFragmentShaderID(k);const ee=t.getRenderTarget(),ie=t.state.buffers.depth.getReversed(),oe=Y.isInstancedMesh===!0,de=Y.isBatchedMesh===!0,ye=!!k.map,ge=!!k.matcap,Me=!!Q,fe=!!k.aoMap,Se=!!k.lightMap,me=!!k.bumpMap,Pe=!!k.normalMap,ce=!!k.displacementMap,He=!!k.emissiveMap,Be=!!k.metalnessMap,Ge=!!k.roughnessMap,We=k.anisotropy>0,ae=k.clearcoat>0,Z=k.dispersion>0,he=k.iridescence>0,be=k.sheen>0,we=k.transmission>0,ve=We&&!!k.anisotropyMap,Re=ae&&!!k.clearcoatMap,Ae=ae&&!!k.clearcoatNormalMap,Oe=ae&&!!k.clearcoatRoughnessMap,qe=he&&!!k.iridescenceMap,Fe=he&&!!k.iridescenceThicknessMap,Ke=be&&!!k.sheenColorMap,je=be&&!!k.sheenRoughnessMap,Te=!!k.specularMap,Xe=!!k.specularColorMap,ht=!!k.specularIntensityMap,ke=we&&!!k.transmissionMap,et=we&&!!k.thicknessMap,ct=!!k.gradientMap,yt=!!k.alphaMap,lt=k.alphaTest>0,Je=!!k.alphaHash,Ee=!!k.extensions;let Ze=hu;k.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(Ze=t.toneMapping);const Ie={shaderID:re,shaderType:k.type,shaderName:k.name,vertexShader:j,fragmentShader:le,defines:k.defines,customVertexShaderID:se,customFragmentShaderID:J,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:m,batching:de,batchingColor:de&&Y._colorsTexture!==null,instancing:oe,instancingColor:oe&&Y.instanceColor!==null,instancingMorph:oe&&Y.morphTexture!==null,outputColorSpace:ee===null?t.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:vm,alphaToCoverage:!!k.alphaToCoverage,map:ye,matcap:ge,envMap:Me,envMapMode:Me&&Q.mapping,envMapCubeUVHeight:K,aoMap:fe,lightMap:Se,bumpMap:me,normalMap:Pe,displacementMap:ce,emissiveMap:He,normalMapObjectSpace:Pe&&k.normalMapType===jY,normalMapTangentSpace:Pe&&k.normalMapType===Im,metalnessMap:Be,roughnessMap:Ge,anisotropy:We,anisotropyMap:ve,clearcoat:ae,clearcoatMap:Re,clearcoatNormalMap:Ae,clearcoatRoughnessMap:Oe,dispersion:Z,iridescence:he,iridescenceMap:qe,iridescenceThicknessMap:Fe,sheen:be,sheenColorMap:Ke,sheenRoughnessMap:je,specularMap:Te,specularColorMap:Xe,specularIntensityMap:ht,transmission:we,transmissionMap:ke,thicknessMap:et,gradientMap:ct,opaque:k.transparent===!1&&k.blending===ux&&k.alphaToCoverage===!1,alphaMap:yt,alphaTest:lt,alphaHash:Je,combine:k.combine,mapUv:ye&&b(k.map.channel),aoMapUv:fe&&b(k.aoMap.channel),lightMapUv:Se&&b(k.lightMap.channel),bumpMapUv:me&&b(k.bumpMap.channel),normalMapUv:Pe&&b(k.normalMap.channel),displacementMapUv:ce&&b(k.displacementMap.channel),emissiveMapUv:He&&b(k.emissiveMap.channel),metalnessMapUv:Be&&b(k.metalnessMap.channel),roughnessMapUv:Ge&&b(k.roughnessMap.channel),anisotropyMapUv:ve&&b(k.anisotropyMap.channel),clearcoatMapUv:Re&&b(k.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&b(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Oe&&b(k.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&b(k.iridescenceMap.channel),iridescenceThicknessMapUv:Fe&&b(k.iridescenceThicknessMap.channel),sheenColorMapUv:Ke&&b(k.sheenColorMap.channel),sheenRoughnessMapUv:je&&b(k.sheenRoughnessMap.channel),specularMapUv:Te&&b(k.specularMap.channel),specularColorMapUv:Xe&&b(k.specularColorMap.channel),specularIntensityMapUv:ht&&b(k.specularIntensityMap.channel),transmissionMapUv:ke&&b(k.transmissionMap.channel),thicknessMapUv:et&&b(k.thicknessMap.channel),alphaMapUv:yt&&b(k.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(Pe||We),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:Y.isPoints===!0&&!!q.attributes.uv&&(ye||yt),fog:!!V,useFog:k.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:k.wireframe===!1&&(k.flatShading===!0||q.attributes.normal===void 0&&Pe===!1&&(k.isMeshLambertMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isMeshPhysicalMaterial)),sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:ie,skinning:Y.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:X,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:Ze,decodeVideoTexture:ye&&k.map.isVideoTexture===!0&&li.getTransfer(k.map.colorSpace)===Hi,decodeVideoTextureEmissive:He&&k.emissiveMap.isVideoTexture===!0&&li.getTransfer(k.emissiveMap.colorSpace)===Hi,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===ru,flipSided:k.side===Kl,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:Ee&&k.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ee&&k.extensions.multiDraw===!0||de)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return Ie.vertexUv1s=l.has(1),Ie.vertexUv2s=l.has(2),Ie.vertexUv3s=l.has(3),l.clear(),Ie}function S(k){const O=[];if(k.shaderID?O.push(k.shaderID):(O.push(k.customVertexShaderID),O.push(k.customFragmentShaderID)),k.defines!==void 0)for(const F in k.defines)O.push(F),O.push(k.defines[F]);return k.isRawShaderMaterial===!1&&(M(O,k),C(O,k),O.push(t.outputColorSpace)),O.push(k.customProgramCacheKey),O.join()}function M(k,O){k.push(O.precision),k.push(O.outputColorSpace),k.push(O.envMapMode),k.push(O.envMapCubeUVHeight),k.push(O.mapUv),k.push(O.alphaMapUv),k.push(O.lightMapUv),k.push(O.aoMapUv),k.push(O.bumpMapUv),k.push(O.normalMapUv),k.push(O.displacementMapUv),k.push(O.emissiveMapUv),k.push(O.metalnessMapUv),k.push(O.roughnessMapUv),k.push(O.anisotropyMapUv),k.push(O.clearcoatMapUv),k.push(O.clearcoatNormalMapUv),k.push(O.clearcoatRoughnessMapUv),k.push(O.iridescenceMapUv),k.push(O.iridescenceThicknessMapUv),k.push(O.sheenColorMapUv),k.push(O.sheenRoughnessMapUv),k.push(O.specularMapUv),k.push(O.specularColorMapUv),k.push(O.specularIntensityMapUv),k.push(O.transmissionMapUv),k.push(O.thicknessMapUv),k.push(O.combine),k.push(O.fogExp2),k.push(O.sizeAttenuation),k.push(O.morphTargetsCount),k.push(O.morphAttributeCount),k.push(O.numDirLights),k.push(O.numPointLights),k.push(O.numSpotLights),k.push(O.numSpotLightMaps),k.push(O.numHemiLights),k.push(O.numRectAreaLights),k.push(O.numDirLightShadows),k.push(O.numPointLightShadows),k.push(O.numSpotLightShadows),k.push(O.numSpotLightShadowsWithMaps),k.push(O.numLightProbes),k.push(O.shadowMapType),k.push(O.toneMapping),k.push(O.numClippingPlanes),k.push(O.numClipIntersection),k.push(O.depthPacking)}function C(k,O){o.disableAll(),O.instancing&&o.enable(0),O.instancingColor&&o.enable(1),O.instancingMorph&&o.enable(2),O.matcap&&o.enable(3),O.envMap&&o.enable(4),O.normalMapObjectSpace&&o.enable(5),O.normalMapTangentSpace&&o.enable(6),O.clearcoat&&o.enable(7),O.iridescence&&o.enable(8),O.alphaTest&&o.enable(9),O.vertexColors&&o.enable(10),O.vertexAlphas&&o.enable(11),O.vertexUv1s&&o.enable(12),O.vertexUv2s&&o.enable(13),O.vertexUv3s&&o.enable(14),O.vertexTangents&&o.enable(15),O.anisotropy&&o.enable(16),O.alphaHash&&o.enable(17),O.batching&&o.enable(18),O.dispersion&&o.enable(19),O.batchingColor&&o.enable(20),O.gradientMap&&o.enable(21),k.push(o.mask),o.disableAll(),O.fog&&o.enable(0),O.useFog&&o.enable(1),O.flatShading&&o.enable(2),O.logarithmicDepthBuffer&&o.enable(3),O.reversedDepthBuffer&&o.enable(4),O.skinning&&o.enable(5),O.morphTargets&&o.enable(6),O.morphNormals&&o.enable(7),O.morphColors&&o.enable(8),O.premultipliedAlpha&&o.enable(9),O.shadowMapEnabled&&o.enable(10),O.doubleSided&&o.enable(11),O.flipSided&&o.enable(12),O.useDepthPacking&&o.enable(13),O.dithering&&o.enable(14),O.transmission&&o.enable(15),O.sheen&&o.enable(16),O.opaque&&o.enable(17),O.pointsUvs&&o.enable(18),O.decodeVideoTexture&&o.enable(19),O.decodeVideoTextureEmissive&&o.enable(20),O.alphaToCoverage&&o.enable(21),k.push(o.mask)}function A(k){const O=x[k.type];let F;if(O){const B=Zd[O];F=ZS.clone(B.uniforms)}else F=k.uniforms;return F}function N(k,O){let F=d.get(O);return F!==void 0?++F.usedTimes:(F=new jCe(t,O,k,i),c.push(F),d.set(O,F)),F}function D(k){if(--k.usedTimes===0){const O=c.indexOf(k);c[O]=c[c.length-1],c.pop(),d.delete(k.cacheKey),k.destroy()}}function R(k){a.remove(k)}function L(){a.dispose()}return{getParameters:_,getProgramCacheKey:S,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:R,programs:c,dispose:L}}function HCe(){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 VCe(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 Zz(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 Qz(){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,M){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:M},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=M),e++,C}function l(m,x,b,_,S,M){const C=a(m,x,b,_,S,M);b.transmission>0?r.push(C):b.transparent===!0?i.push(C):n.push(C)}function c(m,x,b,_,S,M){const C=a(m,x,b,_,S,M);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||VCe),r.length>1&&r.sort(x||Zz),i.length>1&&i.sort(x||Zz)}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 GCe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new Qz,t.set(r,[o])):i>=s.length?(o=new Qz,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function WCe(){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 Ve,color:new Nn};break;case"SpotLight":n={position:new Ve,direction:new Ve,color:new Nn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ve,color:new Nn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ve,skyColor:new Nn,groundColor:new Nn};break;case"RectAreaLight":n={color:new Nn,position:new Ve,halfWidth:new Ve,halfHeight:new Ve};break}return t[e.id]=n,n}}}function $Ce(){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 Wt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let qCe=0;function XCe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function YCe(t){const e=new WCe,n=$Ce(),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 Ve);const i=new Ve,s=new ur,o=new ur;function a(c){let d=0,p=0,m=0;for(let O=0;O<9;O++)r.probe[O].set(0,0,0);let x=0,b=0,_=0,S=0,M=0,C=0,A=0,N=0,D=0,R=0,L=0;c.sort(XCe);for(let O=0,F=c.length;O<F;O++){const B=c[O],Y=B.color,V=B.intensity,q=B.distance;let G=null;if(B.shadow&&B.shadow.map&&(B.shadow.map.texture.format===_x?G=B.shadow.map.texture:G=B.shadow.map.depthTexture||B.shadow.map.texture),B.isAmbientLight)d+=Y.r*V,p+=Y.g*V,m+=Y.b*V;else if(B.isLightProbe){for(let $=0;$<9;$++)r.probe[$].addScaledVector(B.sh.coefficients[$],V);L++}else if(B.isDirectionalLight){const $=e.get(B);if($.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const Q=B.shadow,K=n.get(B);K.shadowIntensity=Q.intensity,K.shadowBias=Q.bias,K.shadowNormalBias=Q.normalBias,K.shadowRadius=Q.radius,K.shadowMapSize=Q.mapSize,r.directionalShadow[x]=K,r.directionalShadowMap[x]=G,r.directionalShadowMatrix[x]=B.shadow.matrix,C++}r.directional[x]=$,x++}else if(B.isSpotLight){const $=e.get(B);$.position.setFromMatrixPosition(B.matrixWorld),$.color.copy(Y).multiplyScalar(V),$.distance=q,$.coneCos=Math.cos(B.angle),$.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),$.decay=B.decay,r.spot[_]=$;const Q=B.shadow;if(B.map&&(r.spotLightMap[D]=B.map,D++,Q.updateMatrices(B),B.castShadow&&R++),r.spotLightMatrix[_]=Q.matrix,B.castShadow){const K=n.get(B);K.shadowIntensity=Q.intensity,K.shadowBias=Q.bias,K.shadowNormalBias=Q.normalBias,K.shadowRadius=Q.radius,K.shadowMapSize=Q.mapSize,r.spotShadow[_]=K,r.spotShadowMap[_]=G,N++}_++}else if(B.isRectAreaLight){const $=e.get(B);$.color.copy(Y).multiplyScalar(V),$.halfWidth.set(B.width*.5,0,0),$.halfHeight.set(0,B.height*.5,0),r.rectArea[S]=$,S++}else if(B.isPointLight){const $=e.get(B);if($.color.copy(B.color).multiplyScalar(B.intensity),$.distance=B.distance,$.decay=B.decay,B.castShadow){const Q=B.shadow,K=n.get(B);K.shadowIntensity=Q.intensity,K.shadowBias=Q.bias,K.shadowNormalBias=Q.normalBias,K.shadowRadius=Q.radius,K.shadowMapSize=Q.mapSize,K.shadowCameraNear=Q.camera.near,K.shadowCameraFar=Q.camera.far,r.pointShadow[b]=K,r.pointShadowMap[b]=G,r.pointShadowMatrix[b]=B.shadow.matrix,A++}r.point[b]=$,b++}else if(B.isHemisphereLight){const $=e.get(B);$.skyColor.copy(B.color).multiplyScalar(V),$.groundColor.copy(B.groundColor).multiplyScalar(V),r.hemi[M]=$,M++}}S>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=wn.LTC_FLOAT_1,r.rectAreaLTC2=wn.LTC_FLOAT_2):(r.rectAreaLTC1=wn.LTC_HALF_1,r.rectAreaLTC2=wn.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=p,r.ambient[2]=m;const k=r.hash;(k.directionalLength!==x||k.pointLength!==b||k.spotLength!==_||k.rectAreaLength!==S||k.hemiLength!==M||k.numDirectionalShadows!==C||k.numPointShadows!==A||k.numSpotShadows!==N||k.numSpotMaps!==D||k.numLightProbes!==L)&&(r.directional.length=x,r.spot.length=_,r.rectArea.length=S,r.point.length=b,r.hemi.length=M,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-R,r.spotLightMap.length=D,r.numSpotLightShadowsWithMaps=R,r.numLightProbes=L,k.directionalLength=x,k.pointLength=b,k.spotLength=_,k.rectAreaLength=S,k.hemiLength=M,k.numDirectionalShadows=C,k.numPointShadows=A,k.numSpotShadows=N,k.numSpotMaps=D,k.numLightProbes=L,r.version=qCe++)}function l(c,d){let p=0,m=0,x=0,b=0,_=0;const S=d.matrixWorldInverse;for(let M=0,C=c.length;M<C;M++){const A=c[M];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 Jz(t){const e=new YCe(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 KCe(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Jz(t),e.set(i,[a])):s>=o.length?(a=new Jz(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}const ZCe=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,QCe=`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 );
}`,JCe=[new Ve(1,0,0),new Ve(-1,0,0),new Ve(0,1,0),new Ve(0,-1,0),new Ve(0,0,1),new Ve(0,0,-1)],eEe=[new Ve(0,-1,0),new Ve(0,-1,0),new Ve(0,0,1),new Ve(0,0,-1),new Ve(0,-1,0),new Ve(0,-1,0)],eF=new ur,T_=new Ve,mN=new Ve;function tEe(t,e,n){let r=new Xy;const i=new Wt,s=new Wt,o=new hi,a=new uE,l=new dE,c={},d=n.maxTextureSize,p={[Cp]:Kl,[Kl]:Cp,[ru]:ru},m=new vu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Wt},radius:{value:4}},vertexShader:ZCe,fragmentShader:QCe}),x=m.clone();x.defines.HORIZONTAL_PASS=1;const b=new Ar;b.setAttribute("position",new $i(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Hs(b,m),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=O1;let M=this.type;this.render=function(R,L,k){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||R.length===0)return;this.type===eS&&(Sn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=O1);const O=t.getRenderTarget(),F=t.getActiveCubeFace(),B=t.getActiveMipmapLevel(),Y=t.state;Y.setBlending(ch),Y.buffers.depth.getReversed()===!0?Y.buffers.color.setClear(0,0,0,0):Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);const V=M!==this.type;V&&L.traverse(function(q){q.material&&(Array.isArray(q.material)?q.material.forEach(G=>G.needsUpdate=!0):q.material.needsUpdate=!0)});for(let q=0,G=R.length;q<G;q++){const $=R[q],Q=$.shadow;if(Q===void 0){Sn("WebGLShadowMap:",$,"has no shadow.");continue}if(Q.autoUpdate===!1&&Q.needsUpdate===!1)continue;i.copy(Q.mapSize);const K=Q.getFrameExtents();i.multiply(K),s.copy(Q.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/K.x),i.x=s.x*K.x,Q.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/K.y),i.y=s.y*K.y,Q.mapSize.y=s.y));const re=t.state.buffers.depth.getReversed();if(Q.camera._reversedDepth=re,Q.map===null||V===!0){if(Q.map!==null&&(Q.map.depthTexture!==null&&(Q.map.depthTexture.dispose(),Q.map.depthTexture=null),Q.map.dispose()),this.type===Yg){if($.isPointLight){Sn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Q.map=new mu(i.x,i.y,{format:_x,type:ph,minFilter:rs,magFilter:rs,generateMipmaps:!1}),Q.map.texture.name=$.name+".shadowMap",Q.map.depthTexture=new wy(i.x,i.y,Yl),Q.map.depthTexture.name=$.name+".shadowMapDepth",Q.map.depthTexture.format=mh,Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=Po,Q.map.depthTexture.magFilter=Po}else $.isPointLight?(Q.map=new sP(i.x),Q.map.depthTexture=new sK(i.x,hd)):(Q.map=new mu(i.x,i.y),Q.map.depthTexture=new wy(i.x,i.y,hd)),Q.map.depthTexture.name=$.name+".shadowMap",Q.map.depthTexture.format=mh,this.type===O1?(Q.map.depthTexture.compareFunction=re?HC:BC,Q.map.depthTexture.minFilter=rs,Q.map.depthTexture.magFilter=rs):(Q.map.depthTexture.compareFunction=null,Q.map.depthTexture.minFilter=Po,Q.map.depthTexture.magFilter=Po);Q.camera.updateProjectionMatrix()}const U=Q.map.isWebGLCubeRenderTarget?6:1;for(let H=0;H<U;H++){if(Q.map.isWebGLCubeRenderTarget)t.setRenderTarget(Q.map,H),t.clear();else{H===0&&(t.setRenderTarget(Q.map),t.clear());const X=Q.getViewport(H);o.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),Y.viewport(o)}if($.isPointLight){const X=Q.camera,j=Q.matrix,le=$.distance||X.far;le!==X.far&&(X.far=le,X.updateProjectionMatrix()),T_.setFromMatrixPosition($.matrixWorld),X.position.copy(T_),mN.copy(X.position),mN.add(JCe[H]),X.up.copy(eEe[H]),X.lookAt(mN),X.updateMatrixWorld(),j.makeTranslation(-T_.x,-T_.y,-T_.z),eF.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),Q._frustum.setFromProjectionMatrix(eF,X.coordinateSystem,X.reversedDepth)}else Q.updateMatrices($);r=Q.getFrustum(),N(L,k,Q.camera,$,this.type)}Q.isPointLightShadow!==!0&&this.type===Yg&&C(Q,k),Q.needsUpdate=!1}M=this.type,S.needsUpdate=!1,t.setRenderTarget(O,F,B)};function C(R,L){const k=e.update(_);m.defines.VSM_SAMPLES!==R.blurSamples&&(m.defines.VSM_SAMPLES=R.blurSamples,x.defines.VSM_SAMPLES=R.blurSamples,m.needsUpdate=!0,x.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new mu(i.x,i.y,{format:_x,type:ph})),m.uniforms.shadow_pass.value=R.map.depthTexture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,t.setRenderTarget(R.mapPass),t.clear(),t.renderBufferDirect(L,null,k,m,_,null),x.uniforms.shadow_pass.value=R.mapPass.texture,x.uniforms.resolution.value=R.mapSize,x.uniforms.radius.value=R.radius,t.setRenderTarget(R.map),t.clear(),t.renderBufferDirect(L,null,k,x,_,null)}function A(R,L,k,O){let F=null;const B=k.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(B!==void 0)F=B;else if(F=k.isPointLight===!0?l:a,t.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const Y=F.uuid,V=L.uuid;let q=c[Y];q===void 0&&(q={},c[Y]=q);let G=q[V];G===void 0&&(G=F.clone(),q[V]=G,L.addEventListener("dispose",D)),F=G}if(F.visible=L.visible,F.wireframe=L.wireframe,O===Yg?F.side=L.shadowSide!==null?L.shadowSide:L.side:F.side=L.shadowSide!==null?L.shadowSide:p[L.side],F.alphaMap=L.alphaMap,F.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,F.map=L.map,F.clipShadows=L.clipShadows,F.clippingPlanes=L.clippingPlanes,F.clipIntersection=L.clipIntersection,F.displacementMap=L.displacementMap,F.displacementScale=L.displacementScale,F.displacementBias=L.displacementBias,F.wireframeLinewidth=L.wireframeLinewidth,F.linewidth=L.linewidth,k.isPointLight===!0&&F.isMeshDistanceMaterial===!0){const Y=t.properties.get(F);Y.light=k}return F}function N(R,L,k,O,F){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&F===Yg)&&(!R.frustumCulled||r.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,R.matrixWorld);const V=e.update(R),q=R.material;if(Array.isArray(q)){const G=V.groups;for(let $=0,Q=G.length;$<Q;$++){const K=G[$],re=q[K.materialIndex];if(re&&re.visible){const U=A(R,re,O,F);R.onBeforeShadow(t,R,L,k,V,U,K),t.renderBufferDirect(k,null,V,U,R,K),R.onAfterShadow(t,R,L,k,V,U,K)}}}else if(q.visible){const G=A(R,q,O,F);R.onBeforeShadow(t,R,L,k,V,G,null),t.renderBufferDirect(k,null,V,G,R,null),R.onAfterShadow(t,R,L,k,V,G,null)}}const Y=R.children;for(let V=0,q=Y.length;V<q;V++)N(Y[V],L,k,O,F)}function D(R){R.target.removeEventListener("dispose",D);for(const k in c){const O=c[k],F=R.target.uuid;F in O&&(O[F].dispose(),delete O[F])}}}function nEe(t,e){function n(){let ke=!1;const et=new hi;let ct=null;const yt=new hi(0,0,0,0);return{setMask:function(lt){ct!==lt&&!ke&&(t.colorMask(lt,lt,lt,lt),ct=lt)},setLocked:function(lt){ke=lt},setClear:function(lt,Je,Ee,Ze,Ie){Ie===!0&&(lt*=Ze,Je*=Ze,Ee*=Ze),et.set(lt,Je,Ee,Ze),yt.equals(et)===!1&&(t.clearColor(lt,Je,Ee,Ze),yt.copy(et))},reset:function(){ke=!1,ct=null,yt.set(-1,0,0,0)}}}function r(){let ke=!1,et=!1,ct=null,yt=null,lt=null;return{setReversed:function(Je){if(et!==Je){const Ee=e.get("EXT_clip_control");Je?Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.ZERO_TO_ONE_EXT):Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.NEGATIVE_ONE_TO_ONE_EXT),et=Je;const Ze=lt;lt=null,this.setClear(Ze)}},getReversed:function(){return et},setTest:function(Je){Je?ee(t.DEPTH_TEST):ie(t.DEPTH_TEST)},setMask:function(Je){ct!==Je&&!ke&&(t.depthMask(Je),ct=Je)},setFunc:function(Je){if(et&&(Je=Ewe[Je]),yt!==Je){switch(Je){case f5:t.depthFunc(t.NEVER);break;case h5:t.depthFunc(t.ALWAYS);break;case p5:t.depthFunc(t.LESS);break;case bx:t.depthFunc(t.LEQUAL);break;case m5:t.depthFunc(t.EQUAL);break;case g5:t.depthFunc(t.GEQUAL);break;case x5:t.depthFunc(t.GREATER);break;case v5:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}yt=Je}},setLocked:function(Je){ke=Je},setClear:function(Je){lt!==Je&&(lt=Je,et&&(Je=1-Je),t.clearDepth(Je))},reset:function(){ke=!1,ct=null,yt=null,lt=null,et=!1}}}function i(){let ke=!1,et=null,ct=null,yt=null,lt=null,Je=null,Ee=null,Ze=null,Ie=null;return{setTest:function(Ue){ke||(Ue?ee(t.STENCIL_TEST):ie(t.STENCIL_TEST))},setMask:function(Ue){et!==Ue&&!ke&&(t.stencilMask(Ue),et=Ue)},setFunc:function(Ue,rt,ut){(ct!==Ue||yt!==rt||lt!==ut)&&(t.stencilFunc(Ue,rt,ut),ct=Ue,yt=rt,lt=ut)},setOp:function(Ue,rt,ut){(Je!==Ue||Ee!==rt||Ze!==ut)&&(t.stencilOp(Ue,rt,ut),Je=Ue,Ee=rt,Ze=ut)},setLocked:function(Ue){ke=Ue},setClear:function(Ue){Ie!==Ue&&(t.clearStencil(Ue),Ie=Ue)},reset:function(){ke=!1,et=null,ct=null,yt=null,lt=null,Je=null,Ee=null,Ze=null,Ie=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,M=null,C=null,A=null,N=null,D=null,R=null,L=new Nn(0,0,0),k=0,O=!1,F=null,B=null,Y=null,V=null,q=null;const G=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let $=!1,Q=0;const K=t.getParameter(t.VERSION);K.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(K)[1]),$=Q>=1):K.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),$=Q>=2);let re=null,U={};const H=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),j=new hi().fromArray(H),le=new hi().fromArray(X);function se(ke,et,ct,yt){const lt=new Uint8Array(4),Je=t.createTexture();t.bindTexture(ke,Je),t.texParameteri(ke,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ke,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ee=0;Ee<ct;Ee++)ke===t.TEXTURE_3D||ke===t.TEXTURE_2D_ARRAY?t.texImage3D(et,0,t.RGBA,1,1,yt,0,t.RGBA,t.UNSIGNED_BYTE,lt):t.texImage2D(et+Ee,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,lt);return Je}const J={};J[t.TEXTURE_2D]=se(t.TEXTURE_2D,t.TEXTURE_2D,1),J[t.TEXTURE_CUBE_MAP]=se(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[t.TEXTURE_2D_ARRAY]=se(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),J[t.TEXTURE_3D]=se(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ee(t.DEPTH_TEST),o.setFunc(bx),me(!1),Pe(xR),ee(t.CULL_FACE),fe(ch);function ee(ke){d[ke]!==!0&&(t.enable(ke),d[ke]=!0)}function ie(ke){d[ke]!==!1&&(t.disable(ke),d[ke]=!1)}function oe(ke,et){return p[ke]!==et?(t.bindFramebuffer(ke,et),p[ke]=et,ke===t.DRAW_FRAMEBUFFER&&(p[t.FRAMEBUFFER]=et),ke===t.FRAMEBUFFER&&(p[t.DRAW_FRAMEBUFFER]=et),!0):!1}function de(ke,et){let ct=x,yt=!1;if(ke){ct=m.get(et),ct===void 0&&(ct=[],m.set(et,ct));const lt=ke.textures;if(ct.length!==lt.length||ct[0]!==t.COLOR_ATTACHMENT0){for(let Je=0,Ee=lt.length;Je<Ee;Je++)ct[Je]=t.COLOR_ATTACHMENT0+Je;ct.length=lt.length,yt=!0}}else ct[0]!==t.BACK&&(ct[0]=t.BACK,yt=!0);yt&&t.drawBuffers(ct)}function ye(ke){return b!==ke?(t.useProgram(ke),b=ke,!0):!1}const ge={[z0]:t.FUNC_ADD,[fY]:t.FUNC_SUBTRACT,[hY]:t.FUNC_REVERSE_SUBTRACT};ge[pY]=t.MIN,ge[mY]=t.MAX;const Me={[gY]:t.ZERO,[xY]:t.ONE,[vY]:t.SRC_COLOR,[u5]:t.SRC_ALPHA,[MY]:t.SRC_ALPHA_SATURATE,[SY]:t.DST_COLOR,[bY]:t.DST_ALPHA,[yY]:t.ONE_MINUS_SRC_COLOR,[d5]:t.ONE_MINUS_SRC_ALPHA,[wY]:t.ONE_MINUS_DST_COLOR,[_Y]:t.ONE_MINUS_DST_ALPHA,[TY]:t.CONSTANT_COLOR,[CY]:t.ONE_MINUS_CONSTANT_COLOR,[EY]:t.CONSTANT_ALPHA,[AY]:t.ONE_MINUS_CONSTANT_ALPHA};function fe(ke,et,ct,yt,lt,Je,Ee,Ze,Ie,Ue){if(ke===ch){_===!0&&(ie(t.BLEND),_=!1);return}if(_===!1&&(ee(t.BLEND),_=!0),ke!==dY){if(ke!==S||Ue!==O){if((M!==z0||N!==z0)&&(t.blendEquation(t.FUNC_ADD),M=z0,N=z0),Ue)switch(ke){case ux:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case vR:t.blendFunc(t.ONE,t.ONE);break;case yR:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case bR:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Wn("WebGLState: Invalid blending: ",ke);break}else switch(ke){case ux:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case vR:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case yR:Wn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case bR:Wn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Wn("WebGLState: Invalid blending: ",ke);break}C=null,A=null,D=null,R=null,L.set(0,0,0),k=0,S=ke,O=Ue}return}lt=lt||et,Je=Je||ct,Ee=Ee||yt,(et!==M||lt!==N)&&(t.blendEquationSeparate(ge[et],ge[lt]),M=et,N=lt),(ct!==C||yt!==A||Je!==D||Ee!==R)&&(t.blendFuncSeparate(Me[ct],Me[yt],Me[Je],Me[Ee]),C=ct,A=yt,D=Je,R=Ee),(Ze.equals(L)===!1||Ie!==k)&&(t.blendColor(Ze.r,Ze.g,Ze.b,Ie),L.copy(Ze),k=Ie),S=ke,O=!1}function Se(ke,et){ke.side===ru?ie(t.CULL_FACE):ee(t.CULL_FACE);let ct=ke.side===Kl;et&&(ct=!ct),me(ct),ke.blending===ux&&ke.transparent===!1?fe(ch):fe(ke.blending,ke.blendEquation,ke.blendSrc,ke.blendDst,ke.blendEquationAlpha,ke.blendSrcAlpha,ke.blendDstAlpha,ke.blendColor,ke.blendAlpha,ke.premultipliedAlpha),o.setFunc(ke.depthFunc),o.setTest(ke.depthTest),o.setMask(ke.depthWrite),s.setMask(ke.colorWrite);const yt=ke.stencilWrite;a.setTest(yt),yt&&(a.setMask(ke.stencilWriteMask),a.setFunc(ke.stencilFunc,ke.stencilRef,ke.stencilFuncMask),a.setOp(ke.stencilFail,ke.stencilZFail,ke.stencilZPass)),He(ke.polygonOffset,ke.polygonOffsetFactor,ke.polygonOffsetUnits),ke.alphaToCoverage===!0?ee(t.SAMPLE_ALPHA_TO_COVERAGE):ie(t.SAMPLE_ALPHA_TO_COVERAGE)}function me(ke){F!==ke&&(ke?t.frontFace(t.CW):t.frontFace(t.CCW),F=ke)}function Pe(ke){ke!==lY?(ee(t.CULL_FACE),ke!==B&&(ke===xR?t.cullFace(t.BACK):ke===cY?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):ie(t.CULL_FACE),B=ke}function ce(ke){ke!==Y&&($&&t.lineWidth(ke),Y=ke)}function He(ke,et,ct){ke?(ee(t.POLYGON_OFFSET_FILL),(V!==et||q!==ct)&&(V=et,q=ct,o.getReversed()&&(et=-et),t.polygonOffset(et,ct))):ie(t.POLYGON_OFFSET_FILL)}function Be(ke){ke?ee(t.SCISSOR_TEST):ie(t.SCISSOR_TEST)}function Ge(ke){ke===void 0&&(ke=t.TEXTURE0+G-1),re!==ke&&(t.activeTexture(ke),re=ke)}function We(ke,et,ct){ct===void 0&&(re===null?ct=t.TEXTURE0+G-1:ct=re);let yt=U[ct];yt===void 0&&(yt={type:void 0,texture:void 0},U[ct]=yt),(yt.type!==ke||yt.texture!==et)&&(re!==ct&&(t.activeTexture(ct),re=ct),t.bindTexture(ke,et||J[ke]),yt.type=ke,yt.texture=et)}function ae(){const ke=U[re];ke!==void 0&&ke.type!==void 0&&(t.bindTexture(ke.type,null),ke.type=void 0,ke.texture=void 0)}function Z(){try{t.compressedTexImage2D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function he(){try{t.compressedTexImage3D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function be(){try{t.texSubImage2D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function we(){try{t.texSubImage3D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function ve(){try{t.compressedTexSubImage2D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function Re(){try{t.compressedTexSubImage3D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function Ae(){try{t.texStorage2D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function Oe(){try{t.texStorage3D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function qe(){try{t.texImage2D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function Fe(){try{t.texImage3D(...arguments)}catch(ke){Wn("WebGLState:",ke)}}function Ke(ke){j.equals(ke)===!1&&(t.scissor(ke.x,ke.y,ke.z,ke.w),j.copy(ke))}function je(ke){le.equals(ke)===!1&&(t.viewport(ke.x,ke.y,ke.z,ke.w),le.copy(ke))}function Te(ke,et){let ct=c.get(et);ct===void 0&&(ct=new WeakMap,c.set(et,ct));let yt=ct.get(ke);yt===void 0&&(yt=t.getUniformBlockIndex(et,ke.name),ct.set(ke,yt))}function Xe(ke,et){const yt=c.get(et).get(ke);l.get(et)!==yt&&(t.uniformBlockBinding(et,yt,ke.__bindingPointIndex),l.set(et,yt))}function ht(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),o.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),d={},re=null,U={},p={},m=new WeakMap,x=[],b=null,_=!1,S=null,M=null,C=null,A=null,N=null,D=null,R=null,L=new Nn(0,0,0),k=0,O=!1,F=null,B=null,Y=null,V=null,q=null,j.set(0,0,t.canvas.width,t.canvas.height),le.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:ee,disable:ie,bindFramebuffer:oe,drawBuffers:de,useProgram:ye,setBlending:fe,setMaterial:Se,setFlipSided:me,setCullFace:Pe,setLineWidth:ce,setPolygonOffset:He,setScissorTest:Be,activeTexture:Ge,bindTexture:We,unbindTexture:ae,compressedTexImage2D:Z,compressedTexImage3D:he,texImage2D:qe,texImage3D:Fe,updateUBOMapping:Te,uniformBlockBinding:Xe,texStorage2D:Ae,texStorage3D:Oe,texSubImage2D:be,texSubImage3D:we,compressedTexSubImage2D:ve,compressedTexSubImage3D:Re,scissor:Ke,viewport:je,reset:ht}}function rEe(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 Wt,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(ae,Z){return x?new OffscreenCanvas(ae,Z):WS("canvas")}function _(ae,Z,he){let be=1;const we=We(ae);if((we.width>he||we.height>he)&&(be=he/Math.max(we.width,we.height)),be<1)if(typeof HTMLImageElement<"u"&&ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ae instanceof ImageBitmap||typeof VideoFrame<"u"&&ae instanceof VideoFrame){const ve=Math.floor(be*we.width),Re=Math.floor(be*we.height);p===void 0&&(p=b(ve,Re));const Ae=Z?b(ve,Re):p;return Ae.width=ve,Ae.height=Re,Ae.getContext("2d").drawImage(ae,0,0,ve,Re),Sn("WebGLRenderer: Texture has been resized from ("+we.width+"x"+we.height+") to ("+ve+"x"+Re+")."),Ae}else return"data"in ae&&Sn("WebGLRenderer: Image in DataTexture is too big ("+we.width+"x"+we.height+")."),ae;return ae}function S(ae){return ae.generateMipmaps}function M(ae){t.generateMipmap(ae)}function C(ae){return ae.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:ae.isWebGL3DRenderTarget?t.TEXTURE_3D:ae.isWebGLArrayRenderTarget||ae.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(ae,Z,he,be,we=!1){if(ae!==null){if(t[ae]!==void 0)return t[ae];Sn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ae+"'")}let ve=Z;if(Z===t.RED&&(he===t.FLOAT&&(ve=t.R32F),he===t.HALF_FLOAT&&(ve=t.R16F),he===t.UNSIGNED_BYTE&&(ve=t.R8)),Z===t.RED_INTEGER&&(he===t.UNSIGNED_BYTE&&(ve=t.R8UI),he===t.UNSIGNED_SHORT&&(ve=t.R16UI),he===t.UNSIGNED_INT&&(ve=t.R32UI),he===t.BYTE&&(ve=t.R8I),he===t.SHORT&&(ve=t.R16I),he===t.INT&&(ve=t.R32I)),Z===t.RG&&(he===t.FLOAT&&(ve=t.RG32F),he===t.HALF_FLOAT&&(ve=t.RG16F),he===t.UNSIGNED_BYTE&&(ve=t.RG8)),Z===t.RG_INTEGER&&(he===t.UNSIGNED_BYTE&&(ve=t.RG8UI),he===t.UNSIGNED_SHORT&&(ve=t.RG16UI),he===t.UNSIGNED_INT&&(ve=t.RG32UI),he===t.BYTE&&(ve=t.RG8I),he===t.SHORT&&(ve=t.RG16I),he===t.INT&&(ve=t.RG32I)),Z===t.RGB_INTEGER&&(he===t.UNSIGNED_BYTE&&(ve=t.RGB8UI),he===t.UNSIGNED_SHORT&&(ve=t.RGB16UI),he===t.UNSIGNED_INT&&(ve=t.RGB32UI),he===t.BYTE&&(ve=t.RGB8I),he===t.SHORT&&(ve=t.RGB16I),he===t.INT&&(ve=t.RGB32I)),Z===t.RGBA_INTEGER&&(he===t.UNSIGNED_BYTE&&(ve=t.RGBA8UI),he===t.UNSIGNED_SHORT&&(ve=t.RGBA16UI),he===t.UNSIGNED_INT&&(ve=t.RGBA32UI),he===t.BYTE&&(ve=t.RGBA8I),he===t.SHORT&&(ve=t.RGBA16I),he===t.INT&&(ve=t.RGBA32I)),Z===t.RGB&&(he===t.UNSIGNED_INT_5_9_9_9_REV&&(ve=t.RGB9_E5),he===t.UNSIGNED_INT_10F_11F_11F_REV&&(ve=t.R11F_G11F_B10F)),Z===t.RGBA){const Re=we?VS:li.getTransfer(be);he===t.FLOAT&&(ve=t.RGBA32F),he===t.HALF_FLOAT&&(ve=t.RGBA16F),he===t.UNSIGNED_BYTE&&(ve=Re===Hi?t.SRGB8_ALPHA8:t.RGBA8),he===t.UNSIGNED_SHORT_4_4_4_4&&(ve=t.RGBA4),he===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(ae,Z){let he;return ae?Z===null||Z===hd||Z===by?he=t.DEPTH24_STENCIL8:Z===Yl?he=t.DEPTH32F_STENCIL8:Z===yy&&(he=t.DEPTH24_STENCIL8,Sn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===hd||Z===by?he=t.DEPTH_COMPONENT24:Z===Yl?he=t.DEPTH_COMPONENT32F:Z===yy&&(he=t.DEPTH_COMPONENT16),he}function D(ae,Z){return S(ae)===!0||ae.isFramebufferTexture&&ae.minFilter!==Po&&ae.minFilter!==rs?Math.log2(Math.max(Z.width,Z.height))+1:ae.mipmaps!==void 0&&ae.mipmaps.length>0?ae.mipmaps.length:ae.isCompressedTexture&&Array.isArray(ae.image)?Z.mipmaps.length:1}function R(ae){const Z=ae.target;Z.removeEventListener("dispose",R),k(Z),Z.isVideoTexture&&d.delete(Z)}function L(ae){const Z=ae.target;Z.removeEventListener("dispose",L),F(Z)}function k(ae){const Z=r.get(ae);if(Z.__webglInit===void 0)return;const he=ae.source,be=m.get(he);if(be){const we=be[Z.__cacheKey];we.usedTimes--,we.usedTimes===0&&O(ae),Object.keys(be).length===0&&m.delete(he)}r.remove(ae)}function O(ae){const Z=r.get(ae);t.deleteTexture(Z.__webglTexture);const he=ae.source,be=m.get(he);delete be[Z.__cacheKey],o.memory.textures--}function F(ae){const Z=r.get(ae);if(ae.depthTexture&&(ae.depthTexture.dispose(),r.remove(ae.depthTexture)),ae.isWebGLCubeRenderTarget)for(let be=0;be<6;be++){if(Array.isArray(Z.__webglFramebuffer[be]))for(let we=0;we<Z.__webglFramebuffer[be].length;we++)t.deleteFramebuffer(Z.__webglFramebuffer[be][we]);else t.deleteFramebuffer(Z.__webglFramebuffer[be]);Z.__webglDepthbuffer&&t.deleteRenderbuffer(Z.__webglDepthbuffer[be])}else{if(Array.isArray(Z.__webglFramebuffer))for(let be=0;be<Z.__webglFramebuffer.length;be++)t.deleteFramebuffer(Z.__webglFramebuffer[be]);else t.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&t.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&t.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let be=0;be<Z.__webglColorRenderbuffer.length;be++)Z.__webglColorRenderbuffer[be]&&t.deleteRenderbuffer(Z.__webglColorRenderbuffer[be]);Z.__webglDepthRenderbuffer&&t.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}const he=ae.textures;for(let be=0,we=he.length;be<we;be++){const ve=r.get(he[be]);ve.__webglTexture&&(t.deleteTexture(ve.__webglTexture),o.memory.textures--),r.remove(he[be])}r.remove(ae)}let B=0;function Y(){B=0}function V(){const ae=B;return ae>=i.maxTextures&&Sn("WebGLTextures: Trying to use "+ae+" texture units while this GPU supports only "+i.maxTextures),B+=1,ae}function q(ae){const Z=[];return Z.push(ae.wrapS),Z.push(ae.wrapT),Z.push(ae.wrapR||0),Z.push(ae.magFilter),Z.push(ae.minFilter),Z.push(ae.anisotropy),Z.push(ae.internalFormat),Z.push(ae.format),Z.push(ae.type),Z.push(ae.generateMipmaps),Z.push(ae.premultiplyAlpha),Z.push(ae.flipY),Z.push(ae.unpackAlignment),Z.push(ae.colorSpace),Z.join()}function G(ae,Z){const he=r.get(ae);if(ae.isVideoTexture&&Be(ae),ae.isRenderTargetTexture===!1&&ae.isExternalTexture!==!0&&ae.version>0&&he.__version!==ae.version){const be=ae.image;if(be===null)Sn("WebGLRenderer: Texture marked for update but no image data found.");else if(be.complete===!1)Sn("WebGLRenderer: Texture marked for update but image is incomplete");else{J(he,ae,Z);return}}else ae.isExternalTexture&&(he.__webglTexture=ae.sourceTexture?ae.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,he.__webglTexture,t.TEXTURE0+Z)}function $(ae,Z){const he=r.get(ae);if(ae.isRenderTargetTexture===!1&&ae.version>0&&he.__version!==ae.version){J(he,ae,Z);return}else ae.isExternalTexture&&(he.__webglTexture=ae.sourceTexture?ae.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,he.__webglTexture,t.TEXTURE0+Z)}function Q(ae,Z){const he=r.get(ae);if(ae.isRenderTargetTexture===!1&&ae.version>0&&he.__version!==ae.version){J(he,ae,Z);return}n.bindTexture(t.TEXTURE_3D,he.__webglTexture,t.TEXTURE0+Z)}function K(ae,Z){const he=r.get(ae);if(ae.isCubeDepthTexture!==!0&&ae.version>0&&he.__version!==ae.version){ee(he,ae,Z);return}n.bindTexture(t.TEXTURE_CUBE_MAP,he.__webglTexture,t.TEXTURE0+Z)}const re={[FS]:t.REPEAT,[Dc]:t.CLAMP_TO_EDGE,[US]:t.MIRRORED_REPEAT},U={[Po]:t.NEAREST,[_9]:t.NEAREST_MIPMAP_NEAREST,[v1]:t.NEAREST_MIPMAP_LINEAR,[rs]:t.LINEAR,[rS]:t.LINEAR_MIPMAP_NEAREST,[rh]:t.LINEAR_MIPMAP_LINEAR},H={[zY]:t.NEVER,[VY]:t.ALWAYS,[FY]:t.LESS,[BC]:t.LEQUAL,[UY]:t.EQUAL,[HC]:t.GEQUAL,[BY]:t.GREATER,[HY]:t.NOTEQUAL};function X(ae,Z){if(Z.type===Yl&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===rs||Z.magFilter===rS||Z.magFilter===v1||Z.magFilter===rh||Z.minFilter===rs||Z.minFilter===rS||Z.minFilter===v1||Z.minFilter===rh)&&Sn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ae,t.TEXTURE_WRAP_S,re[Z.wrapS]),t.texParameteri(ae,t.TEXTURE_WRAP_T,re[Z.wrapT]),(ae===t.TEXTURE_3D||ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ae,t.TEXTURE_WRAP_R,re[Z.wrapR]),t.texParameteri(ae,t.TEXTURE_MAG_FILTER,U[Z.magFilter]),t.texParameteri(ae,t.TEXTURE_MIN_FILTER,U[Z.minFilter]),Z.compareFunction&&(t.texParameteri(ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ae,t.TEXTURE_COMPARE_FUNC,H[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Po||Z.minFilter!==v1&&Z.minFilter!==rh||Z.type===Yl&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||r.get(Z).__currentAnisotropy){const he=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ae,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,i.getMaxAnisotropy())),r.get(Z).__currentAnisotropy=Z.anisotropy}}}function j(ae,Z){let he=!1;ae.__webglInit===void 0&&(ae.__webglInit=!0,Z.addEventListener("dispose",R));const be=Z.source;let we=m.get(be);we===void 0&&(we={},m.set(be,we));const ve=q(Z);if(ve!==ae.__cacheKey){we[ve]===void 0&&(we[ve]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,he=!0),we[ve].usedTimes++;const Re=we[ae.__cacheKey];Re!==void 0&&(we[ae.__cacheKey].usedTimes--,Re.usedTimes===0&&O(Z)),ae.__cacheKey=ve,ae.__webglTexture=we[ve].texture}return he}function le(ae,Z,he){return Math.floor(Math.floor(ae/he)/Z)}function se(ae,Z,he,be){const ve=ae.updateRanges;if(ve.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,Z.width,Z.height,he,be,Z.data);else{ve.sort((Fe,Ke)=>Fe.start-Ke.start);let Re=0;for(let Fe=1;Fe<ve.length;Fe++){const Ke=ve[Re],je=ve[Fe],Te=Ke.start+Ke.count,Xe=le(je.start,Z.width,4),ht=le(Ke.start,Z.width,4);je.start<=Te+1&&Xe===ht&&le(je.start+je.count-1,Z.width,4)===Xe?Ke.count=Math.max(Ke.count,je.start+je.count-Ke.start):(++Re,ve[Re]=je)}ve.length=Re+1;const Ae=t.getParameter(t.UNPACK_ROW_LENGTH),Oe=t.getParameter(t.UNPACK_SKIP_PIXELS),qe=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,Z.width);for(let Fe=0,Ke=ve.length;Fe<Ke;Fe++){const je=ve[Fe],Te=Math.floor(je.start/4),Xe=Math.ceil(je.count/4),ht=Te%Z.width,ke=Math.floor(Te/Z.width),et=Xe,ct=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,ht),t.pixelStorei(t.UNPACK_SKIP_ROWS,ke),n.texSubImage2D(t.TEXTURE_2D,0,ht,ke,et,ct,he,be,Z.data)}ae.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,Ae),t.pixelStorei(t.UNPACK_SKIP_PIXELS,Oe),t.pixelStorei(t.UNPACK_SKIP_ROWS,qe)}}function J(ae,Z,he){let be=t.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(be=t.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(be=t.TEXTURE_3D);const we=j(ae,Z),ve=Z.source;n.bindTexture(be,ae.__webglTexture,t.TEXTURE0+he);const Re=r.get(ve);if(ve.version!==Re.__version||we===!0){n.activeTexture(t.TEXTURE0+he);const Ae=li.getPrimaries(li.workingColorSpace),Oe=Z.colorSpace===dp?null:li.getPrimaries(Z.colorSpace),qe=Z.colorSpace===dp||Ae===Oe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);let Fe=_(Z.image,!1,i.maxTextureSize);Fe=Ge(Z,Fe);const Ke=s.convert(Z.format,Z.colorSpace),je=s.convert(Z.type);let Te=A(Z.internalFormat,Ke,je,Z.colorSpace,Z.isVideoTexture);X(be,Z);let Xe;const ht=Z.mipmaps,ke=Z.isVideoTexture!==!0,et=Re.__version===void 0||we===!0,ct=ve.dataReady,yt=D(Z,Fe);if(Z.isDepthTexture)Te=N(Z.format===Z0,Z.type),et&&(ke?n.texStorage2D(t.TEXTURE_2D,1,Te,Fe.width,Fe.height):n.texImage2D(t.TEXTURE_2D,0,Te,Fe.width,Fe.height,0,Ke,je,null));else if(Z.isDataTexture)if(ht.length>0){ke&&et&&n.texStorage2D(t.TEXTURE_2D,yt,Te,ht[0].width,ht[0].height);for(let lt=0,Je=ht.length;lt<Je;lt++)Xe=ht[lt],ke?ct&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,Xe.width,Xe.height,Ke,je,Xe.data):n.texImage2D(t.TEXTURE_2D,lt,Te,Xe.width,Xe.height,0,Ke,je,Xe.data);Z.generateMipmaps=!1}else ke?(et&&n.texStorage2D(t.TEXTURE_2D,yt,Te,Fe.width,Fe.height),ct&&se(Z,Fe,Ke,je)):n.texImage2D(t.TEXTURE_2D,0,Te,Fe.width,Fe.height,0,Ke,je,Fe.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){ke&&et&&n.texStorage3D(t.TEXTURE_2D_ARRAY,yt,Te,ht[0].width,ht[0].height,Fe.depth);for(let lt=0,Je=ht.length;lt<Je;lt++)if(Xe=ht[lt],Z.format!==vl)if(Ke!==null)if(ke){if(ct)if(Z.layerUpdates.size>0){const Ee=PR(Xe.width,Xe.height,Z.format,Z.type);for(const Ze of Z.layerUpdates){const Ie=Xe.data.subarray(Ze*Ee/Xe.data.BYTES_PER_ELEMENT,(Ze+1)*Ee/Xe.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,Ze,Xe.width,Xe.height,1,Ke,Ie)}Z.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,0,Xe.width,Xe.height,Fe.depth,Ke,Xe.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,lt,Te,Xe.width,Xe.height,Fe.depth,0,Xe.data,0,0);else Sn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ke?ct&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,0,Xe.width,Xe.height,Fe.depth,Ke,je,Xe.data):n.texImage3D(t.TEXTURE_2D_ARRAY,lt,Te,Xe.width,Xe.height,Fe.depth,0,Ke,je,Xe.data)}else{ke&&et&&n.texStorage2D(t.TEXTURE_2D,yt,Te,ht[0].width,ht[0].height);for(let lt=0,Je=ht.length;lt<Je;lt++)Xe=ht[lt],Z.format!==vl?Ke!==null?ke?ct&&n.compressedTexSubImage2D(t.TEXTURE_2D,lt,0,0,Xe.width,Xe.height,Ke,Xe.data):n.compressedTexImage2D(t.TEXTURE_2D,lt,Te,Xe.width,Xe.height,0,Xe.data):Sn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ke?ct&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,Xe.width,Xe.height,Ke,je,Xe.data):n.texImage2D(t.TEXTURE_2D,lt,Te,Xe.width,Xe.height,0,Ke,je,Xe.data)}else if(Z.isDataArrayTexture)if(ke){if(et&&n.texStorage3D(t.TEXTURE_2D_ARRAY,yt,Te,Fe.width,Fe.height,Fe.depth),ct)if(Z.layerUpdates.size>0){const lt=PR(Fe.width,Fe.height,Z.format,Z.type);for(const Je of Z.layerUpdates){const Ee=Fe.data.subarray(Je*lt/Fe.data.BYTES_PER_ELEMENT,(Je+1)*lt/Fe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Je,Fe.width,Fe.height,1,Ke,je,Ee)}Z.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Fe.width,Fe.height,Fe.depth,Ke,je,Fe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Te,Fe.width,Fe.height,Fe.depth,0,Ke,je,Fe.data);else if(Z.isData3DTexture)ke?(et&&n.texStorage3D(t.TEXTURE_3D,yt,Te,Fe.width,Fe.height,Fe.depth),ct&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Fe.width,Fe.height,Fe.depth,Ke,je,Fe.data)):n.texImage3D(t.TEXTURE_3D,0,Te,Fe.width,Fe.height,Fe.depth,0,Ke,je,Fe.data);else if(Z.isFramebufferTexture){if(et)if(ke)n.texStorage2D(t.TEXTURE_2D,yt,Te,Fe.width,Fe.height);else{let lt=Fe.width,Je=Fe.height;for(let Ee=0;Ee<yt;Ee++)n.texImage2D(t.TEXTURE_2D,Ee,Te,lt,Je,0,Ke,je,null),lt>>=1,Je>>=1}}else if(ht.length>0){if(ke&&et){const lt=We(ht[0]);n.texStorage2D(t.TEXTURE_2D,yt,Te,lt.width,lt.height)}for(let lt=0,Je=ht.length;lt<Je;lt++)Xe=ht[lt],ke?ct&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,Ke,je,Xe):n.texImage2D(t.TEXTURE_2D,lt,Te,Ke,je,Xe);Z.generateMipmaps=!1}else if(ke){if(et){const lt=We(Fe);n.texStorage2D(t.TEXTURE_2D,yt,Te,lt.width,lt.height)}ct&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ke,je,Fe)}else n.texImage2D(t.TEXTURE_2D,0,Te,Ke,je,Fe);S(Z)&&M(be),Re.__version=ve.version,Z.onUpdate&&Z.onUpdate(Z)}ae.__version=Z.version}function ee(ae,Z,he){if(Z.image.length!==6)return;const be=j(ae,Z),we=Z.source;n.bindTexture(t.TEXTURE_CUBE_MAP,ae.__webglTexture,t.TEXTURE0+he);const ve=r.get(we);if(we.version!==ve.__version||be===!0){n.activeTexture(t.TEXTURE0+he);const Re=li.getPrimaries(li.workingColorSpace),Ae=Z.colorSpace===dp?null:li.getPrimaries(Z.colorSpace),Oe=Z.colorSpace===dp||Re===Ae?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Oe);const qe=Z.isCompressedTexture||Z.image[0].isCompressedTexture,Fe=Z.image[0]&&Z.image[0].isDataTexture,Ke=[];for(let Je=0;Je<6;Je++)!qe&&!Fe?Ke[Je]=_(Z.image[Je],!0,i.maxCubemapSize):Ke[Je]=Fe?Z.image[Je].image:Z.image[Je],Ke[Je]=Ge(Z,Ke[Je]);const je=Ke[0],Te=s.convert(Z.format,Z.colorSpace),Xe=s.convert(Z.type),ht=A(Z.internalFormat,Te,Xe,Z.colorSpace),ke=Z.isVideoTexture!==!0,et=ve.__version===void 0||be===!0,ct=we.dataReady;let yt=D(Z,je);X(t.TEXTURE_CUBE_MAP,Z);let lt;if(qe){ke&&et&&n.texStorage2D(t.TEXTURE_CUBE_MAP,yt,ht,je.width,je.height);for(let Je=0;Je<6;Je++){lt=Ke[Je].mipmaps;for(let Ee=0;Ee<lt.length;Ee++){const Ze=lt[Ee];Z.format!==vl?Te!==null?ke?ct&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee,0,0,Ze.width,Ze.height,Te,Ze.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee,ht,Ze.width,Ze.height,0,Ze.data):Sn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ke?ct&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee,0,0,Ze.width,Ze.height,Te,Xe,Ze.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee,ht,Ze.width,Ze.height,0,Te,Xe,Ze.data)}}}else{if(lt=Z.mipmaps,ke&&et){lt.length>0&&yt++;const Je=We(Ke[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,yt,ht,Je.width,Je.height)}for(let Je=0;Je<6;Je++)if(Fe){ke?ct&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,0,0,Ke[Je].width,Ke[Je].height,Te,Xe,Ke[Je].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,ht,Ke[Je].width,Ke[Je].height,0,Te,Xe,Ke[Je].data);for(let Ee=0;Ee<lt.length;Ee++){const Ie=lt[Ee].image[Je].image;ke?ct&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee+1,0,0,Ie.width,Ie.height,Te,Xe,Ie.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee+1,ht,Ie.width,Ie.height,0,Te,Xe,Ie.data)}}else{ke?ct&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,0,0,Te,Xe,Ke[Je]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,ht,Te,Xe,Ke[Je]);for(let Ee=0;Ee<lt.length;Ee++){const Ze=lt[Ee];ke?ct&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee+1,0,0,Te,Xe,Ze.image[Je]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ee+1,ht,Te,Xe,Ze.image[Je])}}}S(Z)&&M(t.TEXTURE_CUBE_MAP),ve.__version=we.version,Z.onUpdate&&Z.onUpdate(Z)}ae.__version=Z.version}function ie(ae,Z,he,be,we,ve){const Re=s.convert(he.format,he.colorSpace),Ae=s.convert(he.type),Oe=A(he.internalFormat,Re,Ae,he.colorSpace),qe=r.get(Z),Fe=r.get(he);if(Fe.__renderTarget=Z,!qe.__hasExternalTextures){const Ke=Math.max(1,Z.width>>ve),je=Math.max(1,Z.height>>ve);we===t.TEXTURE_3D||we===t.TEXTURE_2D_ARRAY?n.texImage3D(we,ve,Oe,Ke,je,Z.depth,0,Re,Ae,null):n.texImage2D(we,ve,Oe,Ke,je,0,Re,Ae,null)}n.bindFramebuffer(t.FRAMEBUFFER,ae),He(Z)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,be,we,Fe.__webglTexture,0,ce(Z)):(we===t.TEXTURE_2D||we>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,be,we,Fe.__webglTexture,ve),n.bindFramebuffer(t.FRAMEBUFFER,null)}function oe(ae,Z,he){if(t.bindRenderbuffer(t.RENDERBUFFER,ae),Z.depthBuffer){const be=Z.depthTexture,we=be&&be.isDepthTexture?be.type:null,ve=N(Z.stencilBuffer,we),Re=Z.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;He(Z)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ce(Z),ve,Z.width,Z.height):he?t.renderbufferStorageMultisample(t.RENDERBUFFER,ce(Z),ve,Z.width,Z.height):t.renderbufferStorage(t.RENDERBUFFER,ve,Z.width,Z.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Re,t.RENDERBUFFER,ae)}else{const be=Z.textures;for(let we=0;we<be.length;we++){const ve=be[we],Re=s.convert(ve.format,ve.colorSpace),Ae=s.convert(ve.type),Oe=A(ve.internalFormat,Re,Ae,ve.colorSpace);He(Z)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ce(Z),Oe,Z.width,Z.height):he?t.renderbufferStorageMultisample(t.RENDERBUFFER,ce(Z),Oe,Z.width,Z.height):t.renderbufferStorage(t.RENDERBUFFER,Oe,Z.width,Z.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function de(ae,Z,he){const be=Z.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,ae),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const we=r.get(Z.depthTexture);if(we.__renderTarget=Z,(!we.__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),be){if(we.__webglInit===void 0&&(we.__webglInit=!0,Z.depthTexture.addEventListener("dispose",R)),we.__webglTexture===void 0){we.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,we.__webglTexture),X(t.TEXTURE_CUBE_MAP,Z.depthTexture);const qe=s.convert(Z.depthTexture.format),Fe=s.convert(Z.depthTexture.type);let Ke;Z.depthTexture.format===mh?Ke=t.DEPTH_COMPONENT24:Z.depthTexture.format===Z0&&(Ke=t.DEPTH24_STENCIL8);for(let je=0;je<6;je++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+je,0,Ke,Z.width,Z.height,0,qe,Fe,null)}}else G(Z.depthTexture,0);const ve=we.__webglTexture,Re=ce(Z),Ae=be?t.TEXTURE_CUBE_MAP_POSITIVE_X+he:t.TEXTURE_2D,Oe=Z.depthTexture.format===Z0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(Z.depthTexture.format===mh)He(Z)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Oe,Ae,ve,0,Re):t.framebufferTexture2D(t.FRAMEBUFFER,Oe,Ae,ve,0);else if(Z.depthTexture.format===Z0)He(Z)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Oe,Ae,ve,0,Re):t.framebufferTexture2D(t.FRAMEBUFFER,Oe,Ae,ve,0);else throw new Error("Unknown depthTexture format")}function ye(ae){const Z=r.get(ae),he=ae.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==ae.depthTexture){const be=ae.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),be){const we=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,be.removeEventListener("dispose",we)};be.addEventListener("dispose",we),Z.__depthDisposeCallback=we}Z.__boundDepthTexture=be}if(ae.depthTexture&&!Z.__autoAllocateDepthBuffer)if(he)for(let be=0;be<6;be++)de(Z.__webglFramebuffer[be],ae,be);else{const be=ae.texture.mipmaps;be&&be.length>0?de(Z.__webglFramebuffer[0],ae,0):de(Z.__webglFramebuffer,ae,0)}else if(he){Z.__webglDepthbuffer=[];for(let be=0;be<6;be++)if(n.bindFramebuffer(t.FRAMEBUFFER,Z.__webglFramebuffer[be]),Z.__webglDepthbuffer[be]===void 0)Z.__webglDepthbuffer[be]=t.createRenderbuffer(),oe(Z.__webglDepthbuffer[be],ae,!1);else{const we=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=Z.__webglDepthbuffer[be];t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,we,t.RENDERBUFFER,ve)}}else{const be=ae.texture.mipmaps;if(be&&be.length>0?n.bindFramebuffer(t.FRAMEBUFFER,Z.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=t.createRenderbuffer(),oe(Z.__webglDepthbuffer,ae,!1);else{const we=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ve=Z.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,we,t.RENDERBUFFER,ve)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function ge(ae,Z,he){const be=r.get(ae);Z!==void 0&&ie(be.__webglFramebuffer,ae,ae.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),he!==void 0&&ye(ae)}function Me(ae){const Z=ae.texture,he=r.get(ae),be=r.get(Z);ae.addEventListener("dispose",L);const we=ae.textures,ve=ae.isWebGLCubeRenderTarget===!0,Re=we.length>1;if(Re||(be.__webglTexture===void 0&&(be.__webglTexture=t.createTexture()),be.__version=Z.version,o.memory.textures++),ve){he.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(Z.mipmaps&&Z.mipmaps.length>0){he.__webglFramebuffer[Ae]=[];for(let Oe=0;Oe<Z.mipmaps.length;Oe++)he.__webglFramebuffer[Ae][Oe]=t.createFramebuffer()}else he.__webglFramebuffer[Ae]=t.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){he.__webglFramebuffer=[];for(let Ae=0;Ae<Z.mipmaps.length;Ae++)he.__webglFramebuffer[Ae]=t.createFramebuffer()}else he.__webglFramebuffer=t.createFramebuffer();if(Re)for(let Ae=0,Oe=we.length;Ae<Oe;Ae++){const qe=r.get(we[Ae]);qe.__webglTexture===void 0&&(qe.__webglTexture=t.createTexture(),o.memory.textures++)}if(ae.samples>0&&He(ae)===!1){he.__webglMultisampledFramebuffer=t.createFramebuffer(),he.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,he.__webglMultisampledFramebuffer);for(let Ae=0;Ae<we.length;Ae++){const Oe=we[Ae];he.__webglColorRenderbuffer[Ae]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,he.__webglColorRenderbuffer[Ae]);const qe=s.convert(Oe.format,Oe.colorSpace),Fe=s.convert(Oe.type),Ke=A(Oe.internalFormat,qe,Fe,Oe.colorSpace,ae.isXRRenderTarget===!0),je=ce(ae);t.renderbufferStorageMultisample(t.RENDERBUFFER,je,Ke,ae.width,ae.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.RENDERBUFFER,he.__webglColorRenderbuffer[Ae])}t.bindRenderbuffer(t.RENDERBUFFER,null),ae.depthBuffer&&(he.__webglDepthRenderbuffer=t.createRenderbuffer(),oe(he.__webglDepthRenderbuffer,ae,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ve){n.bindTexture(t.TEXTURE_CUBE_MAP,be.__webglTexture),X(t.TEXTURE_CUBE_MAP,Z);for(let Ae=0;Ae<6;Ae++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Oe=0;Oe<Z.mipmaps.length;Oe++)ie(he.__webglFramebuffer[Ae][Oe],ae,Z,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,Oe);else ie(he.__webglFramebuffer[Ae],ae,Z,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);S(Z)&&M(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Re){for(let Ae=0,Oe=we.length;Ae<Oe;Ae++){const qe=we[Ae],Fe=r.get(qe);let Ke=t.TEXTURE_2D;(ae.isWebGL3DRenderTarget||ae.isWebGLArrayRenderTarget)&&(Ke=ae.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ke,Fe.__webglTexture),X(Ke,qe),ie(he.__webglFramebuffer,ae,qe,t.COLOR_ATTACHMENT0+Ae,Ke,0),S(qe)&&M(Ke)}n.unbindTexture()}else{let Ae=t.TEXTURE_2D;if((ae.isWebGL3DRenderTarget||ae.isWebGLArrayRenderTarget)&&(Ae=ae.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ae,be.__webglTexture),X(Ae,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Oe=0;Oe<Z.mipmaps.length;Oe++)ie(he.__webglFramebuffer[Oe],ae,Z,t.COLOR_ATTACHMENT0,Ae,Oe);else ie(he.__webglFramebuffer,ae,Z,t.COLOR_ATTACHMENT0,Ae,0);S(Z)&&M(Ae),n.unbindTexture()}ae.depthBuffer&&ye(ae)}function fe(ae){const Z=ae.textures;for(let he=0,be=Z.length;he<be;he++){const we=Z[he];if(S(we)){const ve=C(ae),Re=r.get(we).__webglTexture;n.bindTexture(ve,Re),M(ve),n.unbindTexture()}}}const Se=[],me=[];function Pe(ae){if(ae.samples>0){if(He(ae)===!1){const Z=ae.textures,he=ae.width,be=ae.height;let we=t.COLOR_BUFFER_BIT;const ve=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Re=r.get(ae),Ae=Z.length>1;if(Ae)for(let qe=0;qe<Z.length;qe++)n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Oe=ae.texture.mipmaps;Oe&&Oe.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let qe=0;qe<Z.length;qe++){if(ae.resolveDepthBuffer&&(ae.depthBuffer&&(we|=t.DEPTH_BUFFER_BIT),ae.stencilBuffer&&ae.resolveStencilBuffer&&(we|=t.STENCIL_BUFFER_BIT)),Ae){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Re.__webglColorRenderbuffer[qe]);const Fe=r.get(Z[qe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Fe,0)}t.blitFramebuffer(0,0,he,be,0,0,he,be,we,t.NEAREST),l===!0&&(Se.length=0,me.length=0,Se.push(t.COLOR_ATTACHMENT0+qe),ae.depthBuffer&&ae.resolveDepthBuffer===!1&&(Se.push(ve),me.push(ve),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,me)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,Se))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),Ae)for(let qe=0;qe<Z.length;qe++){n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,Re.__webglColorRenderbuffer[qe]);const Fe=r.get(Z[qe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.TEXTURE_2D,Fe,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(ae.depthBuffer&&ae.resolveDepthBuffer===!1&&l){const Z=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Z])}}}function ce(ae){return Math.min(i.maxSamples,ae.samples)}function He(ae){const Z=r.get(ae);return ae.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function Be(ae){const Z=o.render.frame;d.get(ae)!==Z&&(d.set(ae,Z),ae.update())}function Ge(ae,Z){const he=ae.colorSpace,be=ae.format,we=ae.type;return ae.isCompressedTexture===!0||ae.isVideoTexture===!0||he!==vm&&he!==dp&&(li.getTransfer(he)===Hi?(be!==vl||we!==Gl)&&Sn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Wn("WebGLTextures: Unsupported texture color space:",he)),Z}function We(ae){return typeof HTMLImageElement<"u"&&ae instanceof HTMLImageElement?(c.width=ae.naturalWidth||ae.width,c.height=ae.naturalHeight||ae.height):typeof VideoFrame<"u"&&ae instanceof VideoFrame?(c.width=ae.displayWidth,c.height=ae.displayHeight):(c.width=ae.width,c.height=ae.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=Y,this.setTexture2D=G,this.setTexture2DArray=$,this.setTexture3D=Q,this.setTextureCube=K,this.rebindTextures=ge,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=ie,this.useMultisampledRTT=He,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function JK(t,e){function n(r,i=dp){let s;const o=li.getTransfer(i);if(r===Gl)return t.UNSIGNED_BYTE;if(r===OC)return t.UNSIGNED_SHORT_4_4_4_4;if(r===LC)return t.UNSIGNED_SHORT_5_5_5_1;if(r===M9)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===T9)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===S9)return t.BYTE;if(r===w9)return t.SHORT;if(r===yy)return t.UNSIGNED_SHORT;if(r===IC)return t.INT;if(r===hd)return t.UNSIGNED_INT;if(r===Yl)return t.FLOAT;if(r===ph)return t.HALF_FLOAT;if(r===C9)return t.ALPHA;if(r===E9)return t.RGB;if(r===vl)return t.RGBA;if(r===mh)return t.DEPTH_COMPONENT;if(r===Z0)return t.DEPTH_STENCIL;if(r===jC)return t.RED;if(r===Gw)return t.RED_INTEGER;if(r===_x)return t.RG;if(r===zC)return t.RG_INTEGER;if(r===FC)return t.RGBA_INTEGER;if(r===iS||r===sS||r===oS||r===aS)if(o===Hi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===iS)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===sS)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===oS)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===aS)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===iS)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===sS)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===oS)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===aS)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===y5||r===b5||r===_5||r===S5)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===y5)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===b5)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===_5)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===S5)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===w5||r===M5||r===T5||r===C5||r===E5||r===A5||r===N5)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===w5||r===M5)return o===Hi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===T5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===C5)return s.COMPRESSED_R11_EAC;if(r===E5)return s.COMPRESSED_SIGNED_R11_EAC;if(r===A5)return s.COMPRESSED_RG11_EAC;if(r===N5)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===k5||r===R5||r===P5||r===D5||r===I5||r===O5||r===L5||r===j5||r===z5||r===F5||r===U5||r===B5||r===H5||r===V5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===k5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===R5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===P5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===D5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===I5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===O5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===L5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===j5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===z5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===F5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===U5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===B5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===H5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===V5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===G5||r===W5||r===$5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===G5)return o===Hi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===W5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===$5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===q5||r===X5||r===Y5||r===K5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===q5)return s.COMPRESSED_RED_RGTC1_EXT;if(r===X5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Y5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===K5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===by?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const iEe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,sEe=`
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 oEe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new j9(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 vu({vertexShader:iEe,fragmentShader:sEe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Hs(new Ip(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class aEe extends Mh{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 oEe,M={},C=n.getContextAttributes();let A=null,N=null;const D=[],R=[],L=new Wt;let k=null;const O=new no;O.viewport=new hi;const F=new no;F.viewport=new hi;const B=[O,F],Y=new FK;let V=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ee=D[J];return ee===void 0&&(ee=new f2,D[J]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(J){let ee=D[J];return ee===void 0&&(ee=new f2,D[J]=ee),ee.getGripSpace()},this.getHand=function(J){let ee=D[J];return ee===void 0&&(ee=new f2,D[J]=ee),ee.getHandSpace()};function G(J){const ee=R.indexOf(J.inputSource);if(ee===-1)return;const ie=D[ee];ie!==void 0&&(ie.update(J.inputSource,J.frame,c||o),ie.dispatchEvent({type:J.type,data:J.inputSource}))}function $(){i.removeEventListener("select",G),i.removeEventListener("selectstart",G),i.removeEventListener("selectend",G),i.removeEventListener("squeeze",G),i.removeEventListener("squeezestart",G),i.removeEventListener("squeezeend",G),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",Q);for(let J=0;J<D.length;J++){const ee=R[J];ee!==null&&(R[J]=null,D[J].disconnect(ee))}V=null,q=null,S.reset();for(const J in M)delete M[J];e.setRenderTarget(A),x=null,m=null,p=null,i=null,N=null,se.stop(),r.isPresenting=!1,e.setPixelRatio(k),e.setSize(L.width,L.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,r.isPresenting===!0&&Sn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){a=J,r.isPresenting===!0&&Sn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(J){c=J},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(J){if(i=J,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",G),i.addEventListener("selectstart",G),i.addEventListener("selectend",G),i.addEventListener("squeeze",G),i.addEventListener("squeezestart",G),i.addEventListener("squeezeend",G),i.addEventListener("end",$),i.addEventListener("inputsourceschange",Q),C.xrCompatible!==!0&&await n.makeXRCompatible(),k=e.getPixelRatio(),e.getSize(L),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let ie=null,oe=null,de=null;C.depth&&(de=C.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ie=C.stencil?Z0:mh,oe=C.stencil?by:hd);const ye={colorFormat:n.RGBA8,depthFormat:de,scaleFactor:s};p=this.getBinding(),m=p.createProjectionLayer(ye),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),N=new mu(m.textureWidth,m.textureHeight,{format:vl,type:Gl,depthTexture:new wy(m.textureWidth,m.textureHeight,oe,void 0,void 0,void 0,void 0,void 0,void 0,ie),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const ie={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(i,n,ie),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),N=new mu(x.framebufferWidth,x.framebufferHeight,{format:vl,type:Gl,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),se.setContext(i),se.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function Q(J){for(let ee=0;ee<J.removed.length;ee++){const ie=J.removed[ee],oe=R.indexOf(ie);oe>=0&&(R[oe]=null,D[oe].disconnect(ie))}for(let ee=0;ee<J.added.length;ee++){const ie=J.added[ee];let oe=R.indexOf(ie);if(oe===-1){for(let ye=0;ye<D.length;ye++)if(ye>=R.length){R.push(ie),oe=ye;break}else if(R[ye]===null){R[ye]=ie,oe=ye;break}if(oe===-1)break}const de=D[oe];de&&de.connect(ie)}}const K=new Ve,re=new Ve;function U(J,ee,ie){K.setFromMatrixPosition(ee.matrixWorld),re.setFromMatrixPosition(ie.matrixWorld);const oe=K.distanceTo(re),de=ee.projectionMatrix.elements,ye=ie.projectionMatrix.elements,ge=de[14]/(de[10]-1),Me=de[14]/(de[10]+1),fe=(de[9]+1)/de[5],Se=(de[9]-1)/de[5],me=(de[8]-1)/de[0],Pe=(ye[8]+1)/ye[0],ce=ge*me,He=ge*Pe,Be=oe/(-me+Pe),Ge=Be*-me;if(ee.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(Ge),J.translateZ(Be),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),de[10]===-1)J.projectionMatrix.copy(ee.projectionMatrix),J.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const We=ge+Be,ae=Me+Be,Z=ce-Ge,he=He+(oe-Ge),be=fe*Me/ae*We,we=Se*Me/ae*We;J.projectionMatrix.makePerspective(Z,he,be,we,We,ae),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function H(J,ee){ee===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ee.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(i===null)return;let ee=J.near,ie=J.far;S.texture!==null&&(S.depthNear>0&&(ee=S.depthNear),S.depthFar>0&&(ie=S.depthFar)),Y.near=F.near=O.near=ee,Y.far=F.far=O.far=ie,(V!==Y.near||q!==Y.far)&&(i.updateRenderState({depthNear:Y.near,depthFar:Y.far}),V=Y.near,q=Y.far),Y.layers.mask=J.layers.mask|6,O.layers.mask=Y.layers.mask&-5,F.layers.mask=Y.layers.mask&-3;const oe=J.parent,de=Y.cameras;H(Y,oe);for(let ye=0;ye<de.length;ye++)H(de[ye],oe);de.length===2?U(Y,O,F):Y.projectionMatrix.copy(O.projectionMatrix),X(J,Y,oe)};function X(J,ee,ie){ie===null?J.matrix.copy(ee.matrixWorld):(J.matrix.copy(ie.matrixWorld),J.matrix.invert(),J.matrix.multiply(ee.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ee.projectionMatrix),J.projectionMatrixInverse.copy(ee.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=_y*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return Y},this.getFoveation=function(){if(!(m===null&&x===null))return l},this.setFoveation=function(J){l=J,m!==null&&(m.fixedFoveation=J),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=J)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(Y)},this.getCameraTexture=function(J){return M[J]};let j=null;function le(J,ee){if(d=ee.getViewerPose(c||o),b=ee,d!==null){const ie=d.views;x!==null&&(e.setRenderTargetFramebuffer(N,x.framebuffer),e.setRenderTarget(N));let oe=!1;ie.length!==Y.cameras.length&&(Y.cameras.length=0,oe=!0);for(let Me=0;Me<ie.length;Me++){const fe=ie[Me];let Se=null;if(x!==null)Se=x.getViewport(fe);else{const Pe=p.getViewSubImage(m,fe);Se=Pe.viewport,Me===0&&(e.setRenderTargetTextures(N,Pe.colorTexture,Pe.depthStencilTexture),e.setRenderTarget(N))}let me=B[Me];me===void 0&&(me=new no,me.layers.enable(Me),me.viewport=new hi,B[Me]=me),me.matrix.fromArray(fe.transform.matrix),me.matrix.decompose(me.position,me.quaternion,me.scale),me.projectionMatrix.fromArray(fe.projectionMatrix),me.projectionMatrixInverse.copy(me.projectionMatrix).invert(),me.viewport.set(Se.x,Se.y,Se.width,Se.height),Me===0&&(Y.matrix.copy(me.matrix),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)),oe===!0&&Y.cameras.push(me)}const de=i.enabledFeatures;if(de&&de.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){p=r.getBinding();const Me=p.getDepthInformation(ie[0]);Me&&Me.isValid&&Me.texture&&S.init(Me,i.renderState)}if(de&&de.includes("camera-access")&&_){e.state.unbindTexture(),p=r.getBinding();for(let Me=0;Me<ie.length;Me++){const fe=ie[Me].camera;if(fe){let Se=M[fe];Se||(Se=new j9,M[fe]=Se);const me=p.getCameraImage(fe);Se.sourceTexture=me}}}}for(let ie=0;ie<D.length;ie++){const oe=R[ie],de=D[ie];oe!==null&&de!==void 0&&de.update(oe,ee,c||o)}j&&j(J,ee),ee.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ee}),b=null}const se=new XK;se.setAnimationLoop(le),this.setAnimationLoop=function(J){j=J},this.dispose=function(){}}}const jg=new xu,lEe=new ur;function cEe(t,e){function n(S,M){S.matrixAutoUpdate===!0&&S.updateMatrix(),M.value.copy(S.matrix)}function r(S,M){M.color.getRGB(S.fogColor.value,gK(t)),M.isFog?(S.fogNear.value=M.near,S.fogFar.value=M.far):M.isFogExp2&&(S.fogDensity.value=M.density)}function i(S,M,C,A,N){M.isMeshBasicMaterial?s(S,M):M.isMeshLambertMaterial?(s(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshToonMaterial?(s(S,M),p(S,M)):M.isMeshPhongMaterial?(s(S,M),d(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshStandardMaterial?(s(S,M),m(S,M),M.isMeshPhysicalMaterial&&x(S,M,N)):M.isMeshMatcapMaterial?(s(S,M),b(S,M)):M.isMeshDepthMaterial?s(S,M):M.isMeshDistanceMaterial?(s(S,M),_(S,M)):M.isMeshNormalMaterial?s(S,M):M.isLineBasicMaterial?(o(S,M),M.isLineDashedMaterial&&a(S,M)):M.isPointsMaterial?l(S,M,C,A):M.isSpriteMaterial?c(S,M):M.isShadowMaterial?(S.color.value.copy(M.color),S.opacity.value=M.opacity):M.isShaderMaterial&&(M.uniformsNeedUpdate=!1)}function s(S,M){S.opacity.value=M.opacity,M.color&&S.diffuse.value.copy(M.color),M.emissive&&S.emissive.value.copy(M.emissive).multiplyScalar(M.emissiveIntensity),M.map&&(S.map.value=M.map,n(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.bumpMap&&(S.bumpMap.value=M.bumpMap,n(M.bumpMap,S.bumpMapTransform),S.bumpScale.value=M.bumpScale,M.side===Kl&&(S.bumpScale.value*=-1)),M.normalMap&&(S.normalMap.value=M.normalMap,n(M.normalMap,S.normalMapTransform),S.normalScale.value.copy(M.normalScale),M.side===Kl&&S.normalScale.value.negate()),M.displacementMap&&(S.displacementMap.value=M.displacementMap,n(M.displacementMap,S.displacementMapTransform),S.displacementScale.value=M.displacementScale,S.displacementBias.value=M.displacementBias),M.emissiveMap&&(S.emissiveMap.value=M.emissiveMap,n(M.emissiveMap,S.emissiveMapTransform)),M.specularMap&&(S.specularMap.value=M.specularMap,n(M.specularMap,S.specularMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest);const C=e.get(M),A=C.envMap,N=C.envMapRotation;A&&(S.envMap.value=A,jg.copy(N),jg.x*=-1,jg.y*=-1,jg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(jg.y*=-1,jg.z*=-1),S.envMapRotation.value.setFromMatrix4(lEe.makeRotationFromEuler(jg)),S.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=M.reflectivity,S.ior.value=M.ior,S.refractionRatio.value=M.refractionRatio),M.lightMap&&(S.lightMap.value=M.lightMap,S.lightMapIntensity.value=M.lightMapIntensity,n(M.lightMap,S.lightMapTransform)),M.aoMap&&(S.aoMap.value=M.aoMap,S.aoMapIntensity.value=M.aoMapIntensity,n(M.aoMap,S.aoMapTransform))}function o(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,M.map&&(S.map.value=M.map,n(M.map,S.mapTransform))}function a(S,M){S.dashSize.value=M.dashSize,S.totalSize.value=M.dashSize+M.gapSize,S.scale.value=M.scale}function l(S,M,C,A){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.size.value=M.size*C,S.scale.value=A*.5,M.map&&(S.map.value=M.map,n(M.map,S.uvTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function c(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.rotation.value=M.rotation,M.map&&(S.map.value=M.map,n(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function d(S,M){S.specular.value.copy(M.specular),S.shininess.value=Math.max(M.shininess,1e-4)}function p(S,M){M.gradientMap&&(S.gradientMap.value=M.gradientMap)}function m(S,M){S.metalness.value=M.metalness,M.metalnessMap&&(S.metalnessMap.value=M.metalnessMap,n(M.metalnessMap,S.metalnessMapTransform)),S.roughness.value=M.roughness,M.roughnessMap&&(S.roughnessMap.value=M.roughnessMap,n(M.roughnessMap,S.roughnessMapTransform)),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)}function x(S,M,C){S.ior.value=M.ior,M.sheen>0&&(S.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),S.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(S.sheenColorMap.value=M.sheenColorMap,n(M.sheenColorMap,S.sheenColorMapTransform)),M.sheenRoughnessMap&&(S.sheenRoughnessMap.value=M.sheenRoughnessMap,n(M.sheenRoughnessMap,S.sheenRoughnessMapTransform))),M.clearcoat>0&&(S.clearcoat.value=M.clearcoat,S.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(S.clearcoatMap.value=M.clearcoatMap,n(M.clearcoatMap,S.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,n(M.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(S.clearcoatNormalMap.value=M.clearcoatNormalMap,n(M.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===Kl&&S.clearcoatNormalScale.value.negate())),M.dispersion>0&&(S.dispersion.value=M.dispersion),M.iridescence>0&&(S.iridescence.value=M.iridescence,S.iridescenceIOR.value=M.iridescenceIOR,S.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(S.iridescenceMap.value=M.iridescenceMap,n(M.iridescenceMap,S.iridescenceMapTransform)),M.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=M.iridescenceThicknessMap,n(M.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),M.transmission>0&&(S.transmission.value=M.transmission,S.transmissionSamplerMap.value=C.texture,S.transmissionSamplerSize.value.set(C.width,C.height),M.transmissionMap&&(S.transmissionMap.value=M.transmissionMap,n(M.transmissionMap,S.transmissionMapTransform)),S.thickness.value=M.thickness,M.thicknessMap&&(S.thicknessMap.value=M.thicknessMap,n(M.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=M.attenuationDistance,S.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(S.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(S.anisotropyMap.value=M.anisotropyMap,n(M.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=M.specularIntensity,S.specularColor.value.copy(M.specularColor),M.specularColorMap&&(S.specularColorMap.value=M.specularColorMap,n(M.specularColorMap,S.specularColorMapTransform)),M.specularIntensityMap&&(S.specularIntensityMap.value=M.specularIntensityMap,n(M.specularIntensityMap,S.specularIntensityMapTransform))}function b(S,M){M.matcap&&(S.matcap.value=M.matcap)}function _(S,M){const C=e.get(M).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 uEe(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 R=e.render.frame;s[C.id]!==R&&(m(C),s[C.id]=R)}function d(C){const A=p();C.__bindingPointIndex=A;const N=t.createBuffer(),D=C.__size,R=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,D,R),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 Wn("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 R=0,L=N.length;R<L;R++){const k=Array.isArray(N[R])?N[R]:[N[R]];for(let O=0,F=k.length;O<F;O++){const B=k[O];if(x(B,R,O,D)===!0){const Y=B.__offset,V=Array.isArray(B.value)?B.value:[B.value];let q=0;for(let G=0;G<V.length;G++){const $=V[G],Q=_($);typeof $=="number"||typeof $=="boolean"?(B.__data[0]=$,t.bufferSubData(t.UNIFORM_BUFFER,Y+q,B.__data)):$.isMatrix3?(B.__data[0]=$.elements[0],B.__data[1]=$.elements[1],B.__data[2]=$.elements[2],B.__data[3]=0,B.__data[4]=$.elements[3],B.__data[5]=$.elements[4],B.__data[6]=$.elements[5],B.__data[7]=0,B.__data[8]=$.elements[6],B.__data[9]=$.elements[7],B.__data[10]=$.elements[8],B.__data[11]=0):($.toArray(B.__data,q),q+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,Y,B.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function x(C,A,N,D){const R=C.value,L=A+"_"+N;if(D[L]===void 0)return typeof R=="number"||typeof R=="boolean"?D[L]=R:D[L]=R.clone(),!0;{const k=D[L];if(typeof R=="number"||typeof R=="boolean"){if(k!==R)return D[L]=R,!0}else if(k.equals(R)===!1)return k.copy(R),!0}return!1}function b(C){const A=C.uniforms;let N=0;const D=16;for(let L=0,k=A.length;L<k;L++){const O=Array.isArray(A[L])?A[L]:[A[L]];for(let F=0,B=O.length;F<B;F++){const Y=O[F],V=Array.isArray(Y.value)?Y.value:[Y.value];for(let q=0,G=V.length;q<G;q++){const $=V[q],Q=_($),K=N%D,re=K%Q.boundary,U=K+re;N+=re,U!==0&&D-U<Q.storage&&(N+=D-U),Y.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=N,N+=Q.storage}}}const R=N%D;return R>0&&(N+=D-R),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?Sn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Sn("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 M(){for(const C in i)t.deleteBuffer(i[C]);o=[],i={},s={}}return{bind:l,update:c,dispose:M}}const dEe=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 Uf=null;function fEe(){return Uf===null&&(Uf=new ef(dEe,16,16,_x,ph),Uf.name="DFG_LUT",Uf.minFilter=rs,Uf.magFilter=rs,Uf.wrapS=Dc,Uf.wrapT=Dc,Uf.generateMipmaps=!1,Uf.needsUpdate=!0),Uf}class eZ{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=Gl}=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([FC,zC,Gw]),M=new Set([Gl,hd,yy,by,OC,LC]),C=new Uint32Array(4),A=new Int32Array(4);let N=null,D=null;const R=[],L=[];let k=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=hu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let F=!1;this._outputColorSpace=xl;let B=0,Y=0,V=null,q=-1,G=null;const $=new hi,Q=new hi;let K=null;const re=new Nn(0);let U=0,H=n.width,X=n.height,j=1,le=null,se=null;const J=new hi(0,0,H,X),ee=new hi(0,0,H,X);let ie=!1;const oe=new Xy;let de=!1,ye=!1;const ge=new ur,Me=new Ve,fe=new hi,Se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let me=!1;function Pe(){return V===null?j:1}let ce=r;function He(_e,nt){return n.getContext(_e,nt)}try{const _e={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${Hw}`),n.addEventListener("webglcontextlost",Ee,!1),n.addEventListener("webglcontextrestored",Ze,!1),n.addEventListener("webglcontextcreationerror",Ie,!1),ce===null){const nt="webgl2";if(ce=He(nt,_e),ce===null)throw He(nt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(_e){throw Wn("WebGLRenderer: "+_e.message),_e}let Be,Ge,We,ae,Z,he,be,we,ve,Re,Ae,Oe,qe,Fe,Ke,je,Te,Xe,ht,ke,et,ct,yt;function lt(){Be=new pTe(ce),Be.init(),et=new JK(ce,Be),Ge=new oTe(ce,Be,e,et),We=new nEe(ce,Be),Ge.reversedDepthBuffer&&m&&We.buffers.depth.setReversed(!0),ae=new xTe(ce),Z=new HCe,he=new rEe(ce,Be,We,Z,Ge,et,ae),be=new hTe(O),we=new SMe(ce),ct=new iTe(ce,we),ve=new mTe(ce,we,ae,ct),Re=new yTe(ce,ve,we,ct,ae),Xe=new vTe(ce,Ge,he),Ke=new aTe(Z),Ae=new BCe(O,be,Be,Ge,ct,Ke),Oe=new cEe(O,Z),qe=new GCe,Fe=new KCe(Be),Te=new rTe(O,be,We,Re,b,l),je=new tEe(O,Re,Ge),yt=new uEe(ce,ae,Ge,We),ht=new sTe(ce,Be,ae),ke=new gTe(ce,Be,ae),ae.programs=Ae.programs,O.capabilities=Ge,O.extensions=Be,O.properties=Z,O.renderLists=qe,O.shadowMap=je,O.state=We,O.info=ae}lt(),_!==Gl&&(k=new _Te(_,n.width,n.height,i,s));const Je=new aEe(O,ce);this.xr=Je,this.getContext=function(){return ce},this.getContextAttributes=function(){return ce.getContextAttributes()},this.forceContextLoss=function(){const _e=Be.get("WEBGL_lose_context");_e&&_e.loseContext()},this.forceContextRestore=function(){const _e=Be.get("WEBGL_lose_context");_e&&_e.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(_e){_e!==void 0&&(j=_e,this.setSize(H,X,!1))},this.getSize=function(_e){return _e.set(H,X)},this.setSize=function(_e,nt,mt=!0){if(Je.isPresenting){Sn("WebGLRenderer: Can't change size while VR device is presenting.");return}H=_e,X=nt,n.width=Math.floor(_e*j),n.height=Math.floor(nt*j),mt===!0&&(n.style.width=_e+"px",n.style.height=nt+"px"),k!==null&&k.setSize(n.width,n.height),this.setViewport(0,0,_e,nt)},this.getDrawingBufferSize=function(_e){return _e.set(H*j,X*j).floor()},this.setDrawingBufferSize=function(_e,nt,mt){H=_e,X=nt,j=mt,n.width=Math.floor(_e*mt),n.height=Math.floor(nt*mt),this.setViewport(0,0,_e,nt)},this.setEffects=function(_e){if(_===Gl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(_e){for(let nt=0;nt<_e.length;nt++)if(_e[nt].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}k.setEffects(_e||[])},this.getCurrentViewport=function(_e){return _e.copy($)},this.getViewport=function(_e){return _e.copy(J)},this.setViewport=function(_e,nt,mt,xt){_e.isVector4?J.set(_e.x,_e.y,_e.z,_e.w):J.set(_e,nt,mt,xt),We.viewport($.copy(J).multiplyScalar(j).round())},this.getScissor=function(_e){return _e.copy(ee)},this.setScissor=function(_e,nt,mt,xt){_e.isVector4?ee.set(_e.x,_e.y,_e.z,_e.w):ee.set(_e,nt,mt,xt),We.scissor(Q.copy(ee).multiplyScalar(j).round())},this.getScissorTest=function(){return ie},this.setScissorTest=function(_e){We.setScissorTest(ie=_e)},this.setOpaqueSort=function(_e){le=_e},this.setTransparentSort=function(_e){se=_e},this.getClearColor=function(_e){return _e.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor(...arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha(...arguments)},this.clear=function(_e=!0,nt=!0,mt=!0){let xt=0;if(_e){let vt=!1;if(V!==null){const qt=V.texture.format;vt=S.has(qt)}if(vt){const qt=V.texture.type,tn=M.has(qt),Kt=Te.getClearColor(),Vt=Te.getClearAlpha(),dn=Kt.r,_n=Kt.g,An=Kt.b;tn?(C[0]=dn,C[1]=_n,C[2]=An,C[3]=Vt,ce.clearBufferuiv(ce.COLOR,0,C)):(A[0]=dn,A[1]=_n,A[2]=An,A[3]=Vt,ce.clearBufferiv(ce.COLOR,0,A))}else xt|=ce.COLOR_BUFFER_BIT}nt&&(xt|=ce.DEPTH_BUFFER_BIT),mt&&(xt|=ce.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),xt!==0&&ce.clear(xt)},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",Ee,!1),n.removeEventListener("webglcontextrestored",Ze,!1),n.removeEventListener("webglcontextcreationerror",Ie,!1),Te.dispose(),qe.dispose(),Fe.dispose(),Z.dispose(),be.dispose(),Re.dispose(),ct.dispose(),yt.dispose(),Ae.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",Ht),Je.removeEventListener("sessionend",en),Ut.stop()};function Ee(_e){_e.preventDefault(),$S("WebGLRenderer: Context Lost."),F=!0}function Ze(){$S("WebGLRenderer: Context Restored."),F=!1;const _e=ae.autoReset,nt=je.enabled,mt=je.autoUpdate,xt=je.needsUpdate,vt=je.type;lt(),ae.autoReset=_e,je.enabled=nt,je.autoUpdate=mt,je.needsUpdate=xt,je.type=vt}function Ie(_e){Wn("WebGLRenderer: A WebGL context could not be created. Reason: ",_e.statusMessage)}function Ue(_e){const nt=_e.target;nt.removeEventListener("dispose",Ue),rt(nt)}function rt(_e){ut(_e),Z.remove(_e)}function ut(_e){const nt=Z.get(_e).programs;nt!==void 0&&(nt.forEach(function(mt){Ae.releaseProgram(mt)}),_e.isShaderMaterial&&Ae.releaseShaderCache(_e))}this.renderBufferDirect=function(_e,nt,mt,xt,vt,qt){nt===null&&(nt=Se);const tn=vt.isMesh&&vt.matrixWorld.determinant()<0,Kt=Lt(_e,nt,mt,xt,vt);We.setMaterial(xt,tn);let Vt=mt.index,dn=1;if(xt.wireframe===!0){if(Vt=ve.getWireframeAttribute(mt),Vt===void 0)return;dn=2}const _n=mt.drawRange,An=mt.attributes.position;let rn=_n.start*dn,Gn=(_n.start+_n.count)*dn;qt!==null&&(rn=Math.max(rn,qt.start*dn),Gn=Math.min(Gn,(qt.start+qt.count)*dn)),Vt!==null?(rn=Math.max(rn,0),Gn=Math.min(Gn,Vt.count)):An!=null&&(rn=Math.max(rn,0),Gn=Math.min(Gn,An.count));const xr=Gn-rn;if(xr<0||xr===1/0)return;ct.setup(vt,xt,Kt,mt,Vt);let sr,Xn=ht;if(Vt!==null&&(sr=we.get(Vt),Xn=ke,Xn.setIndex(sr)),vt.isMesh)xt.wireframe===!0?(We.setLineWidth(xt.wireframeLinewidth*Pe()),Xn.setMode(ce.LINES)):Xn.setMode(ce.TRIANGLES);else if(vt.isLine){let dr=xt.linewidth;dr===void 0&&(dr=1),We.setLineWidth(dr*Pe()),vt.isLineSegments?Xn.setMode(ce.LINES):vt.isLineLoop?Xn.setMode(ce.LINE_LOOP):Xn.setMode(ce.LINE_STRIP)}else vt.isPoints?Xn.setMode(ce.POINTS):vt.isSprite&&Xn.setMode(ce.TRIANGLES);if(vt.isBatchedMesh)if(vt._multiDrawInstances!==null)qS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Xn.renderMultiDrawInstances(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount,vt._multiDrawInstances);else if(Be.get("WEBGL_multi_draw"))Xn.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else{const dr=vt._multiDrawStarts,un=vt._multiDrawCounts,ss=vt._multiDrawCount,Ln=Vt?we.get(Vt).bytesPerElement:1,vs=Z.get(xt).currentProgram.getUniforms();for(let Rs=0;Rs<ss;Rs++)vs.setValue(ce,"_gl_DrawID",Rs),Xn.render(dr[Rs]/Ln,un[Rs])}else if(vt.isInstancedMesh)Xn.renderInstances(rn,xr,vt.count);else if(mt.isInstancedBufferGeometry){const dr=mt._maxInstanceCount!==void 0?mt._maxInstanceCount:1/0,un=Math.min(mt.instanceCount,dr);Xn.renderInstances(rn,xr,un)}else Xn.render(rn,xr)};function Dt(_e,nt,mt){_e.transparent===!0&&_e.side===ru&&_e.forceSinglePass===!1?(_e.side=Kl,_e.needsUpdate=!0,At(_e,nt,mt),_e.side=Cp,_e.needsUpdate=!0,At(_e,nt,mt),_e.side=ru):At(_e,nt,mt)}this.compile=function(_e,nt,mt=null){mt===null&&(mt=_e),D=Fe.get(mt),D.init(nt),L.push(D),mt.traverseVisible(function(vt){vt.isLight&&vt.layers.test(nt.layers)&&(D.pushLight(vt),vt.castShadow&&D.pushShadow(vt))}),_e!==mt&&_e.traverseVisible(function(vt){vt.isLight&&vt.layers.test(nt.layers)&&(D.pushLight(vt),vt.castShadow&&D.pushShadow(vt))}),D.setupLights();const xt=new Set;return _e.traverse(function(vt){if(!(vt.isMesh||vt.isPoints||vt.isLine||vt.isSprite))return;const qt=vt.material;if(qt)if(Array.isArray(qt))for(let tn=0;tn<qt.length;tn++){const Kt=qt[tn];Dt(Kt,mt,vt),xt.add(Kt)}else Dt(qt,mt,vt),xt.add(qt)}),D=L.pop(),xt},this.compileAsync=function(_e,nt,mt=null){const xt=this.compile(_e,nt,mt);return new Promise(vt=>{function qt(){if(xt.forEach(function(tn){Z.get(tn).currentProgram.isReady()&&xt.delete(tn)}),xt.size===0){vt(_e);return}setTimeout(qt,10)}Be.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let Rt=null;function St(_e){Rt&&Rt(_e)}function Ht(){Ut.stop()}function en(){Ut.start()}const Ut=new XK;Ut.setAnimationLoop(St),typeof self<"u"&&Ut.setContext(self),this.setAnimationLoop=function(_e){Rt=_e,Je.setAnimationLoop(_e),_e===null?Ut.stop():Ut.start()},Je.addEventListener("sessionstart",Ht),Je.addEventListener("sessionend",en),this.render=function(_e,nt){if(nt!==void 0&&nt.isCamera!==!0){Wn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;const mt=Je.enabled===!0&&Je.isPresenting===!0,xt=k!==null&&(V===null||mt)&&k.begin(O,V);if(_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),nt.parent===null&&nt.matrixWorldAutoUpdate===!0&&nt.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(k===null||k.isCompositing()===!1)&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(nt),nt=Je.getCamera()),_e.isScene===!0&&_e.onBeforeRender(O,_e,nt,V),D=Fe.get(_e,L.length),D.init(nt),L.push(D),ge.multiplyMatrices(nt.projectionMatrix,nt.matrixWorldInverse),oe.setFromProjectionMatrix(ge,lu,nt.reversedDepth),ye=this.localClippingEnabled,de=Ke.init(this.clippingPlanes,ye),N=qe.get(_e,R.length),N.init(),R.push(N),Je.enabled===!0&&Je.isPresenting===!0){const tn=O.xr.getDepthSensingMesh();tn!==null&&$e(tn,nt,-1/0,O.sortObjects)}$e(_e,nt,0,O.sortObjects),N.finish(),O.sortObjects===!0&&N.sort(le,se),me=Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1,me&&Te.addToRenderList(N,_e),this.info.render.frame++,de===!0&&Ke.beginShadows();const vt=D.state.shadowsArray;if(je.render(vt,_e,nt),de===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset(),(xt&&k.hasRenderPass())===!1){const tn=N.opaque,Kt=N.transmissive;if(D.setupLights(),nt.isArrayCamera){const Vt=nt.cameras;if(Kt.length>0)for(let dn=0,_n=Vt.length;dn<_n;dn++){const An=Vt[dn];Tt(tn,Kt,_e,An)}me&&Te.render(_e);for(let dn=0,_n=Vt.length;dn<_n;dn++){const An=Vt[dn];dt(N,_e,An,An.viewport)}}else Kt.length>0&&Tt(tn,Kt,_e,nt),me&&Te.render(_e),dt(N,_e,nt)}V!==null&&Y===0&&(he.updateMultisampleRenderTarget(V),he.updateRenderTargetMipmap(V)),xt&&k.end(O),_e.isScene===!0&&_e.onAfterRender(O,_e,nt),ct.resetDefaultState(),q=-1,G=null,L.pop(),L.length>0?(D=L[L.length-1],de===!0&&Ke.setGlobalState(O.clippingPlanes,D.state.camera)):D=null,R.pop(),R.length>0?N=R[R.length-1]:N=null};function $e(_e,nt,mt,xt){if(_e.visible===!1)return;if(_e.layers.test(nt.layers)){if(_e.isGroup)mt=_e.renderOrder;else if(_e.isLOD)_e.autoUpdate===!0&&_e.update(nt);else if(_e.isLight)D.pushLight(_e),_e.castShadow&&D.pushShadow(_e);else if(_e.isSprite){if(!_e.frustumCulled||oe.intersectsSprite(_e)){xt&&fe.setFromMatrixPosition(_e.matrixWorld).applyMatrix4(ge);const tn=Re.update(_e),Kt=_e.material;Kt.visible&&N.push(_e,tn,Kt,mt,fe.z,null)}}else if((_e.isMesh||_e.isLine||_e.isPoints)&&(!_e.frustumCulled||oe.intersectsObject(_e))){const tn=Re.update(_e),Kt=_e.material;if(xt&&(_e.boundingSphere!==void 0?(_e.boundingSphere===null&&_e.computeBoundingSphere(),fe.copy(_e.boundingSphere.center)):(tn.boundingSphere===null&&tn.computeBoundingSphere(),fe.copy(tn.boundingSphere.center)),fe.applyMatrix4(_e.matrixWorld).applyMatrix4(ge)),Array.isArray(Kt)){const Vt=tn.groups;for(let dn=0,_n=Vt.length;dn<_n;dn++){const An=Vt[dn],rn=Kt[An.materialIndex];rn&&rn.visible&&N.push(_e,tn,rn,mt,fe.z,An)}}else Kt.visible&&N.push(_e,tn,Kt,mt,fe.z,null)}}const qt=_e.children;for(let tn=0,Kt=qt.length;tn<Kt;tn++)$e(qt[tn],nt,mt,xt)}function dt(_e,nt,mt,xt){const{opaque:vt,transmissive:qt,transparent:tn}=_e;D.setupLightsView(mt),de===!0&&Ke.setGlobalState(O.clippingPlanes,mt),xt&&We.viewport($.copy(xt)),vt.length>0&&Bt(vt,nt,mt),qt.length>0&&Bt(qt,nt,mt),tn.length>0&&Bt(tn,nt,mt),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function Tt(_e,nt,mt,xt){if((mt.isScene===!0?mt.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[xt.id]===void 0){const rn=Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[xt.id]=new mu(1,1,{generateMipmaps:!0,type:rn?ph:Gl,minFilter:rh,samples:Ge.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:li.workingColorSpace})}const qt=D.state.transmissionRenderTarget[xt.id],tn=xt.viewport||$;qt.setSize(tn.z*O.transmissionResolutionScale,tn.w*O.transmissionResolutionScale);const Kt=O.getRenderTarget(),Vt=O.getActiveCubeFace(),dn=O.getActiveMipmapLevel();O.setRenderTarget(qt),O.getClearColor(re),U=O.getClearAlpha(),U<1&&O.setClearColor(16777215,.5),O.clear(),me&&Te.render(mt);const _n=O.toneMapping;O.toneMapping=hu;const An=xt.viewport;if(xt.viewport!==void 0&&(xt.viewport=void 0),D.setupLightsView(xt),de===!0&&Ke.setGlobalState(O.clippingPlanes,xt),Bt(_e,mt,xt),he.updateMultisampleRenderTarget(qt),he.updateRenderTargetMipmap(qt),Be.has("WEBGL_multisampled_render_to_texture")===!1){let rn=!1;for(let Gn=0,xr=nt.length;Gn<xr;Gn++){const sr=nt[Gn],{object:Xn,geometry:dr,material:un,group:ss}=sr;if(un.side===ru&&Xn.layers.test(xt.layers)){const Ln=un.side;un.side=Kl,un.needsUpdate=!0,Ct(Xn,mt,xt,dr,un,ss),un.side=Ln,un.needsUpdate=!0,rn=!0}}rn===!0&&(he.updateMultisampleRenderTarget(qt),he.updateRenderTargetMipmap(qt))}O.setRenderTarget(Kt,Vt,dn),O.setClearColor(re,U),An!==void 0&&(xt.viewport=An),O.toneMapping=_n}function Bt(_e,nt,mt){const xt=nt.isScene===!0?nt.overrideMaterial:null;for(let vt=0,qt=_e.length;vt<qt;vt++){const tn=_e[vt],{object:Kt,geometry:Vt,group:dn}=tn;let _n=tn.material;_n.allowOverride===!0&&xt!==null&&(_n=xt),Kt.layers.test(mt.layers)&&Ct(Kt,nt,mt,Vt,_n,dn)}}function Ct(_e,nt,mt,xt,vt,qt){_e.onBeforeRender(O,nt,mt,xt,vt,qt),_e.modelViewMatrix.multiplyMatrices(mt.matrixWorldInverse,_e.matrixWorld),_e.normalMatrix.getNormalMatrix(_e.modelViewMatrix),vt.onBeforeRender(O,nt,mt,xt,_e,qt),vt.transparent===!0&&vt.side===ru&&vt.forceSinglePass===!1?(vt.side=Kl,vt.needsUpdate=!0,O.renderBufferDirect(mt,nt,xt,vt,_e,qt),vt.side=Cp,vt.needsUpdate=!0,O.renderBufferDirect(mt,nt,xt,vt,_e,qt),vt.side=ru):O.renderBufferDirect(mt,nt,xt,vt,_e,qt),_e.onAfterRender(O,nt,mt,xt,vt,qt)}function At(_e,nt,mt){nt.isScene!==!0&&(nt=Se);const xt=Z.get(_e),vt=D.state.lights,qt=D.state.shadowsArray,tn=vt.state.version,Kt=Ae.getParameters(_e,vt.state,qt,nt,mt),Vt=Ae.getProgramCacheKey(Kt);let dn=xt.programs;xt.environment=_e.isMeshStandardMaterial||_e.isMeshLambertMaterial||_e.isMeshPhongMaterial?nt.environment:null,xt.fog=nt.fog;const _n=_e.isMeshStandardMaterial||_e.isMeshLambertMaterial&&!_e.envMap||_e.isMeshPhongMaterial&&!_e.envMap;xt.envMap=be.get(_e.envMap||xt.environment,_n),xt.envMapRotation=xt.environment!==null&&_e.envMap===null?nt.environmentRotation:_e.envMapRotation,dn===void 0&&(_e.addEventListener("dispose",Ue),dn=new Map,xt.programs=dn);let An=dn.get(Vt);if(An!==void 0){if(xt.currentProgram===An&&xt.lightsStateVersion===tn)return cn(_e,Kt),An}else Kt.uniforms=Ae.getUniforms(_e),_e.onBeforeCompile(Kt,O),An=Ae.acquireProgram(Kt,Vt),dn.set(Vt,An),xt.uniforms=Kt.uniforms;const rn=xt.uniforms;return(!_e.isShaderMaterial&&!_e.isRawShaderMaterial||_e.clipping===!0)&&(rn.clippingPlanes=Ke.uniform),cn(_e,Kt),xt.needsLights=Zt(_e),xt.lightsStateVersion=tn,xt.needsLights&&(rn.ambientLightColor.value=vt.state.ambient,rn.lightProbe.value=vt.state.probe,rn.directionalLights.value=vt.state.directional,rn.directionalLightShadows.value=vt.state.directionalShadow,rn.spotLights.value=vt.state.spot,rn.spotLightShadows.value=vt.state.spotShadow,rn.rectAreaLights.value=vt.state.rectArea,rn.ltc_1.value=vt.state.rectAreaLTC1,rn.ltc_2.value=vt.state.rectAreaLTC2,rn.pointLights.value=vt.state.point,rn.pointLightShadows.value=vt.state.pointShadow,rn.hemisphereLights.value=vt.state.hemi,rn.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,rn.spotLightMatrix.value=vt.state.spotLightMatrix,rn.spotLightMap.value=vt.state.spotLightMap,rn.pointShadowMatrix.value=vt.state.pointShadowMatrix),xt.currentProgram=An,xt.uniformsList=null,An}function Ot(_e){if(_e.uniformsList===null){const nt=_e.currentProgram.getUniforms();_e.uniformsList=h2.seqWithValue(nt.seq,_e.uniforms)}return _e.uniformsList}function cn(_e,nt){const mt=Z.get(_e);mt.outputColorSpace=nt.outputColorSpace,mt.batching=nt.batching,mt.batchingColor=nt.batchingColor,mt.instancing=nt.instancing,mt.instancingColor=nt.instancingColor,mt.instancingMorph=nt.instancingMorph,mt.skinning=nt.skinning,mt.morphTargets=nt.morphTargets,mt.morphNormals=nt.morphNormals,mt.morphColors=nt.morphColors,mt.morphTargetsCount=nt.morphTargetsCount,mt.numClippingPlanes=nt.numClippingPlanes,mt.numIntersection=nt.numClipIntersection,mt.vertexAlphas=nt.vertexAlphas,mt.vertexTangents=nt.vertexTangents,mt.toneMapping=nt.toneMapping}function Lt(_e,nt,mt,xt,vt){nt.isScene!==!0&&(nt=Se),he.resetTextureUnits();const qt=nt.fog,tn=xt.isMeshStandardMaterial||xt.isMeshLambertMaterial||xt.isMeshPhongMaterial?nt.environment:null,Kt=V===null?O.outputColorSpace:V.isXRRenderTarget===!0?V.texture.colorSpace:vm,Vt=xt.isMeshStandardMaterial||xt.isMeshLambertMaterial&&!xt.envMap||xt.isMeshPhongMaterial&&!xt.envMap,dn=be.get(xt.envMap||tn,Vt),_n=xt.vertexColors===!0&&!!mt.attributes.color&&mt.attributes.color.itemSize===4,An=!!mt.attributes.tangent&&(!!xt.normalMap||xt.anisotropy>0),rn=!!mt.morphAttributes.position,Gn=!!mt.morphAttributes.normal,xr=!!mt.morphAttributes.color;let sr=hu;xt.toneMapped&&(V===null||V.isXRRenderTarget===!0)&&(sr=O.toneMapping);const Xn=mt.morphAttributes.position||mt.morphAttributes.normal||mt.morphAttributes.color,dr=Xn!==void 0?Xn.length:0,un=Z.get(xt),ss=D.state.lights;if(de===!0&&(ye===!0||_e!==G)){const ji=_e===G&&xt.id===q;Ke.setState(xt,_e,ji)}let Ln=!1;xt.version===un.__version?(un.needsLights&&un.lightsStateVersion!==ss.state.version||un.outputColorSpace!==Kt||vt.isBatchedMesh&&un.batching===!1||!vt.isBatchedMesh&&un.batching===!0||vt.isBatchedMesh&&un.batchingColor===!0&&vt.colorTexture===null||vt.isBatchedMesh&&un.batchingColor===!1&&vt.colorTexture!==null||vt.isInstancedMesh&&un.instancing===!1||!vt.isInstancedMesh&&un.instancing===!0||vt.isSkinnedMesh&&un.skinning===!1||!vt.isSkinnedMesh&&un.skinning===!0||vt.isInstancedMesh&&un.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&un.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&un.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&un.instancingMorph===!1&&vt.morphTexture!==null||un.envMap!==dn||xt.fog===!0&&un.fog!==qt||un.numClippingPlanes!==void 0&&(un.numClippingPlanes!==Ke.numPlanes||un.numIntersection!==Ke.numIntersection)||un.vertexAlphas!==_n||un.vertexTangents!==An||un.morphTargets!==rn||un.morphNormals!==Gn||un.morphColors!==xr||un.toneMapping!==sr||un.morphTargetsCount!==dr)&&(Ln=!0):(Ln=!0,un.__version=xt.version);let vs=un.currentProgram;Ln===!0&&(vs=At(xt,nt,vt));let Rs=!1,Li=!1,ys=!1;const _r=vs.getUniforms(),pi=un.uniforms;if(We.useProgram(vs.program)&&(Rs=!0,Li=!0,ys=!0),xt.id!==q&&(q=xt.id,Li=!0),Rs||G!==_e){We.buffers.depth.getReversed()&&_e.reversedDepth!==!0&&(_e._reversedDepth=!0,_e.updateProjectionMatrix()),_r.setValue(ce,"projectionMatrix",_e.projectionMatrix),_r.setValue(ce,"viewMatrix",_e.matrixWorldInverse);const ea=_r.map.cameraPosition;ea!==void 0&&ea.setValue(ce,Me.setFromMatrixPosition(_e.matrixWorld)),Ge.logarithmicDepthBuffer&&_r.setValue(ce,"logDepthBufFC",2/(Math.log(_e.far+1)/Math.LN2)),(xt.isMeshPhongMaterial||xt.isMeshToonMaterial||xt.isMeshLambertMaterial||xt.isMeshBasicMaterial||xt.isMeshStandardMaterial||xt.isShaderMaterial)&&_r.setValue(ce,"isOrthographic",_e.isOrthographicCamera===!0),G!==_e&&(G=_e,Li=!0,ys=!0)}if(un.needsLights&&(ss.state.directionalShadowMap.length>0&&_r.setValue(ce,"directionalShadowMap",ss.state.directionalShadowMap,he),ss.state.spotShadowMap.length>0&&_r.setValue(ce,"spotShadowMap",ss.state.spotShadowMap,he),ss.state.pointShadowMap.length>0&&_r.setValue(ce,"pointShadowMap",ss.state.pointShadowMap,he)),vt.isSkinnedMesh){_r.setOptional(ce,vt,"bindMatrix"),_r.setOptional(ce,vt,"bindMatrixInverse");const ji=vt.skeleton;ji&&(ji.boneTexture===null&&ji.computeBoneTexture(),_r.setValue(ce,"boneTexture",ji.boneTexture,he))}vt.isBatchedMesh&&(_r.setOptional(ce,vt,"batchingTexture"),_r.setValue(ce,"batchingTexture",vt._matricesTexture,he),_r.setOptional(ce,vt,"batchingIdTexture"),_r.setValue(ce,"batchingIdTexture",vt._indirectTexture,he),_r.setOptional(ce,vt,"batchingColorTexture"),vt._colorsTexture!==null&&_r.setValue(ce,"batchingColorTexture",vt._colorsTexture,he));const Ps=mt.morphAttributes;if((Ps.position!==void 0||Ps.normal!==void 0||Ps.color!==void 0)&&Xe.update(vt,mt,vs),(Li||un.receiveShadow!==vt.receiveShadow)&&(un.receiveShadow=vt.receiveShadow,_r.setValue(ce,"receiveShadow",vt.receiveShadow)),(xt.isMeshStandardMaterial||xt.isMeshLambertMaterial||xt.isMeshPhongMaterial)&&xt.envMap===null&&nt.environment!==null&&(pi.envMapIntensity.value=nt.environmentIntensity),pi.dfgLUT!==void 0&&(pi.dfgLUT.value=fEe()),Li&&(_r.setValue(ce,"toneMappingExposure",O.toneMappingExposure),un.needsLights&&wt(pi,ys),qt&&xt.fog===!0&&Oe.refreshFogUniforms(pi,qt),Oe.refreshMaterialUniforms(pi,xt,j,X,D.state.transmissionRenderTarget[_e.id]),h2.upload(ce,Ot(un),pi,he)),xt.isShaderMaterial&&xt.uniformsNeedUpdate===!0&&(h2.upload(ce,Ot(un),pi,he),xt.uniformsNeedUpdate=!1),xt.isSpriteMaterial&&_r.setValue(ce,"center",vt.center),_r.setValue(ce,"modelViewMatrix",vt.modelViewMatrix),_r.setValue(ce,"normalMatrix",vt.normalMatrix),_r.setValue(ce,"modelMatrix",vt.matrixWorld),xt.isShaderMaterial||xt.isRawShaderMaterial){const ji=xt.uniformsGroups;for(let ea=0,va=ji.length;ea<va;ea++){const ka=ji[ea];yt.update(ka,vs),yt.bind(ka,vs)}}return vs}function wt(_e,nt){_e.ambientLightColor.needsUpdate=nt,_e.lightProbe.needsUpdate=nt,_e.directionalLights.needsUpdate=nt,_e.directionalLightShadows.needsUpdate=nt,_e.pointLights.needsUpdate=nt,_e.pointLightShadows.needsUpdate=nt,_e.spotLights.needsUpdate=nt,_e.spotLightShadows.needsUpdate=nt,_e.rectAreaLights.needsUpdate=nt,_e.hemisphereLights.needsUpdate=nt}function Zt(_e){return _e.isMeshLambertMaterial||_e.isMeshToonMaterial||_e.isMeshPhongMaterial||_e.isMeshStandardMaterial||_e.isShadowMaterial||_e.isShaderMaterial&&_e.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return V},this.setRenderTargetTextures=function(_e,nt,mt){const xt=Z.get(_e);xt.__autoAllocateDepthBuffer=_e.resolveDepthBuffer===!1,xt.__autoAllocateDepthBuffer===!1&&(xt.__useRenderToTexture=!1),Z.get(_e.texture).__webglTexture=nt,Z.get(_e.depthTexture).__webglTexture=xt.__autoAllocateDepthBuffer?void 0:mt,xt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(_e,nt){const mt=Z.get(_e);mt.__webglFramebuffer=nt,mt.__useDefaultFramebuffer=nt===void 0};const Jt=ce.createFramebuffer();this.setRenderTarget=function(_e,nt=0,mt=0){V=_e,B=nt,Y=mt;let xt=null,vt=!1,qt=!1;if(_e){const Kt=Z.get(_e);if(Kt.__useDefaultFramebuffer!==void 0){We.bindFramebuffer(ce.FRAMEBUFFER,Kt.__webglFramebuffer),$.copy(_e.viewport),Q.copy(_e.scissor),K=_e.scissorTest,We.viewport($),We.scissor(Q),We.setScissorTest(K),q=-1;return}else if(Kt.__webglFramebuffer===void 0)he.setupRenderTarget(_e);else if(Kt.__hasExternalTextures)he.rebindTextures(_e,Z.get(_e.texture).__webglTexture,Z.get(_e.depthTexture).__webglTexture);else if(_e.depthBuffer){const _n=_e.depthTexture;if(Kt.__boundDepthTexture!==_n){if(_n!==null&&Z.has(_n)&&(_e.width!==_n.image.width||_e.height!==_n.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");he.setupDepthRenderbuffer(_e)}}const Vt=_e.texture;(Vt.isData3DTexture||Vt.isDataArrayTexture||Vt.isCompressedArrayTexture)&&(qt=!0);const dn=Z.get(_e).__webglFramebuffer;_e.isWebGLCubeRenderTarget?(Array.isArray(dn[nt])?xt=dn[nt][mt]:xt=dn[nt],vt=!0):_e.samples>0&&he.useMultisampledRTT(_e)===!1?xt=Z.get(_e).__webglMultisampledFramebuffer:Array.isArray(dn)?xt=dn[mt]:xt=dn,$.copy(_e.viewport),Q.copy(_e.scissor),K=_e.scissorTest}else $.copy(J).multiplyScalar(j).floor(),Q.copy(ee).multiplyScalar(j).floor(),K=ie;if(mt!==0&&(xt=Jt),We.bindFramebuffer(ce.FRAMEBUFFER,xt)&&We.drawBuffers(_e,xt),We.viewport($),We.scissor(Q),We.setScissorTest(K),vt){const Kt=Z.get(_e.texture);ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_CUBE_MAP_POSITIVE_X+nt,Kt.__webglTexture,mt)}else if(qt){const Kt=nt;for(let Vt=0;Vt<_e.textures.length;Vt++){const dn=Z.get(_e.textures[Vt]);ce.framebufferTextureLayer(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0+Vt,dn.__webglTexture,mt,Kt)}}else if(_e!==null&&mt!==0){const Kt=Z.get(_e.texture);ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,Kt.__webglTexture,mt)}q=-1},this.readRenderTargetPixels=function(_e,nt,mt,xt,vt,qt,tn,Kt=0){if(!(_e&&_e.isWebGLRenderTarget)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Vt=Z.get(_e).__webglFramebuffer;if(_e.isWebGLCubeRenderTarget&&tn!==void 0&&(Vt=Vt[tn]),Vt){We.bindFramebuffer(ce.FRAMEBUFFER,Vt);try{const dn=_e.textures[Kt],_n=dn.format,An=dn.type;if(_e.textures.length>1&&ce.readBuffer(ce.COLOR_ATTACHMENT0+Kt),!Ge.textureFormatReadable(_n)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ge.textureTypeReadable(An)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}nt>=0&&nt<=_e.width-xt&&mt>=0&&mt<=_e.height-vt&&ce.readPixels(nt,mt,xt,vt,et.convert(_n),et.convert(An),qt)}finally{const dn=V!==null?Z.get(V).__webglFramebuffer:null;We.bindFramebuffer(ce.FRAMEBUFFER,dn)}}},this.readRenderTargetPixelsAsync=async function(_e,nt,mt,xt,vt,qt,tn,Kt=0){if(!(_e&&_e.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Vt=Z.get(_e).__webglFramebuffer;if(_e.isWebGLCubeRenderTarget&&tn!==void 0&&(Vt=Vt[tn]),Vt)if(nt>=0&&nt<=_e.width-xt&&mt>=0&&mt<=_e.height-vt){We.bindFramebuffer(ce.FRAMEBUFFER,Vt);const dn=_e.textures[Kt],_n=dn.format,An=dn.type;if(_e.textures.length>1&&ce.readBuffer(ce.COLOR_ATTACHMENT0+Kt),!Ge.textureFormatReadable(_n))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ge.textureTypeReadable(An))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const rn=ce.createBuffer();ce.bindBuffer(ce.PIXEL_PACK_BUFFER,rn),ce.bufferData(ce.PIXEL_PACK_BUFFER,qt.byteLength,ce.STREAM_READ),ce.readPixels(nt,mt,xt,vt,et.convert(_n),et.convert(An),0);const Gn=V!==null?Z.get(V).__webglFramebuffer:null;We.bindFramebuffer(ce.FRAMEBUFFER,Gn);const xr=ce.fenceSync(ce.SYNC_GPU_COMMANDS_COMPLETE,0);return ce.flush(),await Cwe(ce,xr,4),ce.bindBuffer(ce.PIXEL_PACK_BUFFER,rn),ce.getBufferSubData(ce.PIXEL_PACK_BUFFER,0,qt),ce.deleteBuffer(rn),ce.deleteSync(xr),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(_e,nt=null,mt=0){const xt=Math.pow(2,-mt),vt=Math.floor(_e.image.width*xt),qt=Math.floor(_e.image.height*xt),tn=nt!==null?nt.x:0,Kt=nt!==null?nt.y:0;he.setTexture2D(_e,0),ce.copyTexSubImage2D(ce.TEXTURE_2D,mt,0,0,tn,Kt,vt,qt),We.unbindTexture()};const vn=ce.createFramebuffer(),Fn=ce.createFramebuffer();this.copyTextureToTexture=function(_e,nt,mt=null,xt=null,vt=0,qt=0){let tn,Kt,Vt,dn,_n,An,rn,Gn,xr;const sr=_e.isCompressedTexture?_e.mipmaps[qt]:_e.image;if(mt!==null)tn=mt.max.x-mt.min.x,Kt=mt.max.y-mt.min.y,Vt=mt.isBox3?mt.max.z-mt.min.z:1,dn=mt.min.x,_n=mt.min.y,An=mt.isBox3?mt.min.z:0;else{const pi=Math.pow(2,-vt);tn=Math.floor(sr.width*pi),Kt=Math.floor(sr.height*pi),_e.isDataArrayTexture?Vt=sr.depth:_e.isData3DTexture?Vt=Math.floor(sr.depth*pi):Vt=1,dn=0,_n=0,An=0}xt!==null?(rn=xt.x,Gn=xt.y,xr=xt.z):(rn=0,Gn=0,xr=0);const Xn=et.convert(nt.format),dr=et.convert(nt.type);let un;nt.isData3DTexture?(he.setTexture3D(nt,0),un=ce.TEXTURE_3D):nt.isDataArrayTexture||nt.isCompressedArrayTexture?(he.setTexture2DArray(nt,0),un=ce.TEXTURE_2D_ARRAY):(he.setTexture2D(nt,0),un=ce.TEXTURE_2D),ce.pixelStorei(ce.UNPACK_FLIP_Y_WEBGL,nt.flipY),ce.pixelStorei(ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,nt.premultiplyAlpha),ce.pixelStorei(ce.UNPACK_ALIGNMENT,nt.unpackAlignment);const ss=ce.getParameter(ce.UNPACK_ROW_LENGTH),Ln=ce.getParameter(ce.UNPACK_IMAGE_HEIGHT),vs=ce.getParameter(ce.UNPACK_SKIP_PIXELS),Rs=ce.getParameter(ce.UNPACK_SKIP_ROWS),Li=ce.getParameter(ce.UNPACK_SKIP_IMAGES);ce.pixelStorei(ce.UNPACK_ROW_LENGTH,sr.width),ce.pixelStorei(ce.UNPACK_IMAGE_HEIGHT,sr.height),ce.pixelStorei(ce.UNPACK_SKIP_PIXELS,dn),ce.pixelStorei(ce.UNPACK_SKIP_ROWS,_n),ce.pixelStorei(ce.UNPACK_SKIP_IMAGES,An);const ys=_e.isDataArrayTexture||_e.isData3DTexture,_r=nt.isDataArrayTexture||nt.isData3DTexture;if(_e.isDepthTexture){const pi=Z.get(_e),Ps=Z.get(nt),ji=Z.get(pi.__renderTarget),ea=Z.get(Ps.__renderTarget);We.bindFramebuffer(ce.READ_FRAMEBUFFER,ji.__webglFramebuffer),We.bindFramebuffer(ce.DRAW_FRAMEBUFFER,ea.__webglFramebuffer);for(let va=0;va<Vt;va++)ys&&(ce.framebufferTextureLayer(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,Z.get(_e).__webglTexture,vt,An+va),ce.framebufferTextureLayer(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,Z.get(nt).__webglTexture,qt,xr+va)),ce.blitFramebuffer(dn,_n,tn,Kt,rn,Gn,tn,Kt,ce.DEPTH_BUFFER_BIT,ce.NEAREST);We.bindFramebuffer(ce.READ_FRAMEBUFFER,null),We.bindFramebuffer(ce.DRAW_FRAMEBUFFER,null)}else if(vt!==0||_e.isRenderTargetTexture||Z.has(_e)){const pi=Z.get(_e),Ps=Z.get(nt);We.bindFramebuffer(ce.READ_FRAMEBUFFER,vn),We.bindFramebuffer(ce.DRAW_FRAMEBUFFER,Fn);for(let ji=0;ji<Vt;ji++)ys?ce.framebufferTextureLayer(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,pi.__webglTexture,vt,An+ji):ce.framebufferTexture2D(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,pi.__webglTexture,vt),_r?ce.framebufferTextureLayer(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,Ps.__webglTexture,qt,xr+ji):ce.framebufferTexture2D(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,Ps.__webglTexture,qt),vt!==0?ce.blitFramebuffer(dn,_n,tn,Kt,rn,Gn,tn,Kt,ce.COLOR_BUFFER_BIT,ce.NEAREST):_r?ce.copyTexSubImage3D(un,qt,rn,Gn,xr+ji,dn,_n,tn,Kt):ce.copyTexSubImage2D(un,qt,rn,Gn,dn,_n,tn,Kt);We.bindFramebuffer(ce.READ_FRAMEBUFFER,null),We.bindFramebuffer(ce.DRAW_FRAMEBUFFER,null)}else _r?_e.isDataTexture||_e.isData3DTexture?ce.texSubImage3D(un,qt,rn,Gn,xr,tn,Kt,Vt,Xn,dr,sr.data):nt.isCompressedArrayTexture?ce.compressedTexSubImage3D(un,qt,rn,Gn,xr,tn,Kt,Vt,Xn,sr.data):ce.texSubImage3D(un,qt,rn,Gn,xr,tn,Kt,Vt,Xn,dr,sr):_e.isDataTexture?ce.texSubImage2D(ce.TEXTURE_2D,qt,rn,Gn,tn,Kt,Xn,dr,sr.data):_e.isCompressedTexture?ce.compressedTexSubImage2D(ce.TEXTURE_2D,qt,rn,Gn,sr.width,sr.height,Xn,sr.data):ce.texSubImage2D(ce.TEXTURE_2D,qt,rn,Gn,tn,Kt,Xn,dr,sr);ce.pixelStorei(ce.UNPACK_ROW_LENGTH,ss),ce.pixelStorei(ce.UNPACK_IMAGE_HEIGHT,Ln),ce.pixelStorei(ce.UNPACK_SKIP_PIXELS,vs),ce.pixelStorei(ce.UNPACK_SKIP_ROWS,Rs),ce.pixelStorei(ce.UNPACK_SKIP_IMAGES,Li),qt===0&&nt.generateMipmaps&&ce.generateMipmap(un),We.unbindTexture()},this.initRenderTarget=function(_e){Z.get(_e).__webglFramebuffer===void 0&&he.setupRenderTarget(_e)},this.initTexture=function(_e){_e.isCubeTexture?he.setTextureCube(_e,0):_e.isData3DTexture?he.setTexture3D(_e,0):_e.isDataArrayTexture||_e.isCompressedArrayTexture?he.setTexture2DArray(_e,0):he.setTexture2D(_e,0),We.unbindTexture()},this.resetState=function(){B=0,Y=0,V=null,We.reset(),ct.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return lu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=li._getDrawingBufferColorSpace(e),n.unpackColorSpace=li._getUnpackColorSpace()}}const hEe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:PC,AddEquation:z0,AddOperation:kY,AdditiveAnimationBlendMode:A9,AdditiveBlending:vR,AgXToneMapping:y9,AlphaFormat:C9,AlwaysCompare:VY,AlwaysDepth:h5,AlwaysStencilFunc:wR,AmbientLight:IK,AnimationAction:VK,AnimationClip:ew,AnimationLoader:g4e,AnimationMixer:$4e,AnimationObjectGroup:G4e,AnimationUtils:f4e,ArcCurve:oK,ArrayCamera:FK,ArrowHelper:hMe,AttachedBindMode:_R,Audio:BK,AudioAnalyser:I4e,AudioContext:eP,AudioListener:R4e,AudioLoader:E4e,AxesHelper:pMe,BackSide:Kl,BasicDepthPacking:OY,BasicShadowMap:uY,BatchedMesh:tK,BezierInterpolant:EK,Bone:O9,BooleanKeyframeTrack:Hx,Box2:Q4e,Box3:Do,Box3Helper:dMe,BoxGeometry:Bx,BoxHelper:uMe,BufferAttribute:$i,BufferGeometry:Ar,BufferGeometryLoader:jK,ByteType:S9,Cache:ih,Camera:fE,CameraHelper:cMe,CanvasTexture:P3e,CapsuleGeometry:ZC,CatmullRomCurve3:aK,CineonToneMapping:x9,CircleGeometry:QC,ClampToEdgeWrapping:Dc,Clock:WK,Color:Nn,ColorKeyframeTrack:K9,ColorManagement:li,Compatibility:_we,CompressedArrayTexture:k3e,CompressedCubeTexture:R3e,CompressedTexture:KC,CompressedTextureLoader:x4e,ConeGeometry:qw,ConstantAlphaFactor:EY,ConstantColorFactor:TY,Controls:gMe,CubeCamera:zK,CubeDepthTexture:sK,CubeReflectionMapping:hh,CubeRefractionMapping:xm,CubeTexture:Ww,CubeTextureLoader:v4e,CubeUVReflectionMapping:qy,CubicBezierCurve:U9,CubicBezierCurve3:lK,CubicInterpolant:TK,CullFaceBack:xR,CullFaceFront:cY,CullFaceFrontBack:ISe,CullFaceNone:lY,Curve:lf,CurvePath:uK,CustomBlending:dY,CustomToneMapping:v9,CylinderGeometry:$w,Cylindrical:Z4e,Data3DTexture:GC,DataArrayTexture:VC,DataTexture:ef,DataTextureLoader:y4e,DataUtils:r3e,DecrementStencilOp:QSe,DecrementWrapStencilOp:ewe,DefaultLoadingManager:NK,DepthFormat:mh,DepthStencilFormat:Z0,DepthTexture:wy,DetachedBindMode:RY,DirectionalLight:DK,DirectionalLightHelper:lMe,DiscreteInterpolant:CK,DodecahedronGeometry:JC,DoubleSide:ru,DstAlphaFactor:bY,DstColorFactor:SY,DynamicCopyUsage:mwe,DynamicDrawUsage:cwe,DynamicReadUsage:fwe,EdgesGeometry:z9,EllipseCurve:eE,EqualCompare:UY,EqualDepth:m5,EqualStencilFunc:iwe,EquirectangularReflectionMapping:tS,EquirectangularRefractionMapping:nS,Euler:xu,EventDispatcher:Mh,ExternalTexture:j9,ExtrudeGeometry:tE,FileLoader:Ep,Float16BufferAttribute:u3e,Float32BufferAttribute:In,FloatType:Yl,Fog:$C,FogExp2:WC,FramebufferTexture:N3e,FrontSide:Cp,Frustum:Xy,FrustumArray:YC,GLBufferAttribute:K4e,GLSL1:xwe,GLSL3:MR,GreaterCompare:BY,GreaterDepth:x5,GreaterEqualCompare:HC,GreaterEqualDepth:g5,GreaterEqualStencilFunc:lwe,GreaterStencilFunc:owe,GridHelper:oMe,Group:b1,HalfFloatType:ph,HemisphereLight:kK,HemisphereLightHelper:sMe,IcosahedronGeometry:nE,ImageBitmapLoader:C4e,ImageLoader:tw,ImageUtils:XY,IncrementStencilOp:ZSe,IncrementWrapStencilOp:JSe,InstancedBufferAttribute:wx,InstancedBufferGeometry:pE,InstancedInterleavedBuffer:nT,InstancedMesh:eK,Int16BufferAttribute:l3e,Int32BufferAttribute:c3e,Int8BufferAttribute:s3e,IntType:IC,InterleavedBuffer:qC,InterleavedBufferAttribute:cu,Interpolant:Yy,InterpolateBezier:SR,InterpolateDiscrete:BS,InterpolateLinear:Z5,InterpolateSmooth:d2,InterpolationSamplingMode:bwe,InterpolationSamplingType:ywe,InvertStencilOp:twe,KeepStencilOp:Gg,KeyframeTrack:xd,LOD:QY,LatheGeometry:rE,Layers:Sy,LessCompare:FY,LessDepth:p5,LessEqualCompare:BC,LessEqualDepth:bx,LessEqualStencilFunc:swe,LessStencilFunc:rwe,Light:Lm,LightProbe:LK,Line:bm,Line3:$K,LineBasicMaterial:Jl,LineCurve:B9,LineCurve3:cK,LineDashedMaterial:wK,LineLoop:nK,LineSegments:Th,LinearFilter:rs,LinearInterpolant:Y9,LinearMipMapLinearFilter:FSe,LinearMipMapNearestFilter:zSe,LinearMipmapLinearFilter:rh,LinearMipmapNearestFilter:rS,LinearSRGBColorSpace:vm,LinearToneMapping:m9,LinearTransfer:VS,Loader:Uc,LoaderUtils:NR,LoadingManager:Z9,LoopOnce:PY,LoopPingPong:IY,LoopRepeat:DY,MOUSE:Hg,Material:wl,MaterialBlending:OSe,MaterialLoader:hE,MathUtils:qY,Matrix2:iP,Matrix3:Cr,Matrix4:ur,MaxEquation:mY,Mesh:Hs,MeshBasicMaterial:Dp,MeshDepthMaterial:uE,MeshDistanceMaterial:dE,MeshLambertMaterial:_K,MeshMatcapMaterial:SK,MeshNormalMaterial:bK,MeshPhongMaterial:vK,MeshPhysicalMaterial:xK,MeshStandardMaterial:q9,MeshToonMaterial:yK,MinEquation:pY,MirroredRepeatWrapping:US,MixOperation:NY,MultiplyBlending:bR,MultiplyOperation:Vw,NearestFilter:Po,NearestMipMapLinearFilter:jSe,NearestMipMapNearestFilter:LSe,NearestMipmapLinearFilter:v1,NearestMipmapNearestFilter:_9,NeutralToneMapping:b9,NeverCompare:zY,NeverDepth:f5,NeverStencilFunc:nwe,NoBlending:ch,NoColorSpace:dp,NoNormalPacking:$Se,NoToneMapping:hu,NormalAnimationBlendMode:UC,NormalBlending:ux,NormalGAPacking:XSe,NormalRGPacking:qSe,NotEqualCompare:HY,NotEqualDepth:v5,NotEqualStencilFunc:awe,NumberKeyframeTrack:QS,Object3D:_i,ObjectLoader:M4e,ObjectSpaceNormalMap:jY,OctahedronGeometry:Xw,OneFactor:xY,OneMinusConstantAlphaFactor:AY,OneMinusConstantColorFactor:CY,OneMinusDstAlphaFactor:_Y,OneMinusDstColorFactor:wY,OneMinusSrcAlphaFactor:d5,OneMinusSrcColorFactor:yY,OrthographicCamera:tf,PCFShadowMap:O1,PCFSoftShadowMap:eS,PMREMGenerator:DR,Path:tT,PerspectiveCamera:no,Plane:lp,PlaneGeometry:Ip,PlaneHelper:fMe,PointLight:PK,PointLightHelper:rMe,Points:rK,PointsMaterial:L9,PolarGridHelper:aMe,PolyhedronGeometry:Om,PositionalAudio:D4e,PropertyBinding:yi,PropertyMixer:HK,QuadraticBezierCurve:H9,QuadraticBezierCurve3:V9,Quaternion:Ya,QuaternionKeyframeTrack:Kw,QuaternionLinearInterpolant:AK,R11_EAC_Format:C5,RED_GREEN_RGTC2_Format:Y5,RED_RGTC1_Format:q5,REVISION:Hw,RG11_EAC_Format:A5,RGBADepthPacking:LY,RGBAFormat:vl,RGBAIntegerFormat:FC,RGBA_ASTC_10x10_Format:B5,RGBA_ASTC_10x5_Format:z5,RGBA_ASTC_10x6_Format:F5,RGBA_ASTC_10x8_Format:U5,RGBA_ASTC_12x10_Format:H5,RGBA_ASTC_12x12_Format:V5,RGBA_ASTC_4x4_Format:k5,RGBA_ASTC_5x4_Format:R5,RGBA_ASTC_5x5_Format:P5,RGBA_ASTC_6x5_Format:D5,RGBA_ASTC_6x6_Format:I5,RGBA_ASTC_8x5_Format:O5,RGBA_ASTC_8x6_Format:L5,RGBA_ASTC_8x8_Format:j5,RGBA_BPTC_Format:G5,RGBA_ETC2_EAC_Format:T5,RGBA_PVRTC_2BPPV1_Format:S5,RGBA_PVRTC_4BPPV1_Format:_5,RGBA_S3TC_DXT1_Format:sS,RGBA_S3TC_DXT3_Format:oS,RGBA_S3TC_DXT5_Format:aS,RGBDepthPacking:GSe,RGBFormat:E9,RGBIntegerFormat:USe,RGB_BPTC_SIGNED_Format:W5,RGB_BPTC_UNSIGNED_Format:$5,RGB_ETC1_Format:w5,RGB_ETC2_Format:M5,RGB_PVRTC_2BPPV1_Format:b5,RGB_PVRTC_4BPPV1_Format:y5,RGB_S3TC_DXT1_Format:iS,RGDepthPacking:WSe,RGFormat:_x,RGIntegerFormat:zC,RawShaderMaterial:$9,Ray:Ux,Raycaster:GK,RectAreaLight:OK,RedFormat:jC,RedIntegerFormat:Gw,ReinhardToneMapping:g9,RenderTarget:k9,RenderTarget3D:q4e,RepeatWrapping:FS,ReplaceStencilOp:KSe,ReverseSubtractEquation:hY,RingGeometry:iE,SIGNED_R11_EAC_Format:E5,SIGNED_RED_GREEN_RGTC2_Format:K5,SIGNED_RED_RGTC1_Format:X5,SIGNED_RG11_EAC_Format:N5,SRGBColorSpace:xl,SRGBTransfer:Hi,Scene:R9,ShaderChunk:Or,ShaderLib:Zd,ShaderMaterial:vu,ShadowMaterial:mK,Shape:nm,ShapeGeometry:sE,ShapePath:mMe,ShapeUtils:Jd,ShortType:w9,Skeleton:XC,SkeletonHelper:nMe,SkinnedMesh:JY,Source:Q0,Sphere:Qo,SphereGeometry:Yw,Spherical:RR,SphericalHarmonics3:J9,SplineCurve:G9,SpotLight:RK,SpotLightHelper:tMe,Sprite:ZY,SpriteMaterial:I9,SrcAlphaFactor:u5,SrcAlphaSaturateFactor:MY,SrcColorFactor:vY,StaticCopyUsage:pwe,StaticDrawUsage:GS,StaticReadUsage:dwe,StereoCamera:A4e,StreamCopyUsage:gwe,StreamDrawUsage:uwe,StreamReadUsage:hwe,StringKeyframeTrack:Vx,SubtractEquation:fY,SubtractiveBlending:yR,TOUCH:Vg,TangentSpaceNormalMap:Im,TetrahedronGeometry:oE,Texture:so,TextureLoader:b4e,TextureUtils:_Me,Timer:UK,TimestampQuery:vwe,TorusGeometry:aE,TorusKnotGeometry:lE,Triangle:Rc,TriangleFanDrawMode:VSe,TriangleStripDrawMode:HSe,TrianglesDrawMode:BSe,TubeGeometry:cE,UVMapping:DC,Uint16BufferAttribute:P9,Uint32BufferAttribute:D9,Uint8BufferAttribute:o3e,Uint8ClampedBufferAttribute:a3e,Uniform:rP,UniformsGroup:Y4e,UniformsLib:wn,UniformsUtils:ZS,UnsignedByteType:Gl,UnsignedInt101111Type:T9,UnsignedInt248Type:by,UnsignedInt5999Type:M9,UnsignedIntType:hd,UnsignedShort4444Type:OC,UnsignedShort5551Type:LC,UnsignedShortType:yy,VSMShadowMap:Yg,Vector2:Wt,Vector3:Ve,Vector4:hi,VectorKeyframeTrack:JS,VideoFrameTexture:A3e,VideoTexture:iK,WebGL3DRenderTarget:Xwe,WebGLArrayRenderTarget:qwe,WebGLCoordinateSystem:lu,WebGLCubeRenderTarget:sP,WebGLRenderTarget:mu,WebGLRenderer:eZ,WebGLUtils:JK,WebGPUCoordinateSystem:Sx,WebXRController:f2,WireframeGeometry:W9,WrapAroundEnding:HS,ZeroCurvatureEnding:Kg,ZeroFactor:gY,ZeroSlopeEnding:Zg,ZeroStencilOp:YSe,createCanvasElement:WY,error:Wn,getConsoleFunction:Twe,log:$S,setConsoleFunction:Mwe,warn:Sn,warnOnce:qS},Symbol.toStringTag,{value:"Module"}));var gN={exports:{}},xN={};/**
 * @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 tF;function pEe(){if(tF)return xN;tF=1;var t=pw(),e=Ere();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 xN.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 M(R){if(!C){if(C=!0,A=R,R=m(R),x!==void 0&&_.hasValue){var L=_.value;if(x(L,R))return N=L}return N=R}if(L=N,r(A,R))return L;var k=m(R);return x!==void 0&&x(L,k)?(A=R,L):(A=R,N=k)}var C=!1,A,N,D=p===void 0?null:p;return[function(){return M(d())},D===null?void 0:function(){return M(D())}]},[d,p,m,x]);var S=i(c,b[0],b[1]);return o(function(){_.hasValue=!0,_.value=S},[S]),l(S),S},xN}var nF;function mEe(){return nF||(nF=1,gN.exports=pEe()),gN.exports}var gEe=mEe();const xEe=Ay(gEe),rF=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},vEe=(t=>t?rF(t):rF),{useSyncExternalStoreWithSelector:yEe}=xEe,bEe=t=>t;function _Ee(t,e=bEe,n){const r=yEe(t.subscribe,t.getState,t.getInitialState,e,n);return ni.useDebugValue(r),r}const iF=(t,e)=>{const n=vEe(t),r=(i,s=e)=>_Ee(n,i,s);return Object.assign(r,n),r},SEe=((t,e)=>t?iF(t,e):iF),wEe=t=>typeof t=="object"&&typeof t.then=="function",UM=[];function MEe(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 TEe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of UM)if(MEe(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=UM.indexOf(i);s!==-1&&UM.splice(s,1)},promise:(wEe(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(UM.push(i),!n)throw i.promise}const CEe=(t,e,n)=>TEe(t,e,!1,n);var LR=cU();const EEe=Ay(LR);function oP(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=oP(r,e,n);if(i)return i;r=e?null:r.sibling}}function tZ(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const aP=tZ(w.createContext(null));class nZ extends w.Component{render(){return w.createElement(aP.Provider,{value:this._reactInternals},this.props.children)}}function rZ(){const t=w.useContext(aP);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=w.useId();return w.useMemo(()=>{for(const n of[t,t==null?void 0:t.alternate]){if(!n)continue;const r=oP(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 AEe=Symbol.for("react.context"),NEe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===AEe;function kEe(){const t=rZ(),[e]=w.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;NEe(r)&&r!==aP&&!e.has(r)&&e.set(r,w.use(tZ(r))),n=n.return}return e}function REe(){const t=kEe();return w.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>w.createElement(e,null,w.createElement(n.Provider,{...r,value:t.get(n)})),e=>w.createElement(nZ,{...e})),[t])}function iZ(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const sZ=t=>t&&t.isOrthographicCamera,PEe=t=>t&&t.hasOwnProperty("current"),DEe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Zw=((t,e)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?w.useLayoutEffect:w.useEffect;function oZ(t){const e=w.useRef(t);return Zw(()=>void(e.current=t),[t]),e}function IEe(){const t=rZ(),e=REe();return w.useMemo(()=>({children:n})=>{const i=!!oP(t,!0,s=>s.type===w.StrictMode)?w.StrictMode:w.Fragment;return f.jsx(i,{children:f.jsx(e,{children:n})})},[t,e])}function OEe({set:t}){return Zw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const LEe=(t=>(t=class extends w.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 aZ(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 u1(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const eo={obj:t=>t===Object(t)&&!eo.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(eo.str(t)||eo.num(t)||eo.boo(t))return t===e;const s=eo.obj(t);if(s&&r==="reference")return t===e;const o=eo.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(!eo.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(eo.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 jEe(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 lZ=["children","key","ref"];function zEe(t){const e={};for(const n in t)lZ.includes(n)||(e[n]=t[n]);return e}function rT(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:zEe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function nw(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 sF=/-\d+$/;function iT(t,e){if(eo.str(e.props.attach)){if(sF.test(e.props.attach)){const i=e.props.attach.replace(sF,""),{root:s,key:o}=nw(t.object,i);Array.isArray(s[o])||(s[o]=[])}const{root:n,key:r}=nw(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else eo.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function sT(t,e){if(eo.str(e.props.attach)){const{root:n,key:r}=nw(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 jR=[...lZ,"args","dispose","attach","object","onUpdate","dispose"],oF=new Map;function FEe(t){let e=oF.get(t.constructor);try{e||(e=new t.constructor,oF.set(t.constructor,e))}catch{}return e}function UEe(t,e){const n={};for(const r in e)if(!jR.includes(r)&&!eo.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(jR.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=nw(t.object,r);if(i.constructor&&i.constructor.length===0){const o=FEe(i);eo.und(o)||(n[s]=o[s])}else n[s]=0}return n}const BEe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],HEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function F0(t,e){var n;const r=t.__r3f,i=r&&iZ(r).getState(),s=r==null?void 0:r.eventCount;for(const a in e){let l=e[a];if(jR.includes(a))continue;if(r&&HEe.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}=nw(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 Sy&&l instanceof Sy)p.mask=l.mask;else if(p instanceof Nn&&DEe(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&&BEe.includes(d)&&(o=c[d])!=null&&o.isTexture&&c[d].format===vl&&c[d].type===Gl&&(c[d].colorSpace=xl)}}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&&Zy(r),t}function Zy(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 VEe(t,e){t.manual||(sZ(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 Ac=t=>t==null?void 0:t.isObject3D;function BM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function cZ(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function GEe(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)=>{cZ(n.capturedMap,e,r,i)})}function WEe(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 M=0;M<x.length;M++){const C=u1(x[M]);C&&(C.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function b(M){const C=u1(M);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(M,!0):[]}let _=x.flatMap(b).sort((M,C)=>{const A=u1(M.object),N=u1(C.object);return!A||!N?M.distance-C.distance:N.events.priority-A.events.priority||M.distance-C.distance}).filter(M=>{const C=BM(M);return p.has(C)?!1:(p.add(C),!0)});d.events.filter&&(_=d.events.filter(_,d));for(const M of _){let C=M.object;for(;C;){var S;(S=C.__r3f)!=null&&S.eventCount&&m.push({...M,eventObject:C}),C=C.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let M of d.internal.capturedMap.get(l.pointerId).values())p.has(BM(M.intersection))||m.push(M.intersection);return m}function i(l,c,d,p){if(l.length){const m={stopped:!1};for(const x of l){let b=u1(x.object);if(b||x.object.traverseAncestors(_=>{const S=u1(_);if(S)return b=S,!1}),b){const{raycaster:_,pointer:S,camera:M,internal:C}=b,A=new Ve(S.x,S.y,0).unproject(M),N=O=>{var F,B;return(F=(B=C.capturedMap.get(O))==null?void 0:B.has(x.eventObject))!=null?F:!1},D=O=>{const F={intersection:x,target:c.target};C.capturedMap.has(O)?C.capturedMap.get(O).set(x.eventObject,F):C.capturedMap.set(O,new Map([[x.eventObject,F]])),c.target.setPointerCapture(O)},R=O=>{const F=C.capturedMap.get(O);F&&cZ(C.capturedMap,x.eventObject,F,O)};let L={};for(let O in c){let F=c[O];typeof F!="function"&&(L[O]=F)}let k={...x,...L,pointer:S,intersections:l,stopped:m.stopped,delta:d,unprojectedPoint:A,ray:_.ray,camera:M,stopPropagation(){const O="pointerId"in c&&C.capturedMap.get(c.pointerId);if((!O||O.has(x.eventObject))&&(k.stopped=m.stopped=!0,C.hovered.size&&Array.from(C.hovered.values()).find(F=>F.eventObject===x.eventObject))){const F=l.slice(0,l.indexOf(x));s([...F,x])}},target:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:R},currentTarget:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:R},nativeEvent:c};if(p(k),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(BM(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),M=b?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=S.map(A=>A.eventObject)),b&&!S.length&&M<=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 R=D.handlers;if(x){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const L=BM(A),k=m.hovered.get(L);k?k.stopped&&A.stopPropagation():(m.hovered.set(L,A),R.onPointerOver==null||R.onPointerOver(A),R.onPointerEnter==null||R.onPointerEnter(A))}R.onPointerMove==null||R.onPointerMove(A)}else{const L=R[l];L?(!b||m.initialHits.includes(N))&&(o(d,m.interaction.filter(k=>!m.initialHits.includes(k))),L(A)):b&&m.initialHits.includes(N)&&o(d,m.interaction.filter(k=>!m.initialHits.includes(k)))}}i(S,d,M,C)}}return{handlePointer:a}}const aF=t=>!!(t!=null&&t.render),uZ=w.createContext(null),$Ee=(t,e)=>{const n=SEe((a,l)=>{const c=new Ve,d=new Ve,p=new Ve;function m(M=l().camera,C=d,A=l().size){const{width:N,height:D,top:R,left:L}=A,k=N/D;C.isVector3?p.copy(C):p.set(...C);const O=M.getWorldPosition(c).distanceTo(p);if(sZ(M))return{width:N/M.zoom,height:D/M.zoom,top:R,left:L,factor:1,distance:O,aspect:k};{const F=M.fov*Math.PI/180,B=2*Math.tan(F/2)*O,Y=B*(N/D);return{width:Y,height:B,top:R,left:L,factor:N/Y,distance:O,aspect:k}}}let x;const b=M=>a(C=>({performance:{...C.performance,current:M}})),_=new Wt;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(M=1)=>t(l(),M),advance:(M,C)=>e(M,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 M=l();x&&clearTimeout(x),M.performance.current!==M.performance.min&&b(M.performance.min),x=setTimeout(()=>b(l().performance.max),M.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:M=>a(C=>({...C,events:{...C.events,...M}})),setSize:(M,C,A=0,N=0)=>{const D=l().camera,R={width:M,height:C,top:A,left:N};a(L=>({size:R,viewport:{...L.viewport,...m(D,d,R)}}))},setDpr:M=>a(C=>{const A=aZ(M);return{viewport:{...C.viewport,dpr:A,initialDpr:C.viewport.initialDpr||A}}}),setFrameloop:(M="always")=>{const C=l().clock;C.stop(),C.elapsedTime=0,M!=="never"&&(C.start(),C.elapsedTime=0),a(()=>({frameloop:M}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:w.createRef(),active:!1,frames:0,priority:0,subscribe:(M,C,A)=>{const N=l().internal;return N.priority=N.priority+(C>0?1:0),N.subscribers.push({ref:M,priority:C,store:A}),N.subscribers=N.subscribers.sort((D,R)=>D.priority-R.priority),()=>{const D=l().internal;D!=null&&D.subscribers&&(D.priority=D.priority-(C>0?1:0),D.subscribers=D.subscribers.filter(R=>R.ref!==M))}}}}}),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,VEe(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 dZ(){const t=w.useContext(uZ);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function Nc(t=n=>n,e){return dZ()(t,e)}function xE(t,e=0){const n=dZ(),r=n.getState().internal.subscribe,i=oZ(t);return Zw(()=>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 qEe=1,XEe=8,YEe=32,KEe=2;var ZEe={version:"9.5.0"};function QEe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lF={exports:{}},cF={exports:{}},uF;function JEe(){return uF||(uF=1,(function(t){t.exports=function(e){function n(g,v,E,P){return new tb(g,v,E,P)}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,P=v;;){var W=E.return;if(W===null)break;var ne=W.alternate;if(ne===null){if(P=W.return,P!==null){E=P;continue}break}if(W.child===ne.child){for(ne=W.child;ne;){if(ne===E)return o(W),g;if(ne===P)return o(W),v;ne=ne.sibling}throw Error(i(188))}if(E.return!==P.return)E=W,P=ne;else{for(var De=!1,at=W.child;at;){if(at===E){De=!0,E=W,P=ne;break}if(at===P){De=!0,P=W,E=ne;break}at=at.sibling}if(!De){for(at=ne.child;at;){if(at===E){De=!0,E=ne,P=W;break}if(at===P){De=!0,P=ne,E=W;break}at=at.sibling}if(!De)throw Error(i(189))}}if(E.alternate!==P)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=Pd&&g[Pd]||g["@@iterator"],typeof g=="function"?g:null)}function p(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===bf?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case Dh:return"Fragment";case Oh:return"Profiler";case Ih:return"StrictMode";case iv:return"Suspense";case Rd:return"SuspenseList";case Jm:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case Ph:return"Portal";case fc:return g.displayName||"Context";case Qm:return(g._context.displayName||"Context")+".Consumer";case Zp:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case sv:return v=g.displayName||null,v!==null?v:p(g.type)||"Memo";case La:v=g._payload,g=g._init;try{return p(g(v))}catch{}}return null}function m(g){return{current:g}}function x(g){0>Uh||(g.current=vv[Uh],vv[Uh]=null,Uh--)}function b(g,v){Uh++,vv[Uh]=g.current,g.current=v}function _(g){return g>>>=0,g===0?32:31-(yv(g)/G3|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 M(g,v,E){var P=g.pendingLanes;if(P===0)return 0;var W=0,ne=g.suspendedLanes,De=g.pingedLanes;g=g.warmLanes;var at=P&134217727;return at!==0?(P=at&~ne,P!==0?W=S(P):(De&=at,De!==0?W=S(De):E||(E=at&~g,E!==0&&(W=S(E))))):(at=P&~ne,at!==0?W=S(at):De!==0?W=S(De):E||(E=P&~g,E!==0&&(W=S(E)))),W===0?0:v!==0&&v!==W&&(v&ne)===0&&(ne=W&-W,E=v&-v,ne>=E||ne===32&&(E&4194048)!==0)?v:W}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=i0;return i0<<=1,(i0&62914560)===0&&(i0=4194304),g}function D(g){for(var v=[],E=0;31>E;E++)v.push(g);return v}function R(g,v){g.pendingLanes|=v,v!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function L(g,v,E,P,W,ne){var De=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,zt=g.expirationTimes,nn=g.hiddenUpdates;for(E=De&~E;0<E;){var xn=31-ol(E),on=1<<xn;at[xn]=0,zt[xn]=-1;var kn=nn[xn];if(kn!==null)for(nn[xn]=null,xn=0;xn<kn.length;xn++){var vr=kn[xn];vr!==null&&(vr.lane&=-536870913)}E&=~on}P!==0&&k(g,P,0),ne!==0&&W===0&&g.tag!==0&&(g.suspendedLanes|=ne&~(De&~v))}function k(g,v,E){g.pendingLanes|=v,g.suspendedLanes&=~v;var P=31-ol(v);g.entangledLanes|=v,g.entanglements[P]=g.entanglements[P]|1073741824|E&261930}function O(g,v){var E=g.entangledLanes|=v;for(g=g.entanglements;E;){var P=31-ol(E),W=1<<P;W&v|g[P]&v&&(g[P]|=v),E&=~W}}function F(g,v){var E=v&-v;return E=(E&42)!==0?1:B(E),(E&(g.suspendedLanes|v))!==0?0:E}function B(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 Y(g){return g&=-g,2<g?8<g?(g&134217727)!==0?32:268435456:8:2}function V(g){if(typeof Ub=="function"&&q3(g),al&&typeof al.setStrictMode=="function")try{al.setStrictMode(Hh,g)}catch{}}function q(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}function G(g){if(Tv===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);Tv=v&&v[1]||"",Lu=-1<E.stack.indexOf(`
    at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Tv+g+Lu}function $(g,v){if(!g||lg)return"";lg=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var P={DetermineComponentFrameRoot:function(){try{if(v){var on=function(){throw Error()};if(Object.defineProperty(on.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(on,[])}catch(vr){var kn=vr}Reflect.construct(g,[],on)}else{try{on.call()}catch(vr){kn=vr}g.call(on.prototype)}}else{try{throw Error()}catch(vr){kn=vr}(on=g())&&typeof on.catch=="function"&&on.catch(function(){})}}catch(vr){if(vr&&kn&&typeof vr.stack=="string")return[vr.stack,kn.stack]}return[null,null]}};P.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var W=Object.getOwnPropertyDescriptor(P.DetermineComponentFrameRoot,"name");W&&W.configurable&&Object.defineProperty(P.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ne=P.DetermineComponentFrameRoot(),De=ne[0],at=ne[1];if(De&&at){var zt=De.split(`
`),nn=at.split(`
`);for(W=P=0;P<zt.length&&!zt[P].includes("DetermineComponentFrameRoot");)P++;for(;W<nn.length&&!nn[W].includes("DetermineComponentFrameRoot");)W++;if(P===zt.length||W===nn.length)for(P=zt.length-1,W=nn.length-1;1<=P&&0<=W&&zt[P]!==nn[W];)W--;for(;1<=P&&0<=W;P--,W--)if(zt[P]!==nn[W]){if(P!==1||W!==1)do if(P--,W--,0>W||zt[P]!==nn[W]){var xn=`
`+zt[P].replace(" at new "," at ");return g.displayName&&xn.includes("<anonymous>")&&(xn=xn.replace("<anonymous>",g.displayName)),xn}while(1<=P&&0<=W);break}}}finally{lg=!1,Error.prepareStackTrace=E}return(E=g?g.displayName||g.name:"")?G(E):""}function Q(g,v){switch(g.tag){case 26:case 27:case 5:return G(g.type);case 16:return G("Lazy");case 13:return g.child!==v&&v!==null?G("Suspense Fallback"):G("Suspense");case 19:return G("SuspenseList");case 0:case 15:return $(g.type,!1);case 11:return $(g.type.render,!1);case 1:return $(g.type,!0);case 31:return G("Activity");default:return""}}function K(g){try{var v="",E=null;do v+=Q(g,E),E=g,g=g.return;while(g);return v}catch(P){return`
Error generating stack: `+P.message+`
`+P.stack}}function re(g,v){if(typeof g=="object"&&g!==null){var E=Bb.get(g);return E!==void 0?E:(v={value:g,source:v,stack:K(v)},Bb.set(g,v),v)}return{value:g,source:v,stack:K(v)}}function U(g,v){Od[ju++]=cg,Od[ju++]=Ui,Ui=g,cg=v}function H(g,v,E){mc[Pl++]=ia,mc[Pl++]=qc,mc[Pl++]=gc,gc=g;var P=ia;g=qc;var W=32-ol(P)-1;P&=~(1<<W),E+=1;var ne=32-ol(v)+W;if(30<ne){var De=W-W%5;ne=(P&(1<<De)-1).toString(32),P>>=De,W-=De,ia=1<<32-ol(v)+W|E<<W|P,qc=ne+g}else ia=1<<ne|E<<W|P,qc=g}function X(g){g.return!==null&&(U(g,1),H(g,1,0))}function j(g){for(;g===Ui;)Ui=Od[--ju],Od[ju]=null,cg=Od[--ju],Od[ju]=null;for(;g===gc;)gc=mc[--Pl],mc[Pl]=null,qc=mc[--Pl],mc[Pl]=null,ia=mc[--Pl],mc[Pl]=null}function le(g,v){mc[Pl++]=ia,mc[Pl++]=qc,mc[Pl++]=gc,ia=v.id,qc=v.overflow,gc=g}function se(g,v){b(sa,v),b(Ld,g),b(Vo,null),g=o3(v),x(Vo),b(Vo,g)}function J(){x(Vo),x(Ld),x(sa)}function ee(g){g.memoizedState!==null&&b(ug,g);var v=Vo.current,E=e0(v,g.type);v!==E&&(b(Ld,g),b(Vo,E))}function ie(g){Ld.current===g&&(x(Vo),x(Ld)),ug.current===g&&(x(ug),qs?zh._currentValue=jh:zh._currentValue2=jh)}function oe(g){var v=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Se(re(v,g)),Cv}function de(g,v){if(!ls)throw Error(i(175));P3(g.stateNode,g.type,g.memoizedProps,v,g)||oe(g,!0)}function ye(g){for(Co=g.return;Co;)switch(Co.tag){case 5:case 31:case 13:za=!1;return;case 27:case 3:za=!0;return;default:Co=Co.return}}function ge(g){if(!ls||g!==Co)return!1;if(!qr)return ye(g),qr=!0,!1;var v=g.tag;if(To?v!==3&&v!==27&&(v!==5||r0(g.type)&&!ja(g.type,g.memoizedProps))&&cs&&oe(g):v!==3&&(v!==5||r0(g.type)&&!ja(g.type,g.memoizedProps))&&cs&&oe(g),ye(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=Nb(g)}else if(v===31){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));cs=I3(g)}else cs=To&&v===27?M3(g.type,cs):Co?w3(g.stateNode):null;return!0}function Me(){ls&&(cs=Co=null,qr=!1)}function fe(){var g=zu;return g!==null&&(ul===null?ul=g:ul.push.apply(ul,g),zu=null),g}function Se(g){zu===null?zu=[g]:zu.push(g)}function me(g,v,E){qs?(b(xc,v._currentValue),v._currentValue=E):(b(xc,v._currentValue2),v._currentValue2=E)}function Pe(g){var v=xc.current;qs?g._currentValue=v:g._currentValue2=v,x(xc)}function ce(g,v,E){for(;g!==null;){var P=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,P!==null&&(P.childLanes|=v)):P!==null&&(P.childLanes&v)!==v&&(P.childLanes|=v),g===E)break;g=g.return}}function He(g,v,E,P){var W=g.child;for(W!==null&&(W.return=g);W!==null;){var ne=W.dependencies;if(ne!==null){var De=W.child;ne=ne.firstContext;e:for(;ne!==null;){var at=ne;ne=W;for(var zt=0;zt<v.length;zt++)if(at.context===v[zt]){ne.lanes|=E,at=ne.alternate,at!==null&&(at.lanes|=E),ce(ne.return,E,g),P||(De=null);break e}ne=at.next}}else if(W.tag===18){if(De=W.return,De===null)throw Error(i(341));De.lanes|=E,ne=De.alternate,ne!==null&&(ne.lanes|=E),ce(De,E,g),De=null}else De=W.child;if(De!==null)De.return=W;else for(De=W;De!==null;){if(De===g){De=null;break}if(W=De.sibling,W!==null){W.return=De.return,De=W;break}De=De.return}W=De}}function Be(g,v,E,P){g=null;for(var W=v,ne=!1;W!==null;){if(!ne){if((W.flags&524288)!==0)ne=!0;else if((W.flags&262144)!==0)break}if(W.tag===10){var De=W.alternate;if(De===null)throw Error(i(387));if(De=De.memoizedProps,De!==null){var at=W.type;Ys(W.pendingProps.value,De.value)||(g!==null?g.push(at):g=[at])}}else if(W===ug.current){if(De=W.alternate,De===null)throw Error(i(387));De.memoizedState.memoizedState!==W.memoizedState.memoizedState&&(g!==null?g.push(zh):g=[zh])}W=W.return}g!==null&&He(v,g,E,P),v.flags|=262144}function Ge(g){for(g=g.firstContext;g!==null;){var v=g.context;if(!Ys(qs?v._currentValue:v._currentValue2,g.memoizedValue))return!0;g=g.next}return!1}function We(g){Yi=g,Xc=null,g=g.dependencies,g!==null&&(g.firstContext=null)}function ae(g){return he(Yi,g)}function Z(g,v){return Yi===null&&We(g),he(g,v)}function he(g,v){var E=qs?v._currentValue:v._currentValue2;if(v={context:v,memoizedValue:E,next:null},Xc===null){if(g===null)throw Error(i(308));Xc=v,g.dependencies={lanes:0,firstContext:v},g.flags|=524288}else Xc=Xc.next=v;return E}function be(){return{controller:new X3,data:new Map,refCount:0}}function we(g){g.refCount--,g.refCount===0&&Go(NE,function(){g.controller.abort()})}function ve(){}function Re(g){g!==Ai&&g.next===null&&(Ai===null?dg=Ai=g:Ai=Ai.next=g),vc=!0,Sa||(Sa=!0,Te())}function Ae(g,v){if(!Ev&&vc){Ev=!0;do for(var E=!1,P=dg;P!==null;){if(g!==0){var W=P.pendingLanes;if(W===0)var ne=0;else{var De=P.suspendedLanes,at=P.pingedLanes;ne=(1<<31-ol(42|g)+1)-1,ne&=W&~(De&~at),ne=ne&201326741?ne&201326741|1:ne?ne|2:0}ne!==0&&(E=!0,je(P,ne))}else ne=Xr,ne=M(P,P===Ir?ne:0,P.cancelPendingCommit!==null||P.timeoutHandle!==sl),(ne&3)===0||C(P,ne)||(E=!0,je(P,ne));P=P.next}while(E);Ev=!1}}function Oe(){qe()}function qe(){vc=Sa=!1;var g=0;Tf!==0&&Lh()&&(g=Tf);for(var v=_a(),E=null,P=dg;P!==null;){var W=P.next,ne=Fe(P,v);ne===0?(P.next=null,E===null?dg=W:E.next=W,W===null&&(Ai=E)):(E=P,(g!==0||(ne&3)!==0)&&(vc=!0)),P=W}go!==0&&go!==5||Ae(g),Tf!==0&&(Tf=0)}function Fe(g,v){for(var E=g.suspendedLanes,P=g.pingedLanes,W=g.expirationTimes,ne=g.pendingLanes&-62914561;0<ne;){var De=31-ol(ne),at=1<<De,zt=W[De];zt===-1?((at&E)===0||(at&P)!==0)&&(W[De]=A(at,v)):zt<=v&&(g.expiredLanes|=at),ne&=~at}if(v=Ir,E=Xr,E=M(g,g===v?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==sl),P=g.callbackNode,E===0||g===v&&(ki===2||ki===9)||g.cancelPendingCommit!==null)return P!==null&&P!==null&&_v(P),g.callbackNode=null,g.callbackPriority=0;if((E&3)===0||C(g,E)){if(v=E&-E,v===g.callbackPriority)return v;switch(P!==null&&_v(P),Y(E)){case 2:case 8:E=$3;break;case 32:E=ag;break;case 268435456:E=wv;break;default:E=ag}return P=Ke.bind(null,g),E=og(E,P),g.callbackPriority=v,g.callbackNode=E,v}return P!==null&&P!==null&&_v(P),g.callbackPriority=2,g.callbackNode=null,2}function Ke(g,v){if(go!==0&&go!==5)return g.callbackNode=null,g.callbackPriority=0,null;var E=g.callbackNode;if(Du()&&g.callbackNode!==E)return null;var P=Xr;return P=M(g,g===Ir?P:0,g.cancelPendingCommit!==null||g.timeoutHandle!==sl),P===0?null:($c(g,P,v),Fe(g,_a()),g.callbackNode!=null&&g.callbackNode===E?Ke.bind(null,g):null)}function je(g,v){if(Du())return null;$c(g,v,!0)}function Te(){hb?pb(function(){(Br&6)!==0?og(Sv,Oe):qe()}):og(Sv,Oe)}function Xe(){if(Tf===0){var g=jd;g===0&&(g=bv,bv<<=1,(bv&261888)===0&&(bv=256)),Tf=g}return Tf}function ht(g,v){if(s0===null){var E=s0=[];Hb=0,jd=Xe(),Eo={status:"pending",value:void 0,then:function(P){E.push(P)}}}return Hb++,v.then(ke,ke),v}function ke(){if(--Hb===0&&s0!==null){Eo!==null&&(Eo.status="fulfilled");var g=s0;s0=null,jd=0,Eo=null;for(var v=0;v<g.length;v++)(0,g[v])()}}function et(g,v){var E=[],P={status:"pending",value:null,reason:null,then:function(W){E.push(W)}};return g.then(function(){P.status="fulfilled",P.value=v;for(var W=0;W<E.length;W++)(0,E[W])(v)},function(W){for(P.status="rejected",P.reason=W,W=0;W<E.length;W++)(0,E[W])(void 0)}),P}function ct(){var g=Cf.current;return g!==null?g:Ir.pooledCache}function yt(g,v){v===null?b(Cf,Cf.current):b(Cf,v.pool)}function lt(){var g=ct();return g===null?null:{parent:qs?us._currentValue:us._currentValue2,pool:g}}function Je(g,v){if(Ys(g,v))return!0;if(typeof g!="object"||g===null||typeof v!="object"||v===null)return!1;var E=Object.keys(g),P=Object.keys(v);if(E.length!==P.length)return!1;for(P=0;P<E.length;P++){var W=E[P];if(!AE.call(v,W)||!Ys(g[W],v[W]))return!1}return!0}function Ee(g){return g=g.status,g==="fulfilled"||g==="rejected"}function Ze(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,rt(g),g;default:if(typeof v.status=="string")v.then(ve,ve);else{if(g=Ir,g!==null&&100<g.shellSuspendCounter)throw Error(i(482));g=v,g.status="pending",g.then(function(P){if(v.status==="pending"){var W=v;W.status="fulfilled",W.value=P}},function(P){if(v.status==="pending"){var W=v;W.status="rejected",W.reason=P}})}switch(v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,rt(g),g}throw Fa=v,Ao}}function Ie(g){try{var v=g._init;return v(g._payload)}catch(E){throw E!==null&&typeof E=="object"&&typeof E.then=="function"?(Fa=E,Ao):E}}function Ue(){if(Fa===null)throw Error(i(459));var g=Fa;return Fa=null,g}function rt(g){if(g===Ao||g===bc)throw Error(i(483))}function ut(g){var v=Vh;return Vh+=1,Ef===null&&(Ef=[]),Ze(Ef,g,v)}function Dt(g,v){v=v.props.ref,g.ref=v!==void 0?v:null}function Rt(g,v){throw v.$$typeof===Rh?Error(i(525)):(g=Object.prototype.toString.call(v),Error(i(31,g==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":g)))}function St(g){function v(Pt,Mt){if(g){var jt=Pt.deletions;jt===null?(Pt.deletions=[Mt],Pt.flags|=16):jt.push(Mt)}}function E(Pt,Mt){if(!g)return null;for(;Mt!==null;)v(Pt,Mt),Mt=Mt.sibling;return null}function P(Pt){for(var Mt=new Map;Pt!==null;)Pt.key!==null?Mt.set(Pt.key,Pt):Mt.set(Pt.index,Pt),Pt=Pt.sibling;return Mt}function W(Pt,Mt){return Pt=kl(Pt,Mt),Pt.index=0,Pt.sibling=null,Pt}function ne(Pt,Mt,jt){return Pt.index=jt,g?(jt=Pt.alternate,jt!==null?(jt=jt.index,jt<Mt?(Pt.flags|=67108866,Mt):jt):(Pt.flags|=67108866,Mt)):(Pt.flags|=1048576,Mt)}function De(Pt){return g&&Pt.alternate===null&&(Pt.flags|=67108866),Pt}function at(Pt,Mt,jt,mn){return Mt===null||Mt.tag!==6?(Mt=nb(jt,Pt.mode,mn),Mt.return=Pt,Mt):(Mt=W(Mt,jt),Mt.return=Pt,Mt)}function zt(Pt,Mt,jt,mn){var Qn=jt.type;return Qn===Dh?xn(Pt,Mt,jt.props.children,mn,jt.key):Mt!==null&&(Mt.elementType===Qn||typeof Qn=="object"&&Qn!==null&&Qn.$$typeof===La&&Ie(Qn)===Mt.type)?(Mt=W(Mt,jt.props),Dt(Mt,jt),Mt.return=Pt,Mt):(Mt=kd(jt.type,jt.key,jt.props,null,Pt.mode,mn),Dt(Mt,jt),Mt.return=Pt,Mt)}function nn(Pt,Mt,jt,mn){return Mt===null||Mt.tag!==4||Mt.stateNode.containerInfo!==jt.containerInfo||Mt.stateNode.implementation!==jt.implementation?(Mt=ib(jt,Pt.mode,mn),Mt.return=Pt,Mt):(Mt=W(Mt,jt.children||[]),Mt.return=Pt,Mt)}function xn(Pt,Mt,jt,mn,Qn){return Mt===null||Mt.tag!==7?(Mt=dc(jt,Pt.mode,mn,Qn),Mt.return=Pt,Mt):(Mt=W(Mt,jt),Mt.return=Pt,Mt)}function on(Pt,Mt,jt){if(typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint")return Mt=nb(""+Mt,Pt.mode,jt),Mt.return=Pt,Mt;if(typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case Iu:return jt=kd(Mt.type,Mt.key,Mt.props,null,Pt.mode,jt),Dt(jt,Mt),jt.return=Pt,jt;case Ph:return Mt=ib(Mt,Pt.mode,jt),Mt.return=Pt,Mt;case La:return Mt=Ie(Mt),on(Pt,Mt,jt)}if(_f(Mt)||d(Mt))return Mt=dc(Mt,Pt.mode,jt,null),Mt.return=Pt,Mt;if(typeof Mt.then=="function")return on(Pt,ut(Mt),jt);if(Mt.$$typeof===fc)return on(Pt,Z(Pt,Mt),jt);Rt(Pt,Mt)}return null}function kn(Pt,Mt,jt,mn){var Qn=Mt!==null?Mt.key:null;if(typeof jt=="string"&&jt!==""||typeof jt=="number"||typeof jt=="bigint")return Qn!==null?null:at(Pt,Mt,""+jt,mn);if(typeof jt=="object"&&jt!==null){switch(jt.$$typeof){case Iu:return jt.key===Qn?zt(Pt,Mt,jt,mn):null;case Ph:return jt.key===Qn?nn(Pt,Mt,jt,mn):null;case La:return jt=Ie(jt),kn(Pt,Mt,jt,mn)}if(_f(jt)||d(jt))return Qn!==null?null:xn(Pt,Mt,jt,mn,null);if(typeof jt.then=="function")return kn(Pt,Mt,ut(jt),mn);if(jt.$$typeof===fc)return kn(Pt,Mt,Z(Pt,jt),mn);Rt(Pt,jt)}return null}function vr(Pt,Mt,jt,mn,Qn){if(typeof mn=="string"&&mn!==""||typeof mn=="number"||typeof mn=="bigint")return Pt=Pt.get(jt)||null,at(Mt,Pt,""+mn,Qn);if(typeof mn=="object"&&mn!==null){switch(mn.$$typeof){case Iu:return Pt=Pt.get(mn.key===null?jt:mn.key)||null,zt(Mt,Pt,mn,Qn);case Ph:return Pt=Pt.get(mn.key===null?jt:mn.key)||null,nn(Mt,Pt,mn,Qn);case La:return mn=Ie(mn),vr(Pt,Mt,jt,mn,Qn)}if(_f(mn)||d(mn))return Pt=Pt.get(jt)||null,xn(Mt,Pt,mn,Qn,null);if(typeof mn.then=="function")return vr(Pt,Mt,jt,ut(mn),Qn);if(mn.$$typeof===fc)return vr(Pt,Mt,jt,Z(Mt,mn),Qn);Rt(Mt,mn)}return null}function Qs(Pt,Mt,jt,mn){for(var Qn=null,Ns=null,tr=Mt,si=Mt=0,Wo=null;tr!==null&&si<jt.length;si++){tr.index>si?(Wo=tr,tr=null):Wo=tr.sibling;var mi=kn(Pt,tr,jt[si],mn);if(mi===null){tr===null&&(tr=Wo);break}g&&tr&&mi.alternate===null&&v(Pt,tr),Mt=ne(mi,Mt,si),Ns===null?Qn=mi:Ns.sibling=mi,Ns=mi,tr=Wo}if(si===jt.length)return E(Pt,tr),qr&&U(Pt,si),Qn;if(tr===null){for(;si<jt.length;si++)tr=on(Pt,jt[si],mn),tr!==null&&(Mt=ne(tr,Mt,si),Ns===null?Qn=tr:Ns.sibling=tr,Ns=tr);return qr&&U(Pt,si),Qn}for(tr=P(tr);si<jt.length;si++)Wo=vr(tr,Pt,si,jt[si],mn),Wo!==null&&(g&&Wo.alternate!==null&&tr.delete(Wo.key===null?si:Wo.key),Mt=ne(Wo,Mt,si),Ns===null?Qn=Wo:Ns.sibling=Wo,Ns=Wo);return g&&tr.forEach(function(wc){return v(Pt,wc)}),qr&&U(Pt,si),Qn}function h0(Pt,Mt,jt,mn){if(jt==null)throw Error(i(151));for(var Qn=null,Ns=null,tr=Mt,si=Mt=0,Wo=null,mi=jt.next();tr!==null&&!mi.done;si++,mi=jt.next()){tr.index>si?(Wo=tr,tr=null):Wo=tr.sibling;var wc=kn(Pt,tr,mi.value,mn);if(wc===null){tr===null&&(tr=Wo);break}g&&tr&&wc.alternate===null&&v(Pt,tr),Mt=ne(wc,Mt,si),Ns===null?Qn=wc:Ns.sibling=wc,Ns=wc,tr=Wo}if(mi.done)return E(Pt,tr),qr&&U(Pt,si),Qn;if(tr===null){for(;!mi.done;si++,mi=jt.next())mi=on(Pt,mi.value,mn),mi!==null&&(Mt=ne(mi,Mt,si),Ns===null?Qn=mi:Ns.sibling=mi,Ns=mi);return qr&&U(Pt,si),Qn}for(tr=P(tr);!mi.done;si++,mi=jt.next())mi=vr(tr,Pt,si,mi.value,mn),mi!==null&&(g&&mi.alternate!==null&&tr.delete(mi.key===null?si:mi.key),Mt=ne(mi,Mt,si),Ns===null?Qn=mi:Ns.sibling=mi,Ns=mi);return g&&tr.forEach(function(kE){return v(Pt,kE)}),qr&&U(Pt,si),Qn}function Of(Pt,Mt,jt,mn){if(typeof jt=="object"&&jt!==null&&jt.type===Dh&&jt.key===null&&(jt=jt.props.children),typeof jt=="object"&&jt!==null){switch(jt.$$typeof){case Iu:e:{for(var Qn=jt.key;Mt!==null;){if(Mt.key===Qn){if(Qn=jt.type,Qn===Dh){if(Mt.tag===7){E(Pt,Mt.sibling),mn=W(Mt,jt.props.children),mn.return=Pt,Pt=mn;break e}}else if(Mt.elementType===Qn||typeof Qn=="object"&&Qn!==null&&Qn.$$typeof===La&&Ie(Qn)===Mt.type){E(Pt,Mt.sibling),mn=W(Mt,jt.props),Dt(mn,jt),mn.return=Pt,Pt=mn;break e}E(Pt,Mt);break}else v(Pt,Mt);Mt=Mt.sibling}jt.type===Dh?(mn=dc(jt.props.children,Pt.mode,mn,jt.key),mn.return=Pt,Pt=mn):(mn=kd(jt.type,jt.key,jt.props,null,Pt.mode,mn),Dt(mn,jt),mn.return=Pt,Pt=mn)}return De(Pt);case Ph:e:{for(Qn=jt.key;Mt!==null;){if(Mt.key===Qn)if(Mt.tag===4&&Mt.stateNode.containerInfo===jt.containerInfo&&Mt.stateNode.implementation===jt.implementation){E(Pt,Mt.sibling),mn=W(Mt,jt.children||[]),mn.return=Pt,Pt=mn;break e}else{E(Pt,Mt);break}else v(Pt,Mt);Mt=Mt.sibling}mn=ib(jt,Pt.mode,mn),mn.return=Pt,Pt=mn}return De(Pt);case La:return jt=Ie(jt),Of(Pt,Mt,jt,mn)}if(_f(jt))return Qs(Pt,Mt,jt,mn);if(d(jt)){if(Qn=d(jt),typeof Qn!="function")throw Error(i(150));return jt=Qn.call(jt),h0(Pt,Mt,jt,mn)}if(typeof jt.then=="function")return Of(Pt,Mt,ut(jt),mn);if(jt.$$typeof===fc)return Of(Pt,Mt,Z(Pt,jt),mn);Rt(Pt,jt)}return typeof jt=="string"&&jt!==""||typeof jt=="number"||typeof jt=="bigint"?(jt=""+jt,Mt!==null&&Mt.tag===6?(E(Pt,Mt.sibling),mn=W(Mt,jt),mn.return=Pt,Pt=mn):(E(Pt,Mt),mn=nb(jt,Pt.mode,mn),mn.return=Pt,Pt=mn),De(Pt)):E(Pt,Mt)}return function(Pt,Mt,jt,mn){try{Vh=0;var Qn=Of(Pt,Mt,jt,mn);return Ef=null,Qn}catch(tr){if(tr===Ao||tr===bc)throw tr;var Ns=n(29,tr,null,Pt.mode);return Ns.lanes=mn,Ns.return=Pt,Ns}finally{}}}function Ht(){for(var g=Uu,v=Gh=Uu=0;v<g;){var E=aa[v];aa[v++]=null;var P=aa[v];aa[v++]=null;var W=aa[v];aa[v++]=null;var ne=aa[v];if(aa[v++]=null,P!==null&&W!==null){var De=P.pending;De===null?W.next=W:(W.next=De.next,De.next=W),P.pending=W}ne!==0&&dt(E,W,ne)}}function en(g,v,E,P){aa[Uu++]=g,aa[Uu++]=v,aa[Uu++]=E,aa[Uu++]=P,Gh|=P,g.lanes|=P,g=g.alternate,g!==null&&(g.lanes|=P)}function Ut(g,v,E,P){return en(g,v,E,P),Tt(g)}function $e(g,v){return en(g,null,null,v),Tt(g)}function dt(g,v,E){g.lanes|=E;var P=g.alternate;P!==null&&(P.lanes|=E);for(var W=!1,ne=g.return;ne!==null;)ne.childLanes|=E,P=ne.alternate,P!==null&&(P.childLanes|=E),ne.tag===22&&(g=ne.stateNode,g===null||g._visibility&1||(W=!0)),g=ne,ne=ne.return;return g.tag===3?(ne=g.stateNode,W&&v!==null&&(W=31-ol(E),g=ne.hiddenUpdates,P=g[W],P===null?g[W]=[v]:P.push(v),v.lane=E|536870912),ne):null}function Tt(g){if(50<ui)throw ui=0,xg=null,Error(i(185));for(var v=g.return;v!==null;)g=v,v=g.return;return g.tag===3?g.stateNode:null}function Bt(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 At(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function Ot(g,v,E){var P=g.updateQueue;if(P===null)return null;if(P=P.shared,(Br&2)!==0){var W=P.pending;return W===null?v.next=v:(v.next=W.next,W.next=v),P.pending=v,v=Tt(g),dt(g,null,E),v}return en(g,P,v,E),Tt(g)}function cn(g,v,E){if(v=v.updateQueue,v!==null&&(v=v.shared,(E&4194048)!==0)){var P=v.lanes;P&=g.pendingLanes,E|=P,v.lanes=E,O(g,E)}}function Lt(g,v){var E=g.updateQueue,P=g.alternate;if(P!==null&&(P=P.updateQueue,E===P)){var W=null,ne=null;if(E=E.firstBaseUpdate,E!==null){do{var De={lane:E.lane,tag:E.tag,payload:E.payload,callback:null,next:null};ne===null?W=ne=De:ne=ne.next=De,E=E.next}while(E!==null);ne===null?W=ne=v:ne=ne.next=v}else W=ne=v;E={baseState:P.baseState,firstBaseUpdate:W,lastBaseUpdate:ne,shared:P.shared,callbacks:P.callbacks},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=v:g.next=v,E.lastBaseUpdate=v}function wt(){if(Nv){var g=Eo;if(g!==null)throw g}}function Zt(g,v,E,P){Nv=!1;var W=g.updateQueue;Dl=!1;var ne=W.firstBaseUpdate,De=W.lastBaseUpdate,at=W.shared.pending;if(at!==null){W.shared.pending=null;var zt=at,nn=zt.next;zt.next=null,De===null?ne=nn:De.next=nn,De=zt;var xn=g.alternate;xn!==null&&(xn=xn.updateQueue,at=xn.lastBaseUpdate,at!==De&&(at===null?xn.firstBaseUpdate=nn:at.next=nn,xn.lastBaseUpdate=zt))}if(ne!==null){var on=W.baseState;De=0,xn=nn=zt=null,at=ne;do{var kn=at.lane&-536870913,vr=kn!==at.lane;if(vr?(Xr&kn)===kn:(P&kn)===kn){kn!==0&&kn===jd&&(Nv=!0),xn!==null&&(xn=xn.next={lane:0,tag:at.tag,payload:at.payload,callback:null,next:null});e:{var Qs=g,h0=at;kn=v;var Of=E;switch(h0.tag){case 1:if(Qs=h0.payload,typeof Qs=="function"){on=Qs.call(Of,on,kn);break e}on=Qs;break e;case 3:Qs.flags=Qs.flags&-65537|128;case 0:if(Qs=h0.payload,kn=typeof Qs=="function"?Qs.call(Of,on,kn):Qs,kn==null)break e;on=rv({},on,kn);break e;case 2:Dl=!0}}kn=at.callback,kn!==null&&(g.flags|=64,vr&&(g.flags|=8192),vr=W.callbacks,vr===null?W.callbacks=[kn]:vr.push(kn))}else vr={lane:kn,tag:at.tag,payload:at.payload,callback:at.callback,next:null},xn===null?(nn=xn=vr,zt=on):xn=xn.next=vr,De|=kn;if(at=at.next,at===null){if(at=W.shared.pending,at===null)break;vr=at,at=vr.next,vr.next=null,W.lastBaseUpdate=vr,W.shared.pending=null}}while(!0);xn===null&&(zt=on),W.baseState=zt,W.firstBaseUpdate=nn,W.lastBaseUpdate=xn,ne===null&&(W.shared.lanes=0),Fd|=De,g.lanes=De,g.memoizedState=on}}function Jt(g,v){if(typeof g!="function")throw Error(i(191,g));g.call(v)}function vn(g,v){var E=g.callbacks;if(E!==null)for(g.callbacks=null,g=0;g<E.length;g++)Jt(E[g],v)}function Fn(g,v){g=Hu,b(Af,g),b(Wh,v),Hu=g|v.baseLanes}function _e(){b(Af,Hu),b(Wh,Wh.current)}function nt(){Hu=Af.current,x(Wh),x(Af)}function mt(g){var v=g.alternate;b(zs,zs.current&1),b(ll,g),cl===null&&(v===null||Wh.current!==null||v.memoizedState!==null)&&(cl=g)}function xt(g){b(zs,zs.current),b(ll,g),cl===null&&(cl=g)}function vt(g){g.tag===22?(b(zs,zs.current),b(ll,g),cl===null&&(cl=g)):qt()}function qt(){b(zs,zs.current),b(ll,ll.current)}function tn(g){x(ll),cl===g&&(cl=null),x(zs)}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||wf(E)||dv(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 Vt(){throw Error(i(321))}function dn(g,v){if(v===null)return!1;for(var E=0;E<v.length&&E<g.length;E++)if(!Ys(g[E],v[E]))return!1;return!0}function _n(g,v,E,P,W,ne){return zd=ne,Mr=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,Yn.H=g===null||g.memoizedState===null?Cs:Bu,ei=!1,ne=E(P,W),ei=!1,Nr&&(ne=rn(v,E,P,W)),An(g),ne}function An(g){Yn.H=Il;var v=Vn!==null&&Vn.next!==null;if(zd=0,pr=Vn=Mr=null,Dr=!1,_c=0,Yc=null,v)throw Error(i(300));g===null||es||(g=g.dependencies,g!==null&&Ge(g)&&(es=!0))}function rn(g,v,E,P){Mr=g;var W=0;do{if(Nr&&(Yc=null),_c=0,Nr=!1,25<=W)throw Error(i(301));if(W+=1,pr=Vn=null,g.updateQueue!=null){var ne=g.updateQueue;ne.lastEffect=null,ne.events=null,ne.stores=null,ne.memoCache!=null&&(ne.memoCache.index=0)}Yn.H=Nf,ne=v(E,P)}while(Nr);return ne}function Gn(){var g=Yn.H,v=g.useState()[0];return v=typeof v.then=="function"?Ln(v):v,g=g.useState()[0],(Vn!==null?Vn.memoizedState:null)!==g&&(Mr.flags|=1024),v}function xr(){var g=wa!==0;return wa=0,g}function sr(g,v,E){v.updateQueue=g.updateQueue,v.flags&=-2053,g.lanes&=~E}function Xn(g){if(Dr){for(g=g.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Dr=!1}zd=0,pr=Vn=Mr=null,Nr=!1,_c=wa=0,Yc=null}function dr(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pr===null?Mr.memoizedState=pr=g:pr=pr.next=g,pr}function un(){if(Vn===null){var g=Mr.alternate;g=g!==null?g.memoizedState:null}else g=Vn.next;var v=pr===null?Mr.memoizedState:pr.next;if(v!==null)pr=v,Vn=g;else{if(g===null)throw Mr.alternate===null?Error(i(467)):Error(i(310));Vn=g,g={memoizedState:Vn.memoizedState,baseState:Vn.baseState,baseQueue:Vn.baseQueue,queue:Vn.queue,next:null},pr===null?Mr.memoizedState=pr=g:pr=pr.next=g}return pr}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ln(g){var v=_c;return _c+=1,Yc===null&&(Yc=[]),g=Ze(Yc,g,v),v=Mr,(pr===null?v.memoizedState:pr.next)===null&&(v=v.alternate,Yn.H=v===null||v.memoizedState===null?Cs:Bu),g}function vs(g){if(g!==null&&typeof g=="object"){if(typeof g.then=="function")return Ln(g);if(g.$$typeof===fc)return ae(g)}throw Error(i(438,String(g)))}function Rs(g){var v=null,E=Mr.updateQueue;if(E!==null&&(v=E.memoCache),v==null){var P=Mr.alternate;P!==null&&(P=P.updateQueue,P!==null&&(P=P.memoCache,P!=null&&(v={data:P.data.map(function(W){return W.slice()}),index:0})))}if(v==null&&(v={data:[],index:0}),E===null&&(E=ss(),Mr.updateQueue=E),E.memoCache=v,E=v.data[v.index],E===void 0)for(E=v.data[v.index]=Array(g),P=0;P<g;P++)E[P]=ob;return v.index++,E}function Li(g,v){return typeof v=="function"?v(g):v}function ys(g){var v=un();return _r(v,Vn,g)}function _r(g,v,E){var P=g.queue;if(P===null)throw Error(i(311));P.lastRenderedReducer=E;var W=g.baseQueue,ne=P.pending;if(ne!==null){if(W!==null){var De=W.next;W.next=ne.next,ne.next=De}v.baseQueue=W=ne,P.pending=null}if(ne=g.baseState,W===null)g.memoizedState=ne;else{v=W.next;var at=De=null,zt=null,nn=v,xn=!1;do{var on=nn.lane&-536870913;if(on!==nn.lane?(Xr&on)===on:(zd&on)===on){var kn=nn.revertLane;if(kn===0)zt!==null&&(zt=zt.next={lane:0,revertLane:0,gesture:null,action:nn.action,hasEagerState:nn.hasEagerState,eagerState:nn.eagerState,next:null}),on===jd&&(xn=!0);else if((zd&kn)===kn){nn=nn.next,kn===jd&&(xn=!0);continue}else on={lane:0,revertLane:nn.revertLane,gesture:null,action:nn.action,hasEagerState:nn.hasEagerState,eagerState:nn.eagerState,next:null},zt===null?(at=zt=on,De=ne):zt=zt.next=on,Mr.lanes|=kn,Fd|=kn;on=nn.action,ei&&E(ne,on),ne=nn.hasEagerState?nn.eagerState:E(ne,on)}else kn={lane:on,revertLane:nn.revertLane,gesture:nn.gesture,action:nn.action,hasEagerState:nn.hasEagerState,eagerState:nn.eagerState,next:null},zt===null?(at=zt=kn,De=ne):zt=zt.next=kn,Mr.lanes|=on,Fd|=on;nn=nn.next}while(nn!==null&&nn!==v);if(zt===null?De=ne:zt.next=at,!Ys(ne,g.memoizedState)&&(es=!0,xn&&(E=Eo,E!==null)))throw E;g.memoizedState=ne,g.baseState=De,g.baseQueue=zt,P.lastRenderedState=ne}return W===null&&(P.lanes=0),[g.memoizedState,P.dispatch]}function pi(g){var v=un(),E=v.queue;if(E===null)throw Error(i(311));E.lastRenderedReducer=g;var P=E.dispatch,W=E.pending,ne=v.memoizedState;if(W!==null){E.pending=null;var De=W=W.next;do ne=g(ne,De.action),De=De.next;while(De!==W);Ys(ne,v.memoizedState)||(es=!0),v.memoizedState=ne,v.baseQueue===null&&(v.baseState=ne),E.lastRenderedState=ne}return[ne,P]}function Ps(g,v,E){var P=Mr,W=un(),ne=qr;if(ne){if(E===void 0)throw Error(i(407));E=E()}else E=v();var De=!Ys((Vn||W).memoizedState,E);if(De&&(W.memoizedState=E,es=!0),W=W.queue,Wr(va.bind(null,P,W,g),[g]),W.getSnapshot!==v||De||pr!==null&&pr.memoizedState.tag&1){if(P.flags|=2048,bs(9,{destroy:void 0},ea.bind(null,P,W,E,v),null),Ir===null)throw Error(i(349));ne||(zd&127)!==0||ji(P,v,E)}return E}function ji(g,v,E){g.flags|=16384,g={getSnapshot:v,value:E},v=Mr.updateQueue,v===null?(v=ss(),Mr.updateQueue=v,v.stores=[g]):(E=v.stores,E===null?v.stores=[g]:E.push(g))}function ea(g,v,E,P){v.value=E,v.getSnapshot=P,ka(v)&&ec(g)}function va(g,v,E){return E(function(){ka(v)&&ec(g)})}function ka(g){var v=g.getSnapshot;g=g.value;try{var E=v();return!Ys(g,E)}catch{return!0}}function ec(g){var v=$e(g,2);v!==null&&Ms(v,g,2)}function Ml(g){var v=dr();if(typeof g=="function"){var E=g;if(g=E(),ei){V(!0);try{E()}finally{V(!1)}}}return v.memoizedState=v.baseState=g,v.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:g},v}function ya(g,v,E,P){return g.baseState=E,_r(g,Vn,typeof P=="function"?P:Li)}function Ds(g,v,E,P,W){if(Eh(g))throw Error(i(485));if(g=v.action,g!==null){var ne={payload:W,action:g,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(De){ne.listeners.push(De)}};Yn.T!==null?E(!0):ne.isTransition=!1,P(ne),E=v.pending,E===null?(ne.next=v.pending=ne,tc(v,ne)):(ne.next=E.next,v.pending=E.next=ne)}}function tc(g,v){var E=v.action,P=v.payload,W=g.state;if(v.isTransition){var ne=Yn.T,De={};Yn.T=De;try{var at=E(W,P),zt=Yn.S;zt!==null&&zt(De,at),Qa(g,v,at)}catch(nn){Pa(g,v,nn)}finally{ne!==null&&De.types!==null&&(ne.types=De.types),Yn.T=ne}}else try{ne=E(W,P),Qa(g,v,ne)}catch(nn){Pa(g,v,nn)}}function Qa(g,v,E){E!==null&&typeof E=="object"&&typeof E.then=="function"?E.then(function(P){Ra(g,v,P)},function(P){return Pa(g,v,P)}):Ra(g,v,E)}function Ra(g,v,E){v.status="fulfilled",v.value=E,Bc(v),g.state=E,v=g.pending,v!==null&&(E=v.next,E===v?g.pending=null:(E=E.next,v.next=E,tc(g,E)))}function Pa(g,v,E){var P=g.pending;if(g.pending=null,P!==null){P=P.next;do v.status="rejected",v.reason=E,Bc(v),v=v.next;while(v!==P)}g.action=null}function Bc(g){g=g.listeners;for(var v=0;v<g.length;v++)(0,g[v])()}function Hc(g,v){return v}function nc(g,v){if(qr){var E=Ir.formState;if(E!==null){e:{var P=Mr;if(qr){if(cs){var W=S3(cs,za);if(W){cs=w3(W),P=Tb(W);break e}}oe(P)}P=!1}P&&(v=E[0])}}E=dr(),E.memoizedState=E.baseState=v,P={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hc,lastRenderedState:v},E.queue=P,E=El.bind(null,Mr,P),P.dispatch=E,P=Ml(!1);var ne=Op.bind(null,Mr,!1,P.queue);return P=dr(),W={state:v,dispatch:null,action:g,pending:null},P.queue=W,E=Ds.bind(null,Mr,W,ne,E),W.dispatch=E,P.memoizedState=g,[v,E,!1]}function ta(g){var v=un();return co(v,Vn,g)}function co(g,v,E){if(v=_r(g,v,Hc)[0],g=ys(Li)[0],typeof v=="object"&&v!==null&&typeof v.then=="function")try{var P=Ln(v)}catch(De){throw De===Ao?bc:De}else P=v;v=un();var W=v.queue,ne=W.dispatch;return E!==v.memoizedState&&(Mr.flags|=2048,bs(9,{destroy:void 0},Lo.bind(null,W,E),null)),[P,ne,g]}function Lo(g,v){g.action=v}function Tl(g){var v=un(),E=Vn;if(E!==null)return co(v,E,g);un(),v=v.memoizedState,E=un();var P=E.queue.dispatch;return E.memoizedState=g,[v,P,!1]}function bs(g,v,E,P){return g={tag:g,create:E,deps:P,inst:v,next:null},v=Mr.updateQueue,v===null&&(v=ss(),Mr.updateQueue=v),E=v.lastEffect,E===null?v.lastEffect=g.next=g:(P=E.next,E.next=g,g.next=P,v.lastEffect=g),g}function Ja(){return un().memoizedState}function el(g,v,E,P){var W=dr();Mr.flags|=g,W.memoizedState=bs(1|v,{destroy:void 0},E,P===void 0?null:P)}function Vc(g,v,E,P){var W=un();P=P===void 0?null:P;var ne=W.memoizedState.inst;Vn!==null&&P!==null&&dn(P,Vn.memoizedState.deps)?W.memoizedState=bs(v,ne,E,P):(Mr.flags|=g,W.memoizedState=bs(1|v,ne,E,P))}function ii(g,v){el(8390656,8,g,v)}function Wr(g,v){Vc(2048,8,g,v)}function na(g){Mr.flags|=4;var v=Mr.updateQueue;if(v===null)v=ss(),Mr.updateQueue=v,v.events=[g];else{var E=v.events;E===null?v.events=[g]:E.push(g)}}function Sr(g){var v=un().memoizedState;return na({ref:v,nextImpl:g}),function(){if((Br&2)!==0)throw Error(i(440));return v.impl.apply(void 0,arguments)}}function Si(g,v){return Vc(4,2,g,v)}function zi(g,v){return Vc(4,4,g,v)}function Kr(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 Da(g,v,E){E=E!=null?E.concat([g]):null,Vc(4,4,Kr.bind(null,v,g),E)}function Cl(){}function rc(g,v){var E=un();v=v===void 0?null:v;var P=E.memoizedState;return v!==null&&dn(v,P[1])?P[0]:(E.memoizedState=[g,v],g)}function _o(g,v){var E=un();v=v===void 0?null:v;var P=E.memoizedState;if(v!==null&&dn(v,P[1]))return P[0];if(P=g(),ei){V(!0);try{g()}finally{V(!1)}}return E.memoizedState=[P,v],P}function gi(g,v,E){return E===void 0||(zd&1073741824)!==0&&(Xr&261930)===0?g.memoizedState=v:(g.memoizedState=E,g=Ed(),Mr.lanes|=g,Fd|=g,E)}function Ch(g,v,E,P){return Ys(E,v)?E:Wh.current!==null?(g=gi(g,E,P),Ys(g,v)||(es=!0),g):(zd&42)===0||(zd&1073741824)!==0&&(Xr&261930)===0?(es=!0,g.memoizedState=E):(g=Ed(),Mr.lanes|=g,Fd|=g,v)}function vd(g,v,E,P,W){var ne=hc();$r(ne!==0&&8>ne?ne:8);var De=Yn.T,at={};Yn.T=at,Op(g,!1,v,E);try{var zt=W(),nn=Yn.S;if(nn!==null&&nn(at,zt),zt!==null&&typeof zt=="object"&&typeof zt.then=="function"){var xn=et(zt,P);So(g,v,xn,as(g))}else So(g,v,P,as(g))}catch(on){So(g,v,{then:function(){},status:"rejected",reason:on},as())}finally{$r(ne),De!==null&&at.types!==null&&(De.types=at.types),Yn.T=De}}function yd(g){var v=g.memoizedState;if(v!==null)return v;v={memoizedState:jh,baseState:jh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:jh},next:null};var E={};return v.next={memoizedState:E,baseState:E,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:E},next:null},g.memoizedState=v,g=g.alternate,g!==null&&(g.memoizedState=v),v}function cf(){return ae(zh)}function ba(){return un().memoizedState}function qi(){return un().memoizedState}function Gs(g){for(var v=g.return;v!==null;){switch(v.tag){case 24:case 3:var E=as();g=At(E);var P=Ot(v,g,E);P!==null&&(Ms(P,v,E),cn(P,v,E)),v={cache:be()},g.payload=v;return}v=v.return}}function _s(g,v,E){var P=as();E={lane:P,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null},Eh(g)?jm(v,E):(E=Ut(g,v,E,P),E!==null&&(Ms(E,g,P),uf(E,v,P)))}function El(g,v,E){var P=as();So(g,v,E,P)}function So(g,v,E,P){var W={lane:P,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null};if(Eh(g))jm(v,W);else{var ne=g.alternate;if(g.lanes===0&&(ne===null||ne.lanes===0)&&(ne=v.lastRenderedReducer,ne!==null))try{var De=v.lastRenderedState,at=ne(De,E);if(W.hasEagerState=!0,W.eagerState=at,Ys(at,De))return en(g,v,W,0),Ir===null&&Ht(),!1}catch{}finally{}if(E=Ut(g,v,W,P),E!==null)return Ms(E,g,P),uf(E,v,P),!0}return!1}function Op(g,v,E,P){if(P={lane:2,revertLane:Xe(),gesture:null,action:P,hasEagerState:!1,eagerState:null,next:null},Eh(g)){if(v)throw Error(i(479))}else v=Ut(g,E,P,2),v!==null&&Ms(v,g,2)}function Eh(g){var v=g.alternate;return g===Mr||v!==null&&v===Mr}function jm(g,v){Nr=Dr=!0;var E=g.pending;E===null?v.next=v:(v.next=E.next,E.next=v),g.pending=v}function uf(g,v,E){if((E&4194048)!==0){var P=v.lanes;P&=g.pendingLanes,E|=P,v.lanes=E,O(g,E)}}function bd(g,v,E,P){v=g.memoizedState,E=E(P,v),E=E==null?v:rv({},v,E),g.memoizedState=E,g.lanes===0&&(g.updateQueue.baseState=E)}function Lp(g,v,E,P,W,ne,De){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(P,ne,De):v.prototype&&v.prototype.isPureReactComponent?!Je(E,P)||!Je(W,ne):!0}function jp(g,v,E,P){g=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(E,P),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(E,P),v.state!==g&&fg.enqueueReplaceState(v,v.state,null)}function _d(g,v){var E=v;if("ref"in v){E={};for(var P in v)P!=="ref"&&(E[P]=v[P])}if(g=g.defaultProps){E===v&&(E=rv({},E));for(var W in g)E[W]===void 0&&(E[W]=g[W])}return E}function ic(g,v){try{var E=g.onUncaughtError;E(v.value,{componentStack:v.stack})}catch(P){setTimeout(function(){throw P})}}function sc(g,v,E){try{var P=g.onCaughtError;P(E.value,{componentStack:E.stack,errorBoundary:v.tag===1?v.stateNode:null})}catch(W){setTimeout(function(){throw W})}}function Sd(g,v,E){return E=At(E),E.tag=3,E.payload={element:null},E.callback=function(){ic(g,v)},E}function zm(g){return g=At(g),g.tag=3,g}function zp(g,v,E,P){var W=E.type.getDerivedStateFromError;if(typeof W=="function"){var ne=P.value;g.payload=function(){return W(ne)},g.callback=function(){sc(v,E,P)}}var De=E.stateNode;De!==null&&typeof De.componentDidCatch=="function"&&(g.callback=function(){sc(v,E,P),typeof W!="function"&&(Ud===null?Ud=new Set([this]):Ud.add(this));var at=P.stack;this.componentDidCatch(P.value,{componentStack:at!==null?at:""})})}function Fm(g,v,E,P,W){if(E.flags|=32768,P!==null&&typeof P=="object"&&typeof P.then=="function"){if(v=E.alternate,v!==null&&Be(v,E,W,!0),E=ll.current,E!==null){switch(E.tag){case 31:case 13:return cl===null?qp():E.alternate===null&&As===0&&(As=3),E.flags&=-257,E.flags|=65536,E.lanes=W,P===Fu?E.flags|=16384:(v=E.updateQueue,v===null?E.updateQueue=new Set([P]):v.add(P),Kp(g,P,W)),!1;case 22:return E.flags|=65536,P===Fu?E.flags|=16384:(v=E.updateQueue,v===null?(v={transitions:null,markerInstances:null,retryQueue:new Set([P])},E.updateQueue=v):(E=v.retryQueue,E===null?v.retryQueue=new Set([P]):E.add(P)),Kp(g,P,W)),!1}throw Error(i(435,E.tag))}return Kp(g,P,W),qp(),!1}if(qr)return v=ll.current,v!==null?((v.flags&65536)===0&&(v.flags|=256),v.flags|=65536,v.lanes=W,P!==Cv&&(g=Error(i(422),{cause:P}),Se(re(g,E)))):(P!==Cv&&(v=Error(i(423),{cause:P}),Se(re(v,E))),g=g.current.alternate,g.flags|=65536,W&=-W,g.lanes|=W,P=re(P,E),W=Sd(g.stateNode,P,W),Lt(g,W),As!==4&&(As=2)),!1;var ne=Error(i(520),{cause:P});if(ne=re(ne,E),pg===null?pg=[ne]:pg.push(ne),As!==4&&(As=2),v===null)return!0;P=re(P,E),E=v;do{switch(E.tag){case 3:return E.flags|=65536,g=W&-W,E.lanes|=g,g=Sd(E.stateNode,P,g),Lt(E,g),!1;case 1:if(v=E.type,ne=E.stateNode,(E.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||ne!==null&&typeof ne.componentDidCatch=="function"&&(Ud===null||!Ud.has(ne))))return E.flags|=65536,W&=-W,E.lanes|=W,W=zm(W),zp(W,g,E,P),Lt(E,W),!1}E=E.return}while(E!==null);return!1}function Ws(g,v,E,P){v.child=g===null?Vb(v,null,E,P):oa(v,g.child,E,P)}function Um(g,v,E,P,W){E=E.render;var ne=v.ref;if("ref"in P){var De={};for(var at in P)at!=="ref"&&(De[at]=P[at])}else De=P;return We(v),P=_n(g,v,E,De,ne,W),at=xr(),g!==null&&!es?(sr(g,v,W),Qe(g,v,W)):(qr&&at&&X(v),v.flags|=1,Ws(g,v,P,W),v.child)}function Bm(g,v,E,P,W){if(g===null){var ne=E.type;return typeof ne=="function"&&!Nh(ne)&&ne.defaultProps===void 0&&E.compare===null?(v.tag=15,v.type=ne,Hm(g,v,ne,P,W)):(g=kd(E.type,null,P,v,v.mode,W),g.ref=v.ref,g.return=v,v.child=g)}if(ne=g.child,!ft(g,W)){var De=ne.memoizedProps;if(E=E.compare,E=E!==null?E:Je,E(De,P)&&g.ref===v.ref)return Qe(g,v,W)}return v.flags|=1,g=kl(ne,P),g.ref=v.ref,g.return=v,v.child=g}function Hm(g,v,E,P,W){if(g!==null){var ne=g.memoizedProps;if(Je(ne,P)&&g.ref===v.ref)if(es=!1,v.pendingProps=P=ne,ft(g,W))(g.flags&131072)!==0&&(es=!0);else return v.lanes=g.lanes,Qe(g,v,W)}return Md(g,v,E,P,W)}function Vm(g,v,E,P){var W=P.children,ne=g!==null?g.memoizedState:null;if(g===null&&v.stateNode===null&&(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),P.mode==="hidden"){if((v.flags&128)!==0){if(ne=ne!==null?ne.baseLanes|E:E,g!==null){for(P=v.child=g.child,W=0;P!==null;)W=W|P.lanes|P.childLanes,P=P.sibling;P=W&~ne}else P=0,v.child=null;return wd(g,v,ne,E,P)}if((E&536870912)!==0)v.memoizedState={baseLanes:0,cachePool:null},g!==null&&yt(v,ne!==null?ne.cachePool:null),ne!==null?Fn(v,ne):_e(),vt(v);else return P=v.lanes=536870912,wd(g,v,ne!==null?ne.baseLanes|E:E,E,P)}else ne!==null?(yt(v,ne.cachePool),Fn(v,ne),qt(),v.memoizedState=null):(g!==null&&yt(v,null),_e(),qt());return Ws(g,v,W,E),v.child}function wu(g,v){return g!==null&&g.tag===22||v.stateNode!==null||(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.sibling}function wd(g,v,E,P,W){var ne=ct();return ne=ne===null?null:{parent:qs?us._currentValue:us._currentValue2,pool:ne},v.memoizedState={baseLanes:E,cachePool:ne},g!==null&&yt(v,null),_e(),vt(v),g!==null&&Be(g,v,P,!0),v.childLanes=W,null}function Fp(g,v){return v=Tu({mode:v.mode,children:v.children},g.mode),v.ref=g.ref,g.child=v,v.return=g,v}function Up(g,v,E){return oa(v,g.child,null,E),g=Fp(v,v.pendingProps),g.flags|=2,tn(v),v.memoizedState=null,g}function Gm(g,v,E){var P=v.pendingProps,W=(v.flags&128)!==0;if(v.flags&=-129,g===null){if(qr){if(P.mode==="hidden")return g=Fp(v,P),v.lanes=536870912,wu(null,g);if(xt(v),(g=cs)?(g=Eb(g,za),g!==null&&(v.memoizedState={dehydrated:g,treeContext:gc!==null?{id:ia,overflow:qc}:null,retryLane:536870912,hydrationErrors:null},E=rb(g),E.return=v,v.child=E,Co=v,cs=null)):g=null,g===null)throw oe(v);return v.lanes=536870912,null}return Fp(v,P)}var ne=g.memoizedState;if(ne!==null){var De=ne.dehydrated;if(xt(v),W)if(v.flags&256)v.flags&=-257,v=Up(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||Be(g,v,E,!1),W=(E&g.childLanes)!==0,es||W){if(P=Ir,P!==null&&(De=F(P,E),De!==0&&De!==ne.retryLane))throw ne.retryLane=De,$e(g,De),Ms(P,g,De),Ua;qp(),v=Up(g,v,E)}else g=ne.treeContext,ls&&(cs=E3(De),Co=v,qr=!0,zu=null,za=!1,g!==null&&le(v,g)),v=Fp(v,P),v.flags|=4096;return v}return g=kl(g.child,{mode:P.mode,children:P.children}),g.ref=v.ref,v.child=g,g.return=v,g}function oc(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 Md(g,v,E,P,W){return We(v),E=_n(g,v,E,P,void 0,W),P=xr(),g!==null&&!es?(sr(g,v,W),Qe(g,v,W)):(qr&&P&&X(v),v.flags|=1,Ws(g,v,E,W),v.child)}function Is(g,v,E,P,W,ne){return We(v),v.updateQueue=null,E=rn(v,P,E,W),An(g),P=xr(),g!==null&&!es?(sr(g,v,ne),Qe(g,v,ne)):(qr&&P&&X(v),v.flags|=1,Ws(g,v,E,ne),v.child)}function Mu(g,v,E,P,W){if(We(v),v.stateNode===null){var ne=Ou,De=E.contextType;typeof De=="object"&&De!==null&&(ne=ae(De)),ne=new E(P,ne),v.memoizedState=ne.state!==null&&ne.state!==void 0?ne.state:null,ne.updater=fg,v.stateNode=ne,ne._reactInternals=v,ne=v.stateNode,ne.props=P,ne.state=v.memoizedState,ne.refs={},Bt(v),De=E.contextType,ne.context=typeof De=="object"&&De!==null?ae(De):Ou,ne.state=v.memoizedState,De=E.getDerivedStateFromProps,typeof De=="function"&&(bd(v,E,De,P),ne.state=v.memoizedState),typeof E.getDerivedStateFromProps=="function"||typeof ne.getSnapshotBeforeUpdate=="function"||typeof ne.UNSAFE_componentWillMount!="function"&&typeof ne.componentWillMount!="function"||(De=ne.state,typeof ne.componentWillMount=="function"&&ne.componentWillMount(),typeof ne.UNSAFE_componentWillMount=="function"&&ne.UNSAFE_componentWillMount(),De!==ne.state&&fg.enqueueReplaceState(ne,ne.state,null),Zt(v,P,ne,W),wt(),ne.state=v.memoizedState),typeof ne.componentDidMount=="function"&&(v.flags|=4194308),P=!0}else if(g===null){ne=v.stateNode;var at=v.memoizedProps,zt=_d(E,at);ne.props=zt;var nn=ne.context,xn=E.contextType;De=Ou,typeof xn=="object"&&xn!==null&&(De=ae(xn));var on=E.getDerivedStateFromProps;xn=typeof on=="function"||typeof ne.getSnapshotBeforeUpdate=="function",at=v.pendingProps!==at,xn||typeof ne.UNSAFE_componentWillReceiveProps!="function"&&typeof ne.componentWillReceiveProps!="function"||(at||nn!==De)&&jp(v,ne,P,De),Dl=!1;var kn=v.memoizedState;ne.state=kn,Zt(v,P,ne,W),wt(),nn=v.memoizedState,at||kn!==nn||Dl?(typeof on=="function"&&(bd(v,E,on,P),nn=v.memoizedState),(zt=Dl||Lp(v,E,zt,P,kn,nn,De))?(xn||typeof ne.UNSAFE_componentWillMount!="function"&&typeof ne.componentWillMount!="function"||(typeof ne.componentWillMount=="function"&&ne.componentWillMount(),typeof ne.UNSAFE_componentWillMount=="function"&&ne.UNSAFE_componentWillMount()),typeof ne.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ne.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=P,v.memoizedState=nn),ne.props=P,ne.state=nn,ne.context=De,P=zt):(typeof ne.componentDidMount=="function"&&(v.flags|=4194308),P=!1)}else{ne=v.stateNode,Ct(g,v),De=v.memoizedProps,xn=_d(E,De),ne.props=xn,on=v.pendingProps,kn=ne.context,nn=E.contextType,zt=Ou,typeof nn=="object"&&nn!==null&&(zt=ae(nn)),at=E.getDerivedStateFromProps,(nn=typeof at=="function"||typeof ne.getSnapshotBeforeUpdate=="function")||typeof ne.UNSAFE_componentWillReceiveProps!="function"&&typeof ne.componentWillReceiveProps!="function"||(De!==on||kn!==zt)&&jp(v,ne,P,zt),Dl=!1,kn=v.memoizedState,ne.state=kn,Zt(v,P,ne,W),wt();var vr=v.memoizedState;De!==on||kn!==vr||Dl||g!==null&&g.dependencies!==null&&Ge(g.dependencies)?(typeof at=="function"&&(bd(v,E,at,P),vr=v.memoizedState),(xn=Dl||Lp(v,E,xn,P,kn,vr,zt)||g!==null&&g.dependencies!==null&&Ge(g.dependencies))?(nn||typeof ne.UNSAFE_componentWillUpdate!="function"&&typeof ne.componentWillUpdate!="function"||(typeof ne.componentWillUpdate=="function"&&ne.componentWillUpdate(P,vr,zt),typeof ne.UNSAFE_componentWillUpdate=="function"&&ne.UNSAFE_componentWillUpdate(P,vr,zt)),typeof ne.componentDidUpdate=="function"&&(v.flags|=4),typeof ne.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ne.componentDidUpdate!="function"||De===g.memoizedProps&&kn===g.memoizedState||(v.flags|=4),typeof ne.getSnapshotBeforeUpdate!="function"||De===g.memoizedProps&&kn===g.memoizedState||(v.flags|=1024),v.memoizedProps=P,v.memoizedState=vr),ne.props=P,ne.state=vr,ne.context=zt,P=xn):(typeof ne.componentDidUpdate!="function"||De===g.memoizedProps&&kn===g.memoizedState||(v.flags|=4),typeof ne.getSnapshotBeforeUpdate!="function"||De===g.memoizedProps&&kn===g.memoizedState||(v.flags|=1024),P=!1)}return ne=P,oc(g,v),P=(v.flags&128)!==0,ne||P?(ne=v.stateNode,E=P&&typeof E.getDerivedStateFromError!="function"?null:ne.render(),v.flags|=1,g!==null&&P?(v.child=oa(v,g.child,null,W),v.child=oa(v,null,E,W)):Ws(g,v,E,W),v.memoizedState=ne.state,g=v.child):g=Qe(g,v,W),g}function Ss(g,v,E,P){return Me(),v.flags|=256,Ws(g,v,E,P),v.child}function Bp(g){return{baseLanes:g,cachePool:lt()}}function Ah(g,v,E){return g=g!==null?g.childLanes&~E:0,v&&(g|=Ba),g}function Td(g,v,E){var P=v.pendingProps,W=!1,ne=(v.flags&128)!==0,De;if((De=ne)||(De=g!==null&&g.memoizedState===null?!1:(zs.current&2)!==0),De&&(W=!0,v.flags&=-129),De=(v.flags&32)!==0,v.flags&=-33,g===null){if(qr){if(W?mt(v):qt(),(g=cs)?(g=R3(g,za),g!==null&&(v.memoizedState={dehydrated:g,treeContext:gc!==null?{id:ia,overflow:qc}:null,retryLane:536870912,hydrationErrors:null},E=rb(g),E.return=v,v.child=E,Co=v,cs=null)):g=null,g===null)throw oe(v);return dv(g)?v.lanes=32:v.lanes=536870912,null}var at=P.children;return P=P.fallback,W?(qt(),W=v.mode,at=Tu({mode:"hidden",children:at},W),P=dc(P,W,E,null),at.return=v,P.return=v,at.sibling=P,v.child=at,P=v.child,P.memoizedState=Bp(E),P.childLanes=Ah(g,De,E),v.memoizedState=$h,wu(null,P)):(mt(v),Hp(v,at))}var zt=g.memoizedState;if(zt!==null&&(at=zt.dehydrated,at!==null)){if(ne)v.flags&256?(mt(v),v.flags&=-257,v=Gc(g,v,E)):v.memoizedState!==null?(qt(),v.child=g.child,v.flags|=128,v=null):(qt(),at=P.fallback,W=v.mode,P=Tu({mode:"visible",children:P.children},W),at=dc(at,W,E,null),at.flags|=2,P.return=v,at.return=v,P.sibling=at,v.child=P,oa(v,g.child,null,E),P=v.child,P.memoizedState=Bp(E),P.childLanes=Ah(g,De,E),v.memoizedState=$h,v=wu(null,P));else if(mt(v),dv(at))De=fv(at).digest,P=Error(i(419)),P.stack="",P.digest=De,Se({value:P,source:null,stack:null}),v=Gc(g,v,E);else if(es||Be(g,v,E,!1),De=(E&g.childLanes)!==0,es||De){if(De=Ir,De!==null&&(P=F(De,E),P!==0&&P!==zt.retryLane))throw zt.retryLane=P,$e(g,P),Ms(De,g,P),Ua;wf(at)||qp(),v=Gc(g,v,E)}else wf(at)?(v.flags|=192,v.child=g.child,v=null):(g=zt.treeContext,ls&&(cs=A3(at),Co=v,qr=!0,zu=null,za=!1,g!==null&&le(v,g)),v=Hp(v,P.children),v.flags|=4096);return v}return W?(qt(),at=P.fallback,W=v.mode,zt=g.child,ne=zt.sibling,P=kl(zt,{mode:"hidden",children:P.children}),P.subtreeFlags=zt.subtreeFlags&65011712,ne!==null?at=kl(ne,at):(at=dc(at,W,E,null),at.flags|=2),at.return=v,P.return=v,P.sibling=at,v.child=P,wu(null,P),P=v.child,at=g.child.memoizedState,at===null?at=Bp(E):(W=at.cachePool,W!==null?(zt=qs?us._currentValue:us._currentValue2,W=W.parent!==zt?{parent:zt,pool:zt}:W):W=lt(),at={baseLanes:at.baseLanes|E,cachePool:W}),P.memoizedState=at,P.childLanes=Ah(g,De,E),v.memoizedState=$h,wu(g.child,P)):(mt(v),E=g.child,g=E.sibling,E=kl(E,{mode:"visible",children:P.children}),E.return=v,E.sibling=null,g!==null&&(De=v.deletions,De===null?(v.deletions=[g],v.flags|=16):De.push(g)),v.child=E,v.memoizedState=null,E)}function Hp(g,v){return v=Tu({mode:"visible",children:v},g.mode),v.return=g,g.child=v}function Tu(g,v){return g=n(22,g,null,v),g.lanes=0,g}function Gc(g,v,E){return oa(v,g.child,null,E),g=Hp(v,v.pendingProps.children),g.flags|=2,v.memoizedState=null,g}function xe(g,v,E){g.lanes|=v;var P=g.alternate;P!==null&&(P.lanes|=v),ce(g.return,v,E)}function Ne(g,v,E,P,W,ne){var De=g.memoizedState;De===null?g.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:P,tail:E,tailMode:W,treeForkCount:ne}:(De.isBackwards=v,De.rendering=null,De.renderingStartTime=0,De.last=P,De.tail=E,De.tailMode=W,De.treeForkCount=ne)}function Ye(g,v,E){var P=v.pendingProps,W=P.revealOrder,ne=P.tail;P=P.children;var De=zs.current,at=(De&2)!==0;if(at?(De=De&1|2,v.flags|=128):De&=1,b(zs,De),Ws(g,v,P,E),P=qr?cg:0,!at&&g!==null&&(g.flags&128)!==0)e:for(g=v.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&xe(g,E,v);else if(g.tag===19)xe(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(W){case"forwards":for(E=v.child,W=null;E!==null;)g=E.alternate,g!==null&&Kt(g)===null&&(W=E),E=E.sibling;E=W,E===null?(W=v.child,v.child=null):(W=E.sibling,E.sibling=null),Ne(v,!1,W,E,ne,P);break;case"backwards":case"unstable_legacy-backwards":for(E=null,W=v.child,v.child=null;W!==null;){if(g=W.alternate,g!==null&&Kt(g)===null){v.child=W;break}g=W.sibling,W.sibling=E,E=W,W=g}Ne(v,!0,E,null,ne,P);break;case"together":Ne(v,!1,null,null,void 0,P);break;default:v.memoizedState=null}return v.child}function Qe(g,v,E){if(g!==null&&(v.dependencies=g.dependencies),Fd|=v.lanes,(E&v.childLanes)===0)if(g!==null){if(Be(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=kl(g,g.pendingProps),v.child=E,E.return=v;g.sibling!==null;)g=g.sibling,E=E.sibling=kl(g,g.pendingProps),E.return=v;E.sibling=null}return v.child}function ft(g,v){return(g.lanes&v)!==0?!0:(g=g.dependencies,!!(g!==null&&Ge(g)))}function Et(g,v,E){switch(v.tag){case 3:se(v,v.stateNode.containerInfo),me(v,us,g.memoizedState.cache),Me();break;case 27:case 5:ee(v);break;case 4:se(v,v.stateNode.containerInfo);break;case 10:me(v,v.type,v.memoizedProps.value);break;case 31:if(v.memoizedState!==null)return v.flags|=128,xt(v),null;break;case 13:var P=v.memoizedState;if(P!==null)return P.dehydrated!==null?(mt(v),v.flags|=128,null):(E&v.child.childLanes)!==0?Td(g,v,E):(mt(v),g=Qe(g,v,E),g!==null?g.sibling:null);mt(v);break;case 19:var W=(g.flags&128)!==0;if(P=(E&v.childLanes)!==0,P||(Be(g,v,E,!1),P=(E&v.childLanes)!==0),W){if(P)return Ye(g,v,E);v.flags|=128}if(W=v.memoizedState,W!==null&&(W.rendering=null,W.tail=null,W.lastEffect=null),b(zs,zs.current),P)break;return null;case 22:return v.lanes=0,Vm(g,v,E,v.pendingProps);case 24:me(v,us,g.memoizedState.cache)}return Qe(g,v,E)}function $t(g,v,E){if(g!==null)if(g.memoizedProps!==v.pendingProps)es=!0;else{if(!ft(g,E)&&(v.flags&128)===0)return es=!1,Et(g,v,E);es=(g.flags&131072)!==0}else es=!1,qr&&(v.flags&1048576)!==0&&H(v,cg,v.index);switch(v.lanes=0,v.tag){case 16:e:{var P=v.pendingProps;if(g=Ie(v.elementType),v.type=g,typeof g=="function")Nh(g)?(P=_d(g,P),v.tag=1,v=Mu(null,v,g,P,E)):(v.tag=0,v=Md(null,v,g,P,E));else{if(g!=null){var W=g.$$typeof;if(W===Zp){v.tag=11,v=Um(null,v,g,P,E);break e}else if(W===sv){v.tag=14,v=Bm(null,v,g,P,E);break e}}throw v=p(g)||g,Error(i(306,v,""))}}return v;case 0:return Md(g,v,v.type,v.pendingProps,E);case 1:return P=v.type,W=_d(P,v.pendingProps),Mu(g,v,P,W,E);case 3:e:{if(se(v,v.stateNode.containerInfo),g===null)throw Error(i(387));var ne=v.pendingProps;W=v.memoizedState,P=W.element,Ct(g,v),Zt(v,ne,null,E);var De=v.memoizedState;if(ne=De.cache,me(v,us,ne),ne!==W.cache&&He(v,[us],E,!0),wt(),ne=De.element,ls&&W.isDehydrated)if(W={element:ne,isDehydrated:!1,cache:De.cache},v.updateQueue.baseState=W,v.memoizedState=W,v.flags&256){v=Ss(g,v,ne,E);break e}else if(ne!==P){P=re(Error(i(424)),v),Se(P),v=Ss(g,v,ne,E);break e}else for(ls&&(cs=C3(v.stateNode.containerInfo),Co=v,qr=!0,zu=null,za=!0),E=Vb(v,null,ne,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Me(),ne===P){v=Qe(g,v,E);break e}Ws(g,v,ne,E)}v=v.child}return v;case 26:if(pc)return oc(g,v),g===null?(E=Pb(v.type,null,v.pendingProps,null))?v.memoizedState=E:qr||(v.stateNode=gv(v.type,v.pendingProps,sa.current,v)):v.memoizedState=Pb(v.type,g.memoizedProps,v.pendingProps,g.memoizedState),null;case 27:if(To)return ee(v),g===null&&To&&qr&&(P=v.stateNode=xv(v.type,v.pendingProps,sa.current,Vo.current,!1),Co=v,za=!0,cs=Cb(v.type,P,cs)),Ws(g,v,v.pendingProps.children,E),oc(g,v),g===null&&(v.flags|=4194304),v.child;case 5:return g===null&&qr&&(U3(v.type,v.pendingProps,Vo.current),(W=P=cs)&&(P=N3(P,v.type,v.pendingProps,za),P!==null?(v.stateNode=P,Co=v,cs=T3(P),za=!1,W=!0):W=!1),W||oe(v)),ee(v),W=v.type,ne=v.pendingProps,De=g!==null?g.memoizedProps:null,P=ne.children,ja(W,ne)?P=null:De!==null&&ja(W,De)&&(v.flags|=32),v.memoizedState!==null&&(W=_n(g,v,Gn,null,null,E),qs?zh._currentValue=W:zh._currentValue2=W),oc(g,v),Ws(g,v,P,E),v.child;case 6:return g===null&&qr&&(Rb(v.pendingProps,Vo.current),(g=E=cs)&&(E=k3(E,v.pendingProps,za),E!==null?(v.stateNode=E,Co=v,cs=null,g=!0):g=!1),g||oe(v)),null;case 13:return Td(g,v,E);case 4:return se(v,v.stateNode.containerInfo),P=v.pendingProps,g===null?v.child=oa(v,null,P,E):Ws(g,v,P,E),v.child;case 11:return Um(g,v,v.type,v.pendingProps,E);case 7:return Ws(g,v,v.pendingProps,E),v.child;case 8:return Ws(g,v,v.pendingProps.children,E),v.child;case 12:return Ws(g,v,v.pendingProps.children,E),v.child;case 10:return P=v.pendingProps,me(v,v.type,P.value),Ws(g,v,P.children,E),v.child;case 9:return W=v.type._context,P=v.pendingProps.children,We(v),W=ae(W),P=P(W),v.flags|=1,Ws(g,v,P,E),v.child;case 14:return Bm(g,v,v.type,v.pendingProps,E);case 15:return Hm(g,v,v.type,v.pendingProps,E);case 19:return Ye(g,v,E);case 31:return Gm(g,v,E);case 22:return Vm(g,v,E,v.pendingProps);case 24:return We(v),P=ae(us),g===null?(W=ct(),W===null&&(W=Ir,ne=be(),W.pooledCache=ne,ne.refCount++,ne!==null&&(W.pooledCacheLanes|=E),W=ne),v.memoizedState={parent:P,cache:W},Bt(v),me(v,us,W)):((g.lanes&E)!==0&&(Ct(g,v),Zt(v,null,null,E),wt()),W=g.memoizedState,ne=v.memoizedState,W.parent!==P?(W={parent:P,cache:P},v.memoizedState=W,v.lanes===0&&(v.memoizedState=v.updateQueue.baseState=W),me(v,us,P)):(P=ne.cache,me(v,us,P),P!==W.cache&&He(v,[us],E,!0))),Ws(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 ln(g){Rl&&(g.flags|=8)}function Mn(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 Cn(g,v,E,P){if(Qr)for(E=v.child;E!==null;){if(E.tag===5||E.tag===6)tg(g,E.stateNode);else if(!(E.tag===4||To&&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(Rl)for(var W=v.child;W!==null;){if(W.tag===5){var ne=W.stateNode;E&&P&&(ne=_3(ne,W.type,W.memoizedProps)),tg(g,ne)}else if(W.tag===6)ne=W.stateNode,E&&P&&(ne=Mb(ne,W.memoizedProps)),tg(g,ne);else if(W.tag!==4){if(W.tag===22&&W.memoizedState!==null)ne=W.child,ne!==null&&(ne.return=W),Cn(g,W,!0,!0);else if(W.child!==null){W.child.return=W,W=W.child;continue}}if(W===v)break;for(;W.sibling===null;){if(W.return===null||W.return===v)return;W=W.return}W.sibling.return=W.return,W=W.sibling}}function Pn(g,v,E,P){var W=!1;if(Rl)for(var ne=v.child;ne!==null;){if(ne.tag===5){var De=ne.stateNode;E&&P&&(De=_3(De,ne.type,ne.memoizedProps)),Sb(g,De)}else if(ne.tag===6)De=ne.stateNode,E&&P&&(De=Mb(De,ne.memoizedProps)),Sb(g,De);else if(ne.tag!==4){if(ne.tag===22&&ne.memoizedState!==null)W=ne.child,W!==null&&(W.return=ne),Pn(g,ne,!0,!0),W=!0;else if(ne.child!==null){ne.child.return=ne,ne=ne.child;continue}}if(ne===v)break;for(;ne.sibling===null;){if(ne.return===null||ne.return===v)return W;ne=ne.return}ne.sibling.return=ne.return,ne=ne.sibling}return W}function ar(g,v){if(Rl&&Mn(g,v)){g=v.stateNode;var E=g.containerInfo,P=_b();Pn(P,v,!1,!1),g.pendingChildren=P,Qt(v),b3(E,P)}}function Jr(g,v,E,P){if(Qr)g.memoizedProps!==P&&Qt(v);else if(Rl){var W=g.stateNode,ne=g.memoizedProps;if((g=Mn(g,v))||ne!==P){var De=Vo.current;ne=y3(W,E,ne,P,!g,null),ne===W?v.stateNode=W:(ln(v),il(ne,E,P,De)&&Qt(v),v.stateNode=ne,g&&Cn(ne,v,!1,!1))}else v.stateNode=W}}function lr(g,v,E,P,W){if((g.mode&32)!==0&&(E===null?ng(v,P):n0(v,E,P))){if(g.flags|=16777216,(W&335544128)===W||ub(v,P))if(Ts(g.stateNode,v,P))g.flags|=8192;else if(Zr())g.flags|=8192;else throw Fa=Fu,Av}else g.flags&=-16777217}function gr(g,v){if(Lb(v)){if(g.flags|=16777216,!jb(v))if(Zr())g.flags|=8192;else throw Fa=Fu,Av}else g.flags&=-16777217}function $n(g,v){v!==null&&(g.flags|=4),g.flags&16384&&(v=g.tag!==22?N():536870912,g.lanes|=v,d0|=v)}function On(g,v){if(!qr)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 P=null;E!==null;)E.alternate!==null&&(P=E),E=E.sibling;P===null?v||g.tail===null?g.tail=null:g.tail.sibling=null:P.sibling=null}}function Zn(g){var v=g.alternate!==null&&g.alternate.child===g.child,E=0,P=0;if(v)for(var W=g.child;W!==null;)E|=W.lanes|W.childLanes,P|=W.subtreeFlags&65011712,P|=W.flags&65011712,W.return=g,W=W.sibling;else for(W=g.child;W!==null;)E|=W.lanes|W.childLanes,P|=W.subtreeFlags,P|=W.flags,W.return=g,W=W.sibling;return g.subtreeFlags|=P,g.childLanes=E,v}function Ji(g,v,E){var P=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 Zn(v),null;case 1:return Zn(v),null;case 3:return E=v.stateNode,P=null,g!==null&&(P=g.memoizedState.cache),v.memoizedState.cache!==P&&(v.flags|=2048),Pe(us),J(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(g===null||g.child===null)&&(ge(v)?Qt(v):g===null||g.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,fe())),ar(g,v),Zn(v),null;case 26:if(pc){var W=v.type,ne=v.memoizedState;return g===null?(Qt(v),ne!==null?(Zn(v),gr(v,ne)):(Zn(v),lr(v,W,null,P,E))):ne?ne!==g.memoizedState?(Qt(v),Zn(v),gr(v,ne)):(Zn(v),v.flags&=-16777217):(ne=g.memoizedProps,Qr?ne!==P&&Qt(v):Jr(g,v,W,P),Zn(v),lr(v,W,ne,P,E)),null}case 27:if(To){if(ie(v),E=sa.current,W=v.type,g!==null&&v.stateNode!=null)Qr?g.memoizedProps!==P&&Qt(v):Jr(g,v,W,P);else{if(!P){if(v.stateNode===null)throw Error(i(166));return Zn(v),null}g=Vo.current,ge(v)?de(v,g):(g=xv(W,P,E,g,!0),v.stateNode=g,Qt(v))}return Zn(v),null}case 5:if(ie(v),W=v.type,g!==null&&v.stateNode!=null)Jr(g,v,W,P);else{if(!P){if(v.stateNode===null)throw Error(i(166));return Zn(v),null}if(ne=Vo.current,ge(v))de(v,ne),j3(v.stateNode,W,P,ne)&&(v.flags|=64);else{var De=lb(W,P,sa.current,ne,v);ln(v),Cn(De,v,!1,!1),v.stateNode=De,il(De,W,P,ne)&&Qt(v)}}return Zn(v),lr(v,v.type,g===null?null:g.memoizedProps,v.pendingProps,E),null;case 6:if(g&&v.stateNode!=null)E=g.memoizedProps,Qr?E!==P&&Qt(v):Rl&&(E!==P?(g=sa.current,E=Vo.current,ln(v),v.stateNode=Dd(P,g,E,v)):v.stateNode=g.stateNode);else{if(typeof P!="string"&&v.stateNode===null)throw Error(i(166));if(g=sa.current,E=Vo.current,ge(v)){if(!ls)throw Error(i(176));if(g=v.stateNode,E=v.memoizedProps,P=null,W=Co,W!==null)switch(W.tag){case 27:case 5:P=W.memoizedProps}TE(g,E,v,P)||oe(v,!0)}else ln(v),v.stateNode=Dd(P,g,E,v)}return Zn(v),null;case 31:if(E=v.memoizedState,g===null||g.memoizedState!==null){if(P=ge(v),E!==null){if(g===null){if(!P)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));Ab(g,v)}else Me(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;Zn(v),g=!1}else E=fe(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=E),g=!0;if(!g)return v.flags&256?(tn(v),v):(tn(v),null);if((v.flags&128)!==0)throw Error(i(558))}return Zn(v),null;case 13:if(P=v.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(W=ge(v),P!==null&&P.dehydrated!==null){if(g===null){if(!W)throw Error(i(318));if(!ls)throw Error(i(344));if(W=v.memoizedState,W=W!==null?W.dehydrated:null,!W)throw Error(i(317));D3(W,v)}else Me(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;Zn(v),W=!1}else W=fe(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=W),W=!0;if(!W)return v.flags&256?(tn(v),v):(tn(v),null)}return tn(v),(v.flags&128)!==0?(v.lanes=E,v):(E=P!==null,g=g!==null&&g.memoizedState!==null,E&&(P=v.child,W=null,P.alternate!==null&&P.alternate.memoizedState!==null&&P.alternate.memoizedState.cachePool!==null&&(W=P.alternate.memoizedState.cachePool.pool),ne=null,P.memoizedState!==null&&P.memoizedState.cachePool!==null&&(ne=P.memoizedState.cachePool.pool),ne!==W&&(P.flags|=2048)),E!==g&&E&&(v.child.flags|=8192),$n(v,v.updateQueue),Zn(v),null);case 4:return J(),ar(g,v),g===null&&Fi(v.stateNode.containerInfo),Zn(v),null;case 10:return Pe(v.type),Zn(v),null;case 19:if(x(zs),P=v.memoizedState,P===null)return Zn(v),null;if(W=(v.flags&128)!==0,ne=P.rendering,ne===null)if(W)On(P,!1);else{if(As!==0||g!==null&&(g.flags&128)!==0)for(g=v.child;g!==null;){if(ne=Kt(g),ne!==null){for(v.flags|=128,On(P,!1),g=ne.updateQueue,v.updateQueue=g,$n(v,g),v.subtreeFlags=0,g=E,E=v.child;E!==null;)ev(E,g),E=E.sibling;return b(zs,zs.current&1|2),qr&&U(v,P.treeForkCount),v.child}g=g.sibling}P.tail!==null&&_a()>If&&(v.flags|=128,W=!0,On(P,!1),v.lanes=4194304)}else{if(!W)if(g=Kt(ne),g!==null){if(v.flags|=128,W=!0,g=g.updateQueue,v.updateQueue=g,$n(v,g),On(P,!0),P.tail===null&&P.tailMode==="hidden"&&!ne.alternate&&!qr)return Zn(v),null}else 2*_a()-P.renderingStartTime>If&&E!==536870912&&(v.flags|=128,W=!0,On(P,!1),v.lanes=4194304);P.isBackwards?(ne.sibling=v.child,v.child=ne):(g=P.last,g!==null?g.sibling=ne:v.child=ne,P.last=ne)}return P.tail!==null?(g=P.tail,P.rendering=g,P.tail=g.sibling,P.renderingStartTime=_a(),g.sibling=null,E=zs.current,b(zs,W?E&1|2:E&1),qr&&U(v,P.treeForkCount),g):(Zn(v),null);case 22:case 23:return tn(v),nt(),P=v.memoizedState!==null,g!==null?g.memoizedState!==null!==P&&(v.flags|=8192):P&&(v.flags|=8192),P?(E&536870912)!==0&&(v.flags&128)===0&&(Zn(v),v.subtreeFlags&6&&(v.flags|=8192)):Zn(v),E=v.updateQueue,E!==null&&$n(v,E.retryQueue),E=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),P=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(P=v.memoizedState.cachePool.pool),P!==E&&(v.flags|=2048),g!==null&&x(Cf),null;case 24:return E=null,g!==null&&(E=g.memoizedState.cache),v.memoizedState.cache!==E&&(v.flags|=2048),Pe(us),Zn(v),null;case 25:return null;case 30:return null}throw Error(i(156,v.tag))}function Os(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 Pe(us),J(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 26:case 27:case 5:return ie(v),null;case 31:if(v.memoizedState!==null){if(tn(v),v.alternate===null)throw Error(i(340));Me()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 13:if(tn(v),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(i(340));Me()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return x(zs),null;case 4:return J(),null;case 10:return Pe(v.type),null;case 22:case 23:return tn(v),nt(),g!==null&&x(Cf),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 24:return Pe(us),null;case 25:return null;default:return null}}function xi(g,v){switch(j(v),v.tag){case 3:Pe(us),J();break;case 26:case 27:case 5:ie(v);break;case 4:J();break;case 31:v.memoizedState!==null&&tn(v);break;case 13:tn(v);break;case 19:x(zs);break;case 10:Pe(v.type);break;case 22:case 23:tn(v),nt(),g!==null&&x(Cf);break;case 24:Pe(us)}}function ci(g,v){try{var E=v.updateQueue,P=E!==null?E.lastEffect:null;if(P!==null){var W=P.next;E=W;do{if((E.tag&g)===g){P=void 0;var ne=E.create,De=E.inst;P=ne(),De.destroy=P}E=E.next}while(E!==W)}}catch(at){cr(v,v.return,at)}}function os(g,v,E){try{var P=v.updateQueue,W=P!==null?P.lastEffect:null;if(W!==null){var ne=W.next;P=ne;do{if((P.tag&g)===g){var De=P.inst,at=De.destroy;if(at!==void 0){De.destroy=void 0,W=v;var zt=E,nn=at;try{nn()}catch(xn){cr(W,zt,xn)}}}P=P.next}while(P!==ne)}}catch(xn){cr(v,v.return,xn)}}function Ls(g){var v=g.updateQueue;if(v!==null){var E=g.stateNode;try{vn(v,E)}catch(P){cr(g,g.return,P)}}}function ra(g,v,E){E.props=_d(g.type,g.memoizedProps),E.state=g.memoizedState;try{E.componentWillUnmount()}catch(P){cr(g,v,P)}}function jo(g,v){try{var E=g.ref;if(E!==null){switch(g.tag){case 26:case 27:case 5:var P=Jp(g.stateNode);break;case 30:P=g.stateNode;break;default:P=g.stateNode}typeof E=="function"?g.refCleanup=E(P):E.current=P}}catch(W){cr(g,v,W)}}function Wi(g,v){var E=g.ref,P=g.refCleanup;if(E!==null)if(typeof P=="function")try{P()}catch(W){cr(g,v,W)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof E=="function")try{E(null)}catch(W){cr(g,v,W)}else E.current=null}function $s(g){var v=g.type,E=g.memoizedProps,P=g.stateNode;try{d3(P,v,E,g)}catch(W){cr(g,g.return,W)}}function zo(g,v,E){try{f3(g.stateNode,g.type,E,v,g)}catch(P){cr(g,g.return,P)}}function Ia(g){return g.tag===5||g.tag===3||(pc?g.tag===26:!1)||(To?g.tag===27&&Fh(g.type):!1)||g.tag===4}function uo(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||Ia(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(To&&g.tag===27&&Fh(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 fo(g,v,E){var P=g.tag;if(P===5||P===6)g=g.stateNode,v?p3(E,g,v):xb(E,g);else if(P!==4&&(To&&P===27&&Fh(g.type)&&(E=g.stateNode,v=null),g=g.child,g!==null))for(fo(g,v,E),g=g.sibling;g!==null;)fo(g,v,E),g=g.sibling}function wo(g,v,E){var P=g.tag;if(P===5||P===6)g=g.stateNode,v?h3(E,g,v):gb(E,g);else if(P!==4&&(To&&P===27&&Fh(g.type)&&(E=g.stateNode),g=g.child,g!==null))for(wo(g,v,E),g=g.sibling;g!==null;)wo(g,v,E),g=g.sibling}function Wc(g,v,E){g=g.containerInfo;try{wb(g,E)}catch(P){cr(v,v.return,P)}}function Fo(g){var v=g.stateNode,E=g.memoizedProps;try{po(g.type,E,v,g)}catch(P){cr(g,g.return,P)}}function Gx(g,v){for(ov(g.containerInfo),Ks=v;Ks!==null;)if(g=Ks,v=g.child,(g.subtreeFlags&1028)!==0&&v!==null)v.return=g,Ks=v;else for(;Ks!==null;){g=Ks;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 P=0;P<v.length;P++){var W=v[P];W.ref.impl=W.nextImpl}break;case 11:case 15:break;case 1:if((v&1024)!==0&&E!==null){v=void 0,P=g,W=E.memoizedProps,E=E.memoizedState;var ne=P.stateNode;try{var De=_d(P.type,W);v=ne.getSnapshotBeforeUpdate(De,E),ne.__reactInternalSnapshotBeforeUpdate=v}catch(at){cr(P,P.return,at)}}break;case 3:(v&1024)!==0&&Qr&&bb(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,Ks=v;break}Ks=g.return}}function Jw(g,v,E){var P=E.flags;switch(E.tag){case 0:case 11:case 15:Oa(g,E),P&4&&ci(5,E);break;case 1:if(Oa(g,E),P&4)if(g=E.stateNode,v===null)try{g.componentDidMount()}catch(De){cr(E,E.return,De)}else{var W=_d(E.type,v.memoizedProps);v=v.memoizedState;try{g.componentDidUpdate(W,v,g.__reactInternalSnapshotBeforeUpdate)}catch(De){cr(E,E.return,De)}}P&64&&Ls(E),P&512&&jo(E,E.return);break;case 3:if(Oa(g,E),P&64&&(P=E.updateQueue,P!==null)){if(g=null,E.child!==null)switch(E.child.tag){case 27:case 5:g=Jp(E.child.stateNode);break;case 1:g=E.child.stateNode}try{vn(P,g)}catch(De){cr(E,E.return,De)}}break;case 27:To&&v===null&&P&4&&Fo(E);case 26:case 5:if(Oa(g,E),v===null){if(P&4)$s(E);else if(P&64){g=E.type,v=E.memoizedProps,W=E.stateNode;try{O3(W,g,v,E)}catch(De){cr(E,E.return,De)}}}P&512&&jo(E,E.return);break;case 12:Oa(g,E);break;case 31:Oa(g,E),P&4&&lc(g,E);break;case 13:Oa(g,E),P&4&&$m(g,E),P&64&&(P=E.memoizedState,P!==null&&(P=P.dehydrated,P!==null&&(E=SE.bind(null,E),hv(P,E))));break;case 22:if(P=E.memoizedState!==null||Fs,!P){v=v!==null&&v.memoizedState!==null||Us,W=Fs;var ne=Us;Fs=P,(Us=v)&&!ne?uc(g,E,(E.subtreeFlags&8772)!==0):Oa(g,E),Fs=W,Us=ne}break;case 30:break;default:Oa(g,E)}}function Jy(g){var v=g.alternate;v!==null&&(g.alternate=null,Jy(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&av(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 ac(g,v,E){for(E=E.child;E!==null;)Wm(g,v,E),E=E.sibling}function Wm(g,v,E){if(al&&typeof al.onCommitFiberUnmount=="function")try{al.onCommitFiberUnmount(Hh,E)}catch{}switch(E.tag){case 26:if(pc){Us||Wi(E,v),ac(g,v,E),E.memoizedState?Mf(E.memoizedState):E.stateNode&&Ob(E.stateNode);break}case 27:if(To){Us||Wi(E,v);var P=Es,W=Zs;Fh(E.type)&&(Es=E.stateNode,Zs=!1),ac(g,v,E),Ho(E.stateNode),Es=P,Zs=W;break}case 5:Us||Wi(E,v);case 6:if(Qr){if(P=Es,W=Zs,Es=null,ac(g,v,E),Es=P,Zs=W,Es!==null)if(Zs)try{vb(Es,E.stateNode)}catch(ne){cr(E,v,ne)}else try{m3(Es,E.stateNode)}catch(ne){cr(E,v,ne)}}else ac(g,v,E);break;case 18:Qr&&Es!==null&&(Zs?pv(Es,E.stateNode):kb(Es,E.stateNode));break;case 4:Qr?(P=Es,W=Zs,Es=E.stateNode.containerInfo,Zs=!0,ac(g,v,E),Es=P,Zs=W):(Rl&&Wc(E.stateNode,E,_b()),ac(g,v,E));break;case 0:case 11:case 14:case 15:os(2,E,v),Us||os(4,E,v),ac(g,v,E);break;case 1:Us||(Wi(E,v),P=E.stateNode,typeof P.componentWillUnmount=="function"&&ra(E,v,P)),ac(g,v,E);break;case 21:ac(g,v,E);break;case 22:Us=(P=Us)||E.memoizedState!==null,ac(g,v,E),Us=P;break;default:ac(g,v,E)}}function lc(g,v){if(ls&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null))){g=g.dehydrated;try{CE(g)}catch(E){cr(v,v.return,E)}}}function $m(g,v){if(ls&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null&&(g=g.dehydrated,g!==null))))try{EE(g)}catch(E){cr(v,v.return,E)}}function cc(g){switch(g.tag){case 31:case 13:case 19:var v=g.stateNode;return v===null&&(v=g.stateNode=new Wb),v;case 22:return g=g.stateNode,v=g._retryCache,v===null&&(v=g._retryCache=new Wb),v;default:throw Error(i(435,g.tag))}}function Cd(g,v){var E=cc(g);v.forEach(function(P){if(!E.has(P)){E.add(P);var W=wE.bind(null,g,P);P.then(W,W)}})}function Uo(g,v){var E=v.deletions;if(E!==null)for(var P=0;P<E.length;P++){var W=E[P],ne=g,De=v;if(Qr){var at=De;e:for(;at!==null;){switch(at.tag){case 27:if(To){if(Fh(at.type)){Es=at.stateNode,Zs=!1;break e}break}case 5:Es=at.stateNode,Zs=!1;break e;case 3:case 4:Es=at.stateNode.containerInfo,Zs=!0;break e}at=at.return}if(Es===null)throw Error(i(160));Wm(ne,De,W),Es=null,Zs=!1}else Wm(ne,De,W);ne=W.alternate,ne!==null&&(ne.return=null),W.return=null}if(v.subtreeFlags&13886)for(v=v.child;v!==null;)qm(v,g),v=v.sibling}function qm(g,v){var E=g.alternate,P=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:Uo(v,g),Bo(g),P&4&&(os(3,g,g.return),ci(3,g),os(5,g,g.return));break;case 1:Uo(v,g),Bo(g),P&512&&(Us||E===null||Wi(E,E.return)),P&64&&Fs&&(g=g.updateQueue,g!==null&&(P=g.callbacks,P!==null&&(E=g.shared.hiddenCallbacks,g.shared.hiddenCallbacks=E===null?P:E.concat(P))));break;case 26:if(pc){var W=Ni;if(Uo(v,g),Bo(g),P&512&&(Us||E===null||Wi(E,E.return)),P&4){P=E!==null?E.memoizedState:null;var ne=g.memoizedState;E===null?ne===null?g.stateNode===null?g.stateNode=B3(W,g.type,g.memoizedProps,g):Ib(W,g.type,g.stateNode):g.stateNode=Db(W,ne,g.memoizedProps):P!==ne?(P===null?E.stateNode!==null&&Ob(E.stateNode):Mf(P),ne===null?Ib(W,g.type,g.stateNode):Db(W,ne,g.memoizedProps)):ne===null&&g.stateNode!==null&&zo(g,g.memoizedProps,E.memoizedProps)}break}case 27:if(To){Uo(v,g),Bo(g),P&512&&(Us||E===null||Wi(E,E.return)),E!==null&&P&4&&zo(g,g.memoizedProps,E.memoizedProps);break}case 5:if(Uo(v,g),Bo(g),P&512&&(Us||E===null||Wi(E,E.return)),Qr){if(g.flags&32){W=g.stateNode;try{yb(W)}catch(on){cr(g,g.return,on)}}P&4&&g.stateNode!=null&&(W=g.memoizedProps,zo(g,W,E!==null?E.memoizedProps:W)),P&1024&&(o0=!0)}else Rl&&g.alternate!==null&&(g.alternate.stateNode=g.stateNode);break;case 6:if(Uo(v,g),Bo(g),P&4&&Qr){if(g.stateNode===null)throw Error(i(162));P=g.memoizedProps,E=E!==null?E.memoizedProps:P,W=g.stateNode;try{u3(W,E,P)}catch(on){cr(g,g.return,on)}}break;case 3:if(pc?(H3(),W=Ni,Ni=sg(v.containerInfo),Uo(v,g),Ni=W):Uo(v,g),Bo(g),P&4){if(Qr&&ls&&E!==null&&E.memoizedState.isDehydrated)try{L3(v.containerInfo)}catch(on){cr(g,g.return,on)}if(Rl){P=v.containerInfo,E=v.pendingChildren;try{wb(P,E)}catch(on){cr(g,g.return,on)}}}o0&&(o0=!1,Wx(g));break;case 4:pc?(E=Ni,Ni=sg(g.stateNode.containerInfo),Uo(v,g),Bo(g),Ni=E):(Uo(v,g),Bo(g)),P&4&&Rl&&Wc(g.stateNode,g,g.stateNode.pendingChildren);break;case 12:Uo(v,g),Bo(g);break;case 31:Uo(v,g),Bo(g),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Cd(g,P)));break;case 13:Uo(v,g),Bo(g),g.child.flags&8192&&g.memoizedState!==null!=(E!==null&&E.memoizedState!==null)&&(mg=_a()),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Cd(g,P)));break;case 22:W=g.memoizedState!==null;var De=E!==null&&E.memoizedState!==null,at=Fs,zt=Us;if(Fs=at||W,Us=zt||De,Uo(v,g),Us=zt,Fs=at,Bo(g),P&8192&&(v=g.stateNode,v._visibility=W?v._visibility&-2:v._visibility|1,W&&(E===null||De||Fs||Us||df(g)),Qr)){e:if(E=null,Qr)for(v=g;;){if(v.tag===5||pc&&v.tag===26){if(E===null){De=E=v;try{ne=De.stateNode,W?ME(ne):x3(De.stateNode,De.memoizedProps)}catch(on){cr(De,De.return,on)}}}else if(v.tag===6){if(E===null){De=v;try{var nn=De.stateNode;W?g3(nn):v3(nn,De.memoizedProps)}catch(on){cr(De,De.return,on)}}}else if(v.tag===18){if(E===null){De=v;try{var xn=De.stateNode;W?z3(xn):F3(De.stateNode)}catch(on){cr(De,De.return,on)}}}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}}P&4&&(P=g.updateQueue,P!==null&&(E=P.retryQueue,E!==null&&(P.retryQueue=null,Cd(g,E))));break;case 19:Uo(v,g),Bo(g),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Cd(g,P)));break;case 30:break;case 21:break;default:Uo(v,g),Bo(g)}}function Bo(g){var v=g.flags;if(v&2){try{for(var E,P=g.return;P!==null;){if(Ia(P)){E=P;break}P=P.return}if(Qr){if(E==null)throw Error(i(160));switch(E.tag){case 27:if(To){var W=E.stateNode,ne=uo(g);wo(g,ne,W);break}case 5:var De=E.stateNode;E.flags&32&&(yb(De),E.flags&=-33);var at=uo(g);wo(g,at,De);break;case 3:case 4:var zt=E.stateNode.containerInfo,nn=uo(g);fo(g,nn,zt);break;default:throw Error(i(161))}}}catch(xn){cr(g,g.return,xn)}g.flags&=-3}v&4096&&(g.flags&=-4097)}function Wx(g){if(g.subtreeFlags&1024)for(g=g.child;g!==null;){var v=g;Wx(v),v.tag===5&&v.flags&1024&&fb(v.stateNode),g=g.sibling}}function Oa(g,v){if(v.subtreeFlags&8772)for(v=v.child;v!==null;)Jw(g,v.alternate,v),v=v.sibling}function df(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),df(v);break;case 1:Wi(v,v.return);var E=v.stateNode;typeof E.componentWillUnmount=="function"&&ra(v,v.return,E),df(v);break;case 27:To&&Ho(v.stateNode);case 26:case 5:Wi(v,v.return),df(v);break;case 22:v.memoizedState===null&&df(v);break;case 30:df(v);break;default:df(v)}g=g.sibling}}function uc(g,v,E){for(E=E&&(v.subtreeFlags&8772)!==0,v=v.child;v!==null;){var P=v.alternate,W=g,ne=v,De=ne.flags;switch(ne.tag){case 0:case 11:case 15:uc(W,ne,E),ci(4,ne);break;case 1:if(uc(W,ne,E),P=ne,W=P.stateNode,typeof W.componentDidMount=="function")try{W.componentDidMount()}catch(nn){cr(P,P.return,nn)}if(P=ne,W=P.updateQueue,W!==null){var at=P.stateNode;try{var zt=W.shared.hiddenCallbacks;if(zt!==null)for(W.shared.hiddenCallbacks=null,W=0;W<zt.length;W++)Jt(zt[W],at)}catch(nn){cr(P,P.return,nn)}}E&&De&64&&Ls(ne),jo(ne,ne.return);break;case 27:To&&Fo(ne);case 26:case 5:uc(W,ne,E),E&&P===null&&De&4&&$s(ne),jo(ne,ne.return);break;case 12:uc(W,ne,E);break;case 31:uc(W,ne,E),E&&De&4&&lc(W,ne);break;case 13:uc(W,ne,E),E&&De&4&&$m(W,ne);break;case 22:ne.memoizedState===null&&uc(W,ne,E),jo(ne,ne.return);break;case 30:break;default:uc(W,ne,E)}v=v.sibling}}function ff(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&&we(E))}function eb(g,v){g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&we(g))}function ws(g,v,E,P){if(v.subtreeFlags&10256)for(v=v.child;v!==null;)$x(g,v,E,P),v=v.sibling}function $x(g,v,E,P){var W=v.flags;switch(v.tag){case 0:case 11:case 15:ws(g,v,E,P),W&2048&&ci(9,v);break;case 1:ws(g,v,E,P);break;case 3:ws(g,v,E,P),W&2048&&(g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&we(g)));break;case 12:if(W&2048){ws(g,v,E,P),g=v.stateNode;try{var ne=v.memoizedProps,De=ne.id,at=ne.onPostCommit;typeof at=="function"&&at(De,v.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(zt){cr(v,v.return,zt)}}else ws(g,v,E,P);break;case 31:ws(g,v,E,P);break;case 13:ws(g,v,E,P);break;case 23:break;case 22:ne=v.stateNode,De=v.alternate,v.memoizedState!==null?ne._visibility&2?ws(g,v,E,P):Vp(g,v):ne._visibility&2?ws(g,v,E,P):(ne._visibility|=2,tl(g,v,E,P,(v.subtreeFlags&10256)!==0||!1)),W&2048&&ff(De,v);break;case 24:ws(g,v,E,P),W&2048&&eb(v.alternate,v);break;default:ws(g,v,E,P)}}function tl(g,v,E,P,W){for(W=W&&((v.subtreeFlags&10256)!==0||!1),v=v.child;v!==null;){var ne=g,De=v,at=E,zt=P,nn=De.flags;switch(De.tag){case 0:case 11:case 15:tl(ne,De,at,zt,W),ci(8,De);break;case 23:break;case 22:var xn=De.stateNode;De.memoizedState!==null?xn._visibility&2?tl(ne,De,at,zt,W):Vp(ne,De):(xn._visibility|=2,tl(ne,De,at,zt,W)),W&&nn&2048&&ff(De.alternate,De);break;case 24:tl(ne,De,at,zt,W),W&&nn&2048&&eb(De.alternate,De);break;default:tl(ne,De,at,zt,W)}v=v.sibling}}function Vp(g,v){if(v.subtreeFlags&10256)for(v=v.child;v!==null;){var E=g,P=v,W=P.flags;switch(P.tag){case 22:Vp(E,P),W&2048&&ff(P.alternate,P);break;case 24:Vp(E,P),W&2048&&eb(P.alternate,P);break;default:Vp(E,P)}v=v.sibling}}function Cu(g,v,E){if(g.subtreeFlags&Ol)for(g=g.child;g!==null;)hf(g,v,E),g=g.sibling}function hf(g,v,E){switch(g.tag){case 26:if(Cu(g,v,E),g.flags&Ol)if(g.memoizedState!==null)V3(E,Ni,g.memoizedState,g.memoizedProps);else{var P=g.stateNode,W=g.type;g=g.memoizedProps,((v&335544128)===v||ub(W,g))&&lv(E,P,W,g)}break;case 5:Cu(g,v,E),g.flags&Ol&&(P=g.stateNode,W=g.type,g=g.memoizedProps,((v&335544128)===v||ub(W,g))&&lv(E,P,W,g));break;case 3:case 4:pc?(P=Ni,Ni=sg(g.stateNode.containerInfo),Cu(g,v,E),Ni=P):Cu(g,v,E);break;case 22:g.memoizedState===null&&(P=g.alternate,P!==null&&P.memoizedState!==null?(P=Ol,Ol=16777216,Cu(g,v,E),Ol=P):Cu(g,v,E));break;default:Cu(g,v,E)}}function qx(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 Gp(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var P=v[E];Ks=P,Al(P,g)}qx(g)}if(g.subtreeFlags&10256)for(g=g.child;g!==null;)Xx(g),g=g.sibling}function Xx(g){switch(g.tag){case 0:case 11:case 15:Gp(g),g.flags&2048&&os(9,g,g.return);break;case 3:Gp(g);break;case 12:Gp(g);break;case 22:var v=g.stateNode;g.memoizedState!==null&&v._visibility&2&&(g.return===null||g.return.tag!==13)?(v._visibility&=-3,Xm(g)):Gp(g);break;default:Gp(g)}}function Xm(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var P=v[E];Ks=P,Al(P,g)}qx(g)}for(g=g.child;g!==null;){switch(v=g,v.tag){case 0:case 11:case 15:os(8,v,v.return),Xm(v);break;case 22:E=v.stateNode,E._visibility&2&&(E._visibility&=-3,Xm(v));break;default:Xm(v)}g=g.sibling}}function Al(g,v){for(;Ks!==null;){var E=Ks;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 P=E.memoizedState.cachePool.pool;P!=null&&P.refCount++}break;case 24:we(E.memoizedState.cache)}if(P=E.child,P!==null)P.return=E,Ks=P;else e:for(E=g;Ks!==null;){P=Ks;var W=P.sibling,ne=P.return;if(Jy(P),P===E){Ks=null;break e}if(W!==null){W.return=ne,Ks=W;break e}Ks=ne}}}function pf(g){var v=wr(g);if(v!=null){if(typeof v.memoizedProps["data-testname"]!="string")throw Error(i(364));return v}if(g=Xs(g),g===null)throw Error(i(362));return g.stateNode.current}function mf(g,v){var E=g.tag;switch(v.$$typeof){case Sc:if(g.type===v.value)return!0;break;case l0:e:{for(v=v.value,g=[g,0],E=0;E<g.length;){var P=g[E++],W=P.tag,ne=g[E++],De=v[ne];if(W!==5&&W!==26&&W!==27||!Sf(P)){for(;De!=null&&mf(P,De);)ne++,De=v[ne];if(ne===v.length){v=!0;break e}else for(P=P.child;P!==null;)g.push(P,ne),P=P.sibling}}v=!1}return v;case c0:if((E===5||E===26||E===27)&&mb(g.stateNode,v.value))return!0;break;case kf:if((E===5||E===6||E===26||E===27)&&(g=rg(g),g!==null&&0<=g.indexOf(v.value)))return!0;break;case hg: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 Wp(g){switch(g.$$typeof){case Sc:return"<"+(p(g.value)||"Unknown")+">";case l0:return":has("+(Wp(g)||"")+")";case c0:return'[role="'+g.value+'"]';case kf:return'"'+g.value+'"';case hg:return'[data-testname="'+g.value+'"]';default:throw Error(i(365))}}function $p(g,v){var E=[];g=[g,0];for(var P=0;P<g.length;){var W=g[P++],ne=W.tag,De=g[P++],at=v[De];if(ne!==5&&ne!==26&&ne!==27||!Sf(W)){for(;at!=null&&mf(W,at);)De++,at=v[De];if(De===v.length)E.push(W);else for(W=W.child;W!==null;)g.push(W,De),W=W.sibling}}return E}function nl(g,v){if(!Mo)throw Error(i(363));g=pf(g),g=$p(g,v),v=[],g=Array.from(g);for(var E=0;E<g.length;){var P=g[E++],W=P.tag;if(W===5||W===26||W===27)Sf(P)||v.push(P.stateNode);else for(P=P.child;P!==null;)g.push(P),P=P.sibling}return v}function as(){return(Br&2)!==0&&Xr!==0?Xr&-Xr:Yn.T!==null?Xe():t0()}function Ed(){if(Ba===0)if((Xr&536870912)===0||qr){var g=Bh;Bh<<=1,(Bh&3932160)===0&&(Bh=262144),Ba=g}else Ba=536870912;return g=ll.current,g!==null&&(g.flags|=32),Ba}function Ms(g,v,E){(g===Ir&&(ki===2||ki===9)||g.cancelPendingCommit!==null)&&(js(g,0),Au(g,Xr,Ba,!1)),R(g,E),((Br&2)===0||g!==Ir)&&(g===Ir&&((Br&2)===0&&(Df|=E),As===4&&Au(g,Xr,Ba,!1)),Re(g))}function $c(g,v,E){if((Br&6)!==0)throw Error(i(327));var P=!E&&(v&127)===0&&(v&g.expiredLanes)===0||C(g,v),W=P?n3(g,v):Nu(g,v,!0),ne=P;do{if(W===0){Rf&&!P&&Au(g,v,0,!1);break}else{if(E=g.current.alternate,ne&&!e3(E)){W=Nu(g,v,!1),ne=!1;continue}if(W===2){if(ne=v,g.errorRecoveryDisabledLanes&ne)var De=0;else De=g.pendingLanes&-536870913,De=De!==0?De:De&536870912?536870912:0;if(De!==0){v=De;e:{var at=g;W=pg;var zt=ls&&at.current.memoizedState.isDehydrated;if(zt&&(js(at,De).flags|=256),De=Nu(at,De,!1),De!==2){if(Pf&&!zt){at.errorRecoveryDisabledLanes|=ne,Df|=ne,W=4;break e}ne=ul,ul=W,ne!==null&&(ul===null?ul=ne:ul.push.apply(ul,ne))}W=De}if(ne=!1,W!==2)continue}}if(W===1){js(g,0),Au(g,v,0,!0);break}e:{switch(P=g,ne=W,ne){case 0:case 1:throw Error(i(345));case 4:if((v&4194048)!==v)break;case 6:Au(P,v,Ba,!Kc);break e;case 2:ul=null;break;case 3:case 5:break;default:throw Error(i(329))}if((v&62914560)===v&&(W=mg+300-_a(),10<W)){if(Au(P,v,Ba,!Kc),M(P,0,!0)!==0)break e;Vu=v,P.timeoutHandle=cb(Eu.bind(null,P,E,ul,gg,kv,v,Ba,Df,d0,Kc,ne,"Throttled",-0,0),W);break e}Eu(P,E,ul,gg,kv,v,Ba,Df,d0,Kc,ne,null,-0,0)}}break}while(!0);Re(g)}function Eu(g,v,E,P,W,ne,De,at,zt,nn,xn,on,kn,vr){if(g.timeoutHandle=sl,on=v.subtreeFlags,on&8192||(on&16785408)===16785408){on=db(),hf(v,ne,on);var Qs=(ne&62914560)===ne?mg-_a():(ne&4194048)===ne?Xh-_a():0;if(Qs=c3(on,Qs),Qs!==null){Vu=ne,g.cancelPendingCommit=Qs(Ru.bind(null,g,v,ne,E,P,W,De,at,zt,xn,on,null,kn,vr)),Au(g,ne,De,!nn);return}}Ru(g,v,ne,E,P,W,De,at,zt)}function e3(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 P=0;P<E.length;P++){var W=E[P],ne=W.getSnapshot;W=W.value;try{if(!Ys(ne(),W))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 Au(g,v,E,P){v&=~u0,v&=~Df,g.suspendedLanes|=v,g.pingedLanes&=~v,P&&(g.warmLanes|=v),P=g.expirationTimes;for(var W=v;0<W;){var ne=31-ol(W),De=1<<ne;P[ne]=-1,W&=~De}E!==0&&k(g,E,v)}function Yx(){return(Br&6)===0?(Ae(0),!1):!0}function Kx(){if(Hr!==null){if(ki===0)var g=Hr.return;else g=Hr,Xc=Yi=null,Xn(g),Ef=null,Vh=0,g=Hr;for(;g!==null;)xi(g.alternate,g),g=g.return;Hr=null}}function js(g,v){var E=g.timeoutHandle;E!==sl&&(g.timeoutHandle=sl,l3(E)),E=g.cancelPendingCommit,E!==null&&(g.cancelPendingCommit=null,E()),Vu=0,Kx(),Ir=g,Hr=E=kl(g.current,null),Xr=v,ki=0,mo=null,Kc=!1,Rf=C(g,v),Pf=!1,d0=Ba=u0=Df=Fd=As=0,ul=pg=null,kv=!1,(v&8)!==0&&(v|=v&32);var P=g.entangledLanes;if(P!==0)for(g=g.entanglements,P&=v;0<P;){var W=31-ol(P),ne=1<<W;v|=g[W],P&=~ne}return Hu=v,Ht(),E}function Xi(g,v){Mr=null,Yn.H=Il,v===Ao||v===bc?(v=Ue(),ki=3):v===Av?(v=Ue(),ki=4):ki=v===Ua?8:v!==null&&typeof v=="object"&&typeof v.then=="function"?6:1,mo=v,Hr===null&&(As=1,ic(g,re(v,g.current)))}function Zr(){var g=ll.current;return g===null?!0:(Xr&4194048)===Xr?cl===null:(Xr&62914560)===Xr||(Xr&536870912)!==0?g===cl:!1}function Ad(){var g=Yn.H;return Yn.H=Il,g===null?Il:g}function Nl(){var g=Yn.A;return Yn.A=a0,g}function qp(){As=4,Kc||(Xr&4194048)!==Xr&&ll.current!==null||(Rf=!0),(Fd&134217727)===0&&(Df&134217727)===0||Ir===null||Au(Ir,Xr,Ba,!1)}function Nu(g,v,E){var P=Br;Br|=2;var W=Ad(),ne=Nl();(Ir!==g||Xr!==v)&&(gg=null,js(g,v)),v=!1;var De=As;e:do try{if(ki!==0&&Hr!==null){var at=Hr,zt=mo;switch(ki){case 8:Kx(),De=6;break e;case 3:case 2:case 9:case 6:ll.current===null&&(v=!0);var nn=ki;if(ki=0,mo=null,ku(g,at,zt,nn),E&&Rf){De=0;break e}break;default:nn=ki,ki=0,mo=null,ku(g,at,zt,nn)}}t3(),De=As;break}catch(xn){Xi(g,xn)}while(!0);return v&&g.shellSuspendCounter++,Xc=Yi=null,Br=P,Yn.H=W,Yn.A=ne,Hr===null&&(Ir=null,Xr=0,Ht()),De}function t3(){for(;Hr!==null;)gf(Hr)}function n3(g,v){var E=Br;Br|=2;var P=Ad(),W=Nl();Ir!==g||Xr!==v?(gg=null,If=_a()+500,js(g,v)):Rf=C(g,v);e:do try{if(ki!==0&&Hr!==null){v=Hr;var ne=mo;t:switch(ki){case 1:ki=0,mo=null,ku(g,v,ne,1);break;case 2:case 9:if(Ee(ne)){ki=0,mo=null,Zx(v);break}v=function(){ki!==2&&ki!==9||Ir!==g||(ki=7),Re(g)},ne.then(v,v);break e;case 3:ki=7;break e;case 4:ki=5;break e;case 7:Ee(ne)?(ki=0,mo=null,Zx(v)):(ki=0,mo=null,ku(g,v,ne,7));break;case 5:var De=null;switch(Hr.tag){case 26:De=Hr.memoizedState;case 5:case 27:var at=Hr,zt=at.type,nn=at.pendingProps;if(De?jb(De):Ts(at.stateNode,zt,nn)){ki=0,mo=null;var xn=at.sibling;if(xn!==null)Hr=xn;else{var on=at.return;on!==null?(Hr=on,Yp(on)):Hr=null}break t}}ki=0,mo=null,ku(g,v,ne,5);break;case 6:ki=0,mo=null,ku(g,v,ne,6);break;case 8:Kx(),As=6;break e;default:throw Error(i(462))}}Xp();break}catch(kn){Xi(g,kn)}while(!0);return Xc=Yi=null,Yn.H=P,Yn.A=W,Br=E,Hr!==null?0:(Ir=null,Xr=0,Ht(),As)}function Xp(){for(;Hr!==null&&!W3();)gf(Hr)}function gf(g){var v=$t(g.alternate,g,Hu);g.memoizedProps=g.pendingProps,v===null?Yp(g):Hr=v}function Zx(g){var v=g,E=v.alternate;switch(v.tag){case 15:case 0:v=Is(E,v,v.pendingProps,v.type,void 0,Xr);break;case 11:v=Is(E,v,v.pendingProps,v.type.render,v.ref,Xr);break;case 5:Xn(v);default:xi(E,v),v=Hr=ev(v,Hu),v=$t(E,v,Hu)}g.memoizedProps=g.pendingProps,v===null?Yp(g):Hr=v}function ku(g,v,E,P){Xc=Yi=null,Xn(v),Ef=null,Vh=0;var W=v.return;try{if(Fm(g,W,v,E,Xr)){As=1,ic(g,re(E,g.current)),Hr=null;return}}catch(ne){if(W!==null)throw Hr=W,ne;As=1,ic(g,re(E,g.current)),Hr=null;return}v.flags&32768?(qr||P===1?g=!0:Rf||(Xr&536870912)!==0?g=!1:(Kc=g=!0,(P===2||P===9||P===3||P===6)&&(P=ll.current,P!==null&&P.tag===13&&(P.flags|=16384))),xf(v,g)):Yp(v)}function Yp(g){var v=g;do{if((v.flags&32768)!==0){xf(v,Kc);return}g=v.return;var E=Ji(v.alternate,v,Hu);if(E!==null){Hr=E;return}if(v=v.sibling,v!==null){Hr=v;return}Hr=v=g}while(v!==null);As===0&&(As=5)}function xf(g,v){do{var E=Os(g.alternate,g);if(E!==null){E.flags&=32767,Hr=E;return}if(E=g.return,E!==null&&(E.flags|=32768,E.subtreeFlags=0,E.deletions=null),!v&&(g=g.sibling,g!==null)){Hr=g;return}Hr=g=E}while(g!==null);As=6,Hr=null}function Ru(g,v,E,P,W,ne,De,at,zt){g.cancelPendingCommit=null;do Du();while(go!==0);if((Br&6)!==0)throw Error(i(327));if(v!==null){if(v===g.current)throw Error(i(177));if(ne=v.lanes|v.childLanes,ne|=Gh,L(g,E,ne,De,at,zt),g===Ir&&(Hr=Ir=null,Xr=0),Yh=v,Bd=g,Vu=E,f0=ne,Rv=W,$b=P,(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?(g.callbackNode=null,g.callbackPriority=0,ho(ag,function(){return Ym(),null})):(g.callbackNode=null,g.callbackPriority=0),P=(v.flags&13878)!==0,(v.subtreeFlags&13878)!==0||P){P=Yn.T,Yn.T=null,W=hc(),$r(2),De=Br,Br|=4;try{Gx(g,v,E)}finally{Br=De,$r(W),Yn.T=P}}go=1,Nd(),Pu(),Qx()}}function Nd(){if(go===1){go=0;var g=Bd,v=Yh,E=(v.flags&13878)!==0;if((v.subtreeFlags&13878)!==0||E){E=Yn.T,Yn.T=null;var P=hc();$r(2);var W=Br;Br|=4;try{qm(v,g),a3(g.containerInfo)}finally{Br=W,$r(P),Yn.T=E}}g.current=v,go=2}}function Pu(){if(go===2){go=0;var g=Bd,v=Yh,E=(v.flags&8772)!==0;if((v.subtreeFlags&8772)!==0||E){E=Yn.T,Yn.T=null;var P=hc();$r(2);var W=Br;Br|=4;try{Jw(g,v.alternate,v)}finally{Br=W,$r(P),Yn.T=E}}go=3}}function Qx(){if(go===4||go===3){go=0,Fb();var g=Bd,v=Yh,E=Vu,P=$b;(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?go=5:(go=0,Yh=Bd=null,Jx(g,g.pendingLanes));var W=g.pendingLanes;if(W===0&&(Ud=null),Y(E),v=v.stateNode,al&&typeof al.onCommitFiberRoot=="function")try{al.onCommitFiberRoot(Hh,v,void 0,(v.current.flags&128)===128)}catch{}if(P!==null){v=Yn.T,W=hc(),$r(2),Yn.T=null;try{for(var ne=g.onRecoverableError,De=0;De<P.length;De++){var at=P[De];ne(at.value,{componentStack:at.stack})}}finally{Yn.T=v,$r(W)}}(Vu&3)!==0&&Du(),Re(g),W=g.pendingLanes,(E&261930)!==0&&(W&42)!==0?g===xg?ui++:(ui=0,xg=g):ui=0,ls&&ig(),Ae(0)}}function Jx(g,v){(g.pooledCacheLanes&=v)===0&&(v=g.pooledCache,v!=null&&(g.pooledCache=null,we(v)))}function Du(){return Nd(),Pu(),Qx(),Ym()}function Ym(){if(go!==5)return!1;var g=Bd,v=f0;f0=0;var E=Y(Vu),P=32>E?32:E;E=Yn.T;var W=hc();try{$r(P),Yn.T=null,P=Rv,Rv=null;var ne=Bd,De=Vu;if(go=0,Yh=Bd=null,Vu=0,(Br&6)!==0)throw Error(i(331));var at=Br;if(Br|=4,Xx(ne.current),$x(ne,ne.current,De,P),Br=at,Ae(0,!1),al&&typeof al.onPostCommitFiberRoot=="function")try{al.onPostCommitFiberRoot(Hh,ne)}catch{}return!0}finally{$r(W),Yn.T=E,Jx(g,v)}}function vf(g,v,E){v=re(E,v),v=Sd(g.stateNode,v,2),g=Ot(g,v,2),g!==null&&(R(g,2),Re(g))}function cr(g,v,E){if(g.tag===3)vf(g,g,E);else for(;v!==null;){if(v.tag===3){vf(v,g,E);break}else if(v.tag===1){var P=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof P.componentDidCatch=="function"&&(Ud===null||!Ud.has(P))){g=re(E,g),E=zm(2),P=Ot(v,E,2),P!==null&&(zp(E,P,v,g),R(P,2),Re(P));break}}v=v.return}}function Kp(g,v,E){var P=g.pingCache;if(P===null){P=g.pingCache=new Ll;var W=new Set;P.set(v,W)}else W=P.get(v),W===void 0&&(W=new Set,P.set(v,W));W.has(E)||(Pf=!0,W.add(E),g=r3.bind(null,g,v,E),v.then(g,g))}function r3(g,v,E){var P=g.pingCache;P!==null&&P.delete(v),g.pingedLanes|=g.suspendedLanes&E,g.warmLanes&=~E,Ir===g&&(Xr&E)===E&&(As===4||As===3&&(Xr&62914560)===Xr&&300>_a()-mg?(Br&2)===0&&js(g,0):u0|=E,d0===Xr&&(d0=0)),Re(g)}function i3(g,v){v===0&&(v=N()),g=$e(g,v),g!==null&&(R(g,v),Re(g))}function SE(g){var v=g.memoizedState,E=0;v!==null&&(E=v.retryLane),i3(g,E)}function wE(g,v){var E=0;switch(g.tag){case 31:case 13:var P=g.stateNode,W=g.memoizedState;W!==null&&(E=W.retryLane);break;case 19:P=g.stateNode;break;case 22:P=g.stateNode._retryCache;break;default:throw Error(i(314))}P!==null&&P.delete(v),i3(g,E)}function ho(g,v){return og(g,v)}function tb(g,v,E,P){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=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nh(g){return g=g.prototype,!(!g||!g.isReactComponent)}function kl(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 ev(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 kd(g,v,E,P,W,ne){var De=0;if(P=g,typeof g=="function")Nh(g)&&(De=1);else if(typeof g=="string")De=pc&&To?mv(g,E,Vo.current)?26:zb(g)?27:5:pc?mv(g,E,Vo.current)?26:5:To&&zb(g)?27:5;else e:switch(g){case Jm:return g=n(31,E,v,W),g.elementType=Jm,g.lanes=ne,g;case Dh:return dc(E.children,W,ne,v);case Ih:De=8,W|=24;break;case Oh:return g=n(12,E,v,W|2),g.elementType=Oh,g.lanes=ne,g;case iv:return g=n(13,E,v,W),g.elementType=iv,g.lanes=ne,g;case Rd:return g=n(19,E,v,W),g.elementType=Rd,g.lanes=ne,g;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case fc:De=10;break e;case Qm:De=9;break e;case Zp:De=11;break e;case sv:De=14;break e;case La:De=16,P=null;break e}De=29,E=Error(i(130,g===null?"null":typeof g,"")),P=null}return v=n(De,E,v,W),v.elementType=g,v.type=P,v.lanes=ne,v}function dc(g,v,E,P){return g=n(7,g,P,v),g.lanes=E,g}function nb(g,v,E){return g=n(6,g,null,v),g.lanes=E,g}function rb(g){var v=n(18,null,null,0);return v.stateNode=g,v}function ib(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 s3(g,v,E,P,W,ne,De,at,zt){this.tag=1,this.containerInfo=g,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=sl,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=P,this.onUncaughtError=W,this.onCaughtError=ne,this.onRecoverableError=De,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=zt,this.incompleteTransitions=new Map}function yf(g,v,E,P,W,ne,De,at,zt,nn,xn,on){return g=new s3(g,v,E,De,zt,nn,xn,on,at),v=1,ne===!0&&(v|=24),ne=n(3,null,null,v),g.current=ne,ne.stateNode=g,v=be(),v.refCount++,g.pooledCache=v,v.refCount++,ne.memoizedState={element:P,isDehydrated:E,cache:v},Bt(ne),g}function tv(g){return g?(g=Ou,g):Ou}function Km(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:Jp(g.stateNode)}function sb(g,v,E,P,W,ne){W=tv(W),P.context===null?P.context=W:P.pendingContext=W,P=At(v),P.payload={element:E},ne=ne===void 0?null:ne,ne!==null&&(P.callback=ne),E=Ot(g,P,v),E!==null&&(Ms(E,g,v),cn(E,g,v))}function kh(g,v){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var E=g.retryLane;g.retryLane=E!==0&&E<v?E:v}}function Zm(g,v){kh(g,v),(g=g.alternate)&&kh(g,v)}var Pr={},nv=ni,rl=EEe,rv=Object.assign,Rh=Symbol.for("react.element"),Iu=Symbol.for("react.transitional.element"),Ph=Symbol.for("react.portal"),Dh=Symbol.for("react.fragment"),Ih=Symbol.for("react.strict_mode"),Oh=Symbol.for("react.profiler"),Qm=Symbol.for("react.consumer"),fc=Symbol.for("react.context"),Zp=Symbol.for("react.forward_ref"),iv=Symbol.for("react.suspense"),Rd=Symbol.for("react.suspense_list"),sv=Symbol.for("react.memo"),La=Symbol.for("react.lazy"),Jm=Symbol.for("react.activity"),ob=Symbol.for("react.memo_cache_sentinel"),Pd=Symbol.iterator,bf=Symbol.for("react.client.reference"),_f=Array.isArray,Yn=nv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ab=e.rendererVersion,eg=e.rendererPackageName,Qp=e.extraDevToolsConfig,Jp=e.getPublicInstance,o3=e.getRootHostContext,e0=e.getChildHostContext,ov=e.prepareForCommit,a3=e.resetAfterCommit,lb=e.createInstance;e.cloneMutableInstance;var tg=e.appendInitialChild,il=e.finalizeInitialChildren,ja=e.shouldSetTextContent,Dd=e.createTextInstance;e.cloneMutableTextInstance;var cb=e.scheduleTimeout,l3=e.cancelTimeout,sl=e.noTimeout,qs=e.isPrimaryRenderer;e.warnsIfNotActing;var Qr=e.supportsMutation,Rl=e.supportsPersistence,ls=e.supportsHydration,wr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Fi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var $r=e.setCurrentUpdatePriority,hc=e.getCurrentUpdatePriority,t0=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Lh=e.shouldAttemptEagerTransition,av=e.detachDeletedInstance;e.requestPostPaintCallback;var ng=e.maySuspendCommit,n0=e.maySuspendCommitOnUpdate,ub=e.maySuspendCommitInSyncRender,Ts=e.preloadInstance,db=e.startSuspendingCommit,lv=e.suspendInstance;e.suspendOnActiveViewTransition;var c3=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var jh=e.NotPendingTransition,zh=e.HostTransitionContext,fb=e.resetFormInstance;e.bindToConsole;var hb=e.supportsMicrotasks,pb=e.scheduleMicrotask,Mo=e.supportsTestSelectors,Xs=e.findFiberRoot,cv=e.getBoundingRect,rg=e.getTextContent,Sf=e.isHiddenSubtree,mb=e.matchAccessibilityRole,Id=e.setFocusIfFocusable,uv=e.setupIntersectionObserver,gb=e.appendChild,xb=e.appendChildToContainer,u3=e.commitTextUpdate,d3=e.commitMount,f3=e.commitUpdate,h3=e.insertBefore,p3=e.insertInContainerBefore,m3=e.removeChild,vb=e.removeChildFromContainer,yb=e.resetTextContent,ME=e.hideInstance,g3=e.hideTextInstance,x3=e.unhideInstance,v3=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 bb=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var y3=e.cloneInstance,_b=e.createContainerChildSet,Sb=e.appendChildToContainerChildSet,b3=e.finalizeContainerChildren,wb=e.replaceContainerChildren,_3=e.cloneHiddenInstance,Mb=e.cloneHiddenTextInstance,wf=e.isSuspenseInstancePending,dv=e.isSuspenseInstanceFallback,fv=e.getSuspenseInstanceFallbackErrorDetails,hv=e.registerSuspenseInstanceRetry,S3=e.canHydrateFormStateMarker,Tb=e.isFormStateMarkerMatching,w3=e.getNextHydratableSibling,M3=e.getNextHydratableSiblingAfterSingleton,T3=e.getFirstHydratableChild,C3=e.getFirstHydratableChildWithinContainer,E3=e.getFirstHydratableChildWithinActivityInstance,A3=e.getFirstHydratableChildWithinSuspenseInstance,Cb=e.getFirstHydratableChildWithinSingleton,N3=e.canHydrateInstance,k3=e.canHydrateTextInstance,Eb=e.canHydrateActivityInstance,R3=e.canHydrateSuspenseInstance,P3=e.hydrateInstance,TE=e.hydrateTextInstance,Ab=e.hydrateActivityInstance,D3=e.hydrateSuspenseInstance,I3=e.getNextHydratableInstanceAfterActivityInstance,Nb=e.getNextHydratableInstanceAfterSuspenseInstance,O3=e.commitHydratedInstance,L3=e.commitHydratedContainer,CE=e.commitHydratedActivityInstance,EE=e.commitHydratedSuspenseInstance,j3=e.finalizeHydratedChildren,ig=e.flushHydrationEvents;e.clearActivityBoundary;var kb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var pv=e.clearSuspenseBoundaryFromContainer,z3=e.hideDehydratedBoundary,F3=e.unhideDehydratedBoundary,r0=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var U3=e.validateHydratableInstance,Rb=e.validateHydratableTextInstance,pc=e.supportsResources,mv=e.isHostHoistableType,sg=e.getHoistableRoot,Pb=e.getResource,Db=e.acquireResource,Mf=e.releaseResource,B3=e.hydrateHoistable,Ib=e.mountHoistable,Ob=e.unmountHoistable,gv=e.createHoistableInstance,H3=e.prepareToCommitHoistables,Lb=e.mayResourceSuspendCommit,jb=e.preloadResource,V3=e.suspendResource,To=e.supportsSingletons,xv=e.resolveSingletonInstance,po=e.acquireSingletonInstance,Ho=e.releaseSingletonInstance,zb=e.isHostSingletonType,Fh=e.isSingletonScope,vv=[],Uh=-1,Ou={},ol=Math.clz32?Math.clz32:_,yv=Math.log,G3=Math.LN2,bv=256,Bh=262144,i0=4194304,og=rl.unstable_scheduleCallback,_v=rl.unstable_cancelCallback,W3=rl.unstable_shouldYield,Fb=rl.unstable_requestPaint,_a=rl.unstable_now,Sv=rl.unstable_ImmediatePriority,$3=rl.unstable_UserBlockingPriority,ag=rl.unstable_NormalPriority,wv=rl.unstable_IdlePriority,Ub=rl.log,q3=rl.unstable_setDisableYieldValue,Hh=null,al=null,Ys=typeof Object.is=="function"?Object.is:q,Mv=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)},AE=Object.prototype.hasOwnProperty,Tv,Lu,lg=!1,Bb=new WeakMap,Od=[],ju=0,Ui=null,cg=0,mc=[],Pl=0,gc=null,ia=1,qc="",Vo=m(null),Ld=m(null),sa=m(null),ug=m(null),Co=null,cs=null,qr=!1,zu=null,za=!1,Cv=Error(i(519)),xc=m(null),Yi=null,Xc=null,X3=typeof AbortController<"u"?AbortController:function(){var g=[],v=this.signal={aborted:!1,addEventListener:function(E,P){g.push(P)}};this.abort=function(){v.aborted=!0,g.forEach(function(E){return E()})}},Go=rl.unstable_scheduleCallback,NE=rl.unstable_NormalPriority,us={$$typeof:fc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},dg=null,Ai=null,Sa=!1,vc=!1,Ev=!1,Tf=0,s0=null,Hb=0,jd=0,Eo=null,yc=Yn.S;Yn.S=function(g,v){Xh=_a(),typeof v=="object"&&v!==null&&typeof v.then=="function"&&ht(g,v),yc!==null&&yc(g,v)};var Cf=m(null),Ao=Error(i(460)),Av=Error(i(474)),bc=Error(i(542)),Fu={then:function(){}},Fa=null,Ef=null,Vh=0,oa=St(!0),Vb=St(!1),aa=[],Uu=0,Gh=0,Dl=!1,Nv=!1,Wh=m(null),Af=m(0),ll=m(null),cl=null,zs=m(0),zd=0,Mr=null,Vn=null,pr=null,Dr=!1,Nr=!1,ei=!1,wa=0,_c=0,Yc=null,Gb=0,Il={readContext:ae,use:vs,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Il.useEffectEvent=Vt;var Cs={readContext:ae,use:vs,useCallback:function(g,v){return dr().memoizedState=[g,v===void 0?null:v],g},useContext:ae,useEffect:ii,useImperativeHandle:function(g,v,E){E=E!=null?E.concat([g]):null,el(4194308,4,Kr.bind(null,v,g),E)},useLayoutEffect:function(g,v){return el(4194308,4,g,v)},useInsertionEffect:function(g,v){el(4,2,g,v)},useMemo:function(g,v){var E=dr();v=v===void 0?null:v;var P=g();if(ei){V(!0);try{g()}finally{V(!1)}}return E.memoizedState=[P,v],P},useReducer:function(g,v,E){var P=dr();if(E!==void 0){var W=E(v);if(ei){V(!0);try{E(v)}finally{V(!1)}}}else W=v;return P.memoizedState=P.baseState=W,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:W},P.queue=g,g=g.dispatch=_s.bind(null,Mr,g),[P.memoizedState,g]},useRef:function(g){var v=dr();return g={current:g},v.memoizedState=g},useState:function(g){g=Ml(g);var v=g.queue,E=El.bind(null,Mr,v);return v.dispatch=E,[g.memoizedState,E]},useDebugValue:Cl,useDeferredValue:function(g,v){var E=dr();return gi(E,g,v)},useTransition:function(){var g=Ml(!1);return g=vd.bind(null,Mr,g.queue,!0,!1),dr().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,v,E){var P=Mr,W=dr();if(qr){if(E===void 0)throw Error(i(407));E=E()}else{if(E=v(),Ir===null)throw Error(i(349));(Xr&127)!==0||ji(P,v,E)}W.memoizedState=E;var ne={value:E,getSnapshot:v};return W.queue=ne,ii(va.bind(null,P,ne,g),[g]),P.flags|=2048,bs(9,{destroy:void 0},ea.bind(null,P,ne,E,v),null),E},useId:function(){var g=dr(),v=Ir.identifierPrefix;if(qr){var E=qc,P=ia;E=(P&~(1<<32-ol(P)-1)).toString(32)+E,v="_"+v+"R_"+E,E=wa++,0<E&&(v+="H"+E.toString(32)),v+="_"}else E=Gb++,v="_"+v+"r_"+E.toString(32)+"_";return g.memoizedState=v},useHostTransitionStatus:cf,useFormState:nc,useActionState:nc,useOptimistic:function(g){var v=dr();v.memoizedState=v.baseState=g;var E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return v.queue=E,v=Op.bind(null,Mr,!0,E),E.dispatch=v,[g,v]},useMemoCache:Rs,useCacheRefresh:function(){return dr().memoizedState=Gs.bind(null,Mr)},useEffectEvent:function(g){var v=dr(),E={impl:g};return v.memoizedState=E,function(){if((Br&2)!==0)throw Error(i(440));return E.impl.apply(void 0,arguments)}}},Bu={readContext:ae,use:vs,useCallback:rc,useContext:ae,useEffect:Wr,useImperativeHandle:Da,useInsertionEffect:Si,useLayoutEffect:zi,useMemo:_o,useReducer:ys,useRef:Ja,useState:function(){return ys(Li)},useDebugValue:Cl,useDeferredValue:function(g,v){var E=un();return Ch(E,Vn.memoizedState,g,v)},useTransition:function(){var g=ys(Li)[0],v=un().memoizedState;return[typeof g=="boolean"?g:Ln(g),v]},useSyncExternalStore:Ps,useId:ba,useHostTransitionStatus:cf,useFormState:ta,useActionState:ta,useOptimistic:function(g,v){var E=un();return ya(E,Vn,g,v)},useMemoCache:Rs,useCacheRefresh:qi};Bu.useEffectEvent=Sr;var Nf={readContext:ae,use:vs,useCallback:rc,useContext:ae,useEffect:Wr,useImperativeHandle:Da,useInsertionEffect:Si,useLayoutEffect:zi,useMemo:_o,useReducer:pi,useRef:Ja,useState:function(){return pi(Li)},useDebugValue:Cl,useDeferredValue:function(g,v){var E=un();return Vn===null?gi(E,g,v):Ch(E,Vn.memoizedState,g,v)},useTransition:function(){var g=pi(Li)[0],v=un().memoizedState;return[typeof g=="boolean"?g:Ln(g),v]},useSyncExternalStore:Ps,useId:ba,useHostTransitionStatus:cf,useFormState:Tl,useActionState:Tl,useOptimistic:function(g,v){var E=un();return Vn!==null?ya(E,Vn,g,v):(E.baseState=g,[g,E.queue.dispatch])},useMemoCache:Rs,useCacheRefresh:qi};Nf.useEffectEvent=Sr;var fg={enqueueSetState:function(g,v,E){g=g._reactInternals;var P=as(),W=At(P);W.payload=v,E!=null&&(W.callback=E),v=Ot(g,W,P),v!==null&&(Ms(v,g,P),cn(v,g,P))},enqueueReplaceState:function(g,v,E){g=g._reactInternals;var P=as(),W=At(P);W.tag=1,W.payload=v,E!=null&&(W.callback=E),v=Ot(g,W,P),v!==null&&(Ms(v,g,P),cn(v,g,P))},enqueueForceUpdate:function(g,v){g=g._reactInternals;var E=as(),P=At(E);P.tag=2,v!=null&&(P.callback=v),v=Ot(g,P,E),v!==null&&(Ms(v,g,E),cn(v,g,E))}},Ua=Error(i(461)),es=!1,$h={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Fs=!1,Us=!1,o0=!1,Wb=typeof WeakSet=="function"?WeakSet:Set,Ks=null,Es=null,Zs=!1,Ni=null,Ol=8192,a0={getCacheForType:function(g){var v=ae(us),E=v.data.get(g);return E===void 0&&(E=g(),v.data.set(g,E)),E},cacheSignal:function(){return ae(us).controller.signal}},Sc=0,l0=1,c0=2,hg=3,kf=4;if(typeof Symbol=="function"&&Symbol.for){var qh=Symbol.for;Sc=qh("selector.component"),l0=qh("selector.has_pseudo_class"),c0=qh("selector.role"),hg=qh("selector.test_id"),kf=qh("selector.text")}var Ll=typeof WeakMap=="function"?WeakMap:Map,Br=0,Ir=null,Hr=null,Xr=0,ki=0,mo=null,Kc=!1,Rf=!1,Pf=!1,Hu=0,As=0,Fd=0,Df=0,u0=0,Ba=0,d0=0,pg=null,ul=null,kv=!1,mg=0,Xh=0,If=1/0,gg=null,Ud=null,go=0,Bd=null,Yh=null,Vu=0,f0=0,Rv=null,$b=null,ui=0,xg=null;return Pr.attemptContinuousHydration=function(g){if(g.tag===13||g.tag===31){var v=$e(g,67108864);v!==null&&Ms(v,g,67108864),Zm(g,67108864)}},Pr.attemptHydrationAtCurrentPriority=function(g){if(g.tag===13||g.tag===31){var v=as();v=B(v);var E=$e(g,v);E!==null&&Ms(E,g,v),Zm(g,v)}},Pr.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-ol(v);g.entanglements[1]|=E,v&=~E}Re(g),(Br&6)===0&&(If=_a()+500,Ae(0))}}break;case 31:case 13:v=$e(g,2),v!==null&&Ms(v,g,2),Yx(),Zm(g,2)}},Pr.batchedUpdates=function(g,v){return g(v)},Pr.createComponentSelector=function(g){return{$$typeof:Sc,value:g}},Pr.createContainer=function(g,v,E,P,W,ne,De,at,zt,nn){return yf(g,v,!1,null,E,P,ne,null,De,at,zt,nn)},Pr.createHasPseudoClassSelector=function(g){return{$$typeof:l0,value:g}},Pr.createHydrationContainer=function(g,v,E,P,W,ne,De,at,zt,nn,xn,on,kn,vr){var Qs;return g=yf(E,P,!0,g,W,ne,at,vr,zt,nn,xn,on),g.context=tv(null),E=g.current,P=as(),P=B(P),W=At(P),W.callback=(Qs=v)!=null?Qs:null,Ot(E,W,P),v=P,g.current.lanes=v,R(g,v),Re(g),g},Pr.createPortal=function(g,v,E){var P=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ph,key:P==null?null:""+P,children:g,containerInfo:v,implementation:E}},Pr.createRoleSelector=function(g){return{$$typeof:c0,value:g}},Pr.createTestNameSelector=function(g){return{$$typeof:hg,value:g}},Pr.createTextSelector=function(g){return{$$typeof:kf,value:g}},Pr.defaultOnCaughtError=function(g){console.error(g)},Pr.defaultOnRecoverableError=function(g){Mv(g)},Pr.defaultOnUncaughtError=function(g){Mv(g)},Pr.deferredUpdates=function(g){var v=Yn.T,E=hc();try{return $r(32),Yn.T=null,g()}finally{$r(E),Yn.T=v}},Pr.discreteUpdates=function(g,v,E,P,W){var ne=Yn.T,De=hc();try{return $r(2),Yn.T=null,g(v,E,P,W)}finally{$r(De),Yn.T=ne,Br===0&&(If=_a()+500)}},Pr.findAllNodes=nl,Pr.findBoundingRects=function(g,v){if(!Mo)throw Error(i(363));v=nl(g,v),g=[];for(var E=0;E<v.length;E++)g.push(cv(v[E]));for(v=g.length-1;0<v;v--){E=g[v];for(var P=E.x,W=P+E.width,ne=E.y,De=ne+E.height,at=v-1;0<=at;at--)if(v!==at){var zt=g[at],nn=zt.x,xn=nn+zt.width,on=zt.y,kn=on+zt.height;if(P>=nn&&ne>=on&&W<=xn&&De<=kn){g.splice(v,1);break}else if(P!==nn||E.width!==zt.width||kn<ne||on>De){if(!(ne!==on||E.height!==zt.height||xn<P||nn>W)){nn>P&&(zt.width+=nn-P,zt.x=P),xn<W&&(zt.width=W-nn),g.splice(v,1);break}}else{on>ne&&(zt.height+=on-ne,zt.y=ne),kn<De&&(zt.height=De-on),g.splice(v,1);break}}}return g},Pr.findHostInstance=Km,Pr.findHostInstanceWithNoPortals=function(g){return g=a(g),g=g!==null?c(g):null,g===null?null:Jp(g.stateNode)},Pr.findHostInstanceWithWarning=function(g){return Km(g)},Pr.flushPassiveEffects=Du,Pr.flushSyncFromReconciler=function(g){var v=Br;Br|=1;var E=Yn.T,P=hc();try{if($r(2),Yn.T=null,g)return g()}finally{$r(P),Yn.T=E,Br=v,(Br&6)===0&&Ae(0)}},Pr.flushSyncWork=Yx,Pr.focusWithin=function(g,v){if(!Mo)throw Error(i(363));for(g=pf(g),v=$p(g,v),v=Array.from(v),g=0;g<v.length;){var E=v[g++],P=E.tag;if(!Sf(E)){if((P===5||P===26||P===27)&&Id(E.stateNode))return!0;for(E=E.child;E!==null;)v.push(E),E=E.sibling}}return!1},Pr.getFindAllNodesFailureDescription=function(g,v){if(!Mo)throw Error(i(363));var E=0,P=[];g=[pf(g),0];for(var W=0;W<g.length;){var ne=g[W++],De=ne.tag,at=g[W++],zt=v[at];if((De!==5&&De!==26&&De!==27||!Sf(ne))&&(mf(ne,zt)&&(P.push(Wp(zt)),at++,at>E&&(E=at)),at<v.length))for(ne=ne.child;ne!==null;)g.push(ne,at),ne=ne.sibling}if(E<v.length){for(g=[];E<v.length;E++)g.push(Wp(v[E]));return`findAllNodes was able to match part of the selector:
  `+(P.join(" > ")+`

No matching component was found for:
  `)+g.join(" > ")}return null},Pr.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 27:case 5:return Jp(g.child.stateNode);default:return g.child.stateNode}},Pr.injectIntoDevTools=function(){var g={bundleType:0,version:ab,rendererPackageName:eg,currentDispatcherRef:Yn,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{Hh=v.inject(g),al=v}catch{}g=!!v.checkDCE}}return g},Pr.isAlreadyRendering=function(){return(Br&6)!==0},Pr.observeVisibleRects=function(g,v,E,P){if(!Mo)throw Error(i(363));g=nl(g,v);var W=uv(g,E,P).disconnect;return{disconnect:function(){W()}}},Pr.shouldError=function(){return null},Pr.shouldSuspend=function(){return!1},Pr.startHostTransition=function(g,v,E,P){if(g.tag!==5)throw Error(i(476));var W=yd(g).queue;vd(g,W,v,jh,E===null?r:function(){var ne=yd(g);return ne.next===null&&(ne=g.alternate.memoizedState),So(g,ne.next.queue,{},as()),E(P)})},Pr.updateContainer=function(g,v,E,P){var W=v.current,ne=as();return sb(W,ne,g,v,E,P),ne},Pr.updateContainerSync=function(g,v,E,P){return sb(v.current,2,g,v,E,P),2},Pr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(cF)),cF.exports}var dF;function eAe(){return dF||(dF=1,lF.exports=JEe()),lF.exports}var tAe=eAe();const nAe=QEe(tAe);function rAe(t){const e=nAe(t);return e.injectIntoDevTools(),e}const fZ=0,Cy={},iAe=/^three(?=[A-Z])/,vE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let sAe=0;const oAe=t=>typeof t=="function";function aAe(t){if(oAe(t)){const e=`${sAe++}`;return Cy[e]=t,e}else Object.assign(Cy,t)}function hZ(t,e){const n=vE(t),r=Cy[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 lAe(t,e,n){var r;return t=vE(t)in Cy?t:t.replace(iAe,""),hZ(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,rT(e.object,n,t,e)}function cAe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?sT(t.parent,t):Ac(t.object)&&(t.object.visible=!1),t.isHidden=!0,Zy(t)}}function pZ(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?iT(t.parent,t):Ac(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,Zy(t)}}function lP(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const o=Cy[vE(e.type)];e.object=(i=e.props.object)!=null?i:new o(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(F0(e.object,e.props),e.props.attach)iT(t,e);else if(Ac(e.object)&&Ac(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)lP(e,o);Zy(e)}}function vN(t,e){e&&(e.parent=t,t.children.push(e),lP(t,e))}function fF(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),lP(t,e,n)}function mZ(t){if(typeof t.dispose=="function"){const e=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():LR.unstable_scheduleCallback(LR.unstable_IdlePriority,e)}}function zR(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?sT(t,e):Ac(e.object)&&Ac(t.object)&&(t.object.remove(e.object),GEe(iZ(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];zR(e,o,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&mZ(e.object),n===void 0&&Zy(e)}function uAe(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 p2=[];function dAe(){for(const[n]of p2){const r=n.parent;if(r){n.props.attach?sT(r,n):Ac(n.object)&&Ac(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?sT(n,i):Ac(i.object)&&Ac(n.object)&&n.object.remove(i.object)}n.isHidden&&pZ(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&mZ(n.object)}for(const[n,r,i]of p2){n.props=r;const s=n.parent;if(s){var t,e;const o=Cy[vE(n.type)];n.object=(t=n.props.object)!=null?t:new o(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,uAe(i,n.object),F0(n.object,n.props),n.props.attach?iT(s,n):Ac(n.object)&&Ac(s.object)&&s.object.add(n.object);for(const a of n.children)a.props.attach?iT(n,a):Ac(a.object)&&Ac(n.object)&&n.object.add(a.object);Zy(n)}}p2.length=0}const yN=()=>{},hF={};let HM=fZ;const fAe=0,hAe=4,FR=rAe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:lAe,removeChild:zR,appendChild:vN,appendInitialChild:vN,insertBefore:fF,appendChildToContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||vN(n,e)},removeChildFromContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||zR(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||fF(r,e,n)},getRootHostContext:()=>hF,getChildHostContext:()=>hF,commitUpdate(t,e,n,r,i){var s,o,a;hZ(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)p2.push([t,{...r},i]);else{const d=UEe(t,r);Object.keys(d).length&&(Object.assign(t.props,d),F0(t.object,d))}(i.sibling===null||(i.flags&hAe)===fAe)&&dAe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>rT(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:cAe,unhideInstance:pZ,createTextInstance:yN,hideTextInstance:yN,unhideTextInstance:yN,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:w.createContext(null),setCurrentUpdatePriority(t){HM=t},getCurrentUpdatePriority(){return HM},resolveUpdatePriority(){var t;if(HM!==fZ)return HM;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 KEe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return XEe;default:return YEe}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:ZEe.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}),Tx=new Map,d1={objects:"shallow",strict:!1};function pAe(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 mAe(t){const e=Tx.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||$Ee(HR,mF),o=n||FR.createContainer(s,qEe,null,!1,null,"",i,i,i,null);e||Tx.set(t,{fiber:o,store:s});let a,l,c=!1,d=null;return{async configure(p={}){let m;d=new Promise(H=>m=H);let{gl:x,size:b,scene:_,events:S,onCreated:M,shadows:C=!1,linear:A=!1,flat:N=!1,legacy:D=!1,orthographic:R=!1,frameloop:L="always",dpr:k=[1,2],performance:O,raycaster:F,camera:B,onPointerMissed:Y}=p,V=s.getState(),q=V.gl;if(!V.gl){const H={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof x=="function"?await x(H):x;aF(X)?q=X:q=new eZ({...H,...x}),V.set({gl:q})}let G=V.raycaster;G||V.set({raycaster:G=new GK});const{params:$,...Q}=F||{};if(eo.equ(Q,G,d1)||F0(G,{...Q}),eo.equ($,G.params,d1)||F0(G,{params:{...G.params,...$}}),!V.camera||V.camera===l&&!eo.equ(l,B,d1)){l=B;const H=B==null?void 0:B.isCamera,X=H?B:R?new tf(0,0,0,0,.1,1e3):new no(75,0,.1,1e3);H||(X.position.z=5,B&&(F0(X,B),X.manual||("aspect"in B||"left"in B||"right"in B||"bottom"in B||"top"in B)&&(X.manual=!0,X.updateProjectionMatrix())),!V.camera&&!(B!=null&&B.rotation)&&X.lookAt(0,0,0)),V.set({camera:X}),G.camera=X}if(!V.scene){let H;_!=null&&_.isScene?(H=_,rT(H,s,"",{})):(H=new R9,rT(H,s,"",{}),_&&F0(H,_)),V.set({scene:H})}S&&!V.events.handlers&&V.set({events:S(s)});const K=pAe(t,b);if(eo.equ(K,V.size,d1)||V.setSize(K.width,K.height,K.top,K.left),k&&V.viewport.dpr!==aZ(k)&&V.setDpr(k),V.frameloop!==L&&V.setFrameloop(L),V.onPointerMissed||V.set({onPointerMissed:Y}),O&&!eo.equ(O,V.performance,d1)&&V.set(H=>({performance:{...H.performance,...O}})),!V.xr){var re;const H=(le,se)=>{const J=s.getState();J.frameloop!=="never"&&mF(le,!0,J,se)},X=()=>{const le=s.getState();le.gl.xr.enabled=le.gl.xr.isPresenting,le.gl.xr.setAnimationLoop(le.gl.xr.isPresenting?H:null),le.gl.xr.isPresenting||HR(le)},j={connect(){const le=s.getState().gl;le.xr.addEventListener("sessionstart",X),le.xr.addEventListener("sessionend",X)},disconnect(){const le=s.getState().gl;le.xr.removeEventListener("sessionstart",X),le.xr.removeEventListener("sessionend",X)}};typeof((re=q.xr)==null?void 0:re.addEventListener)=="function"&&j.connect(),V.set({xr:j})}if(q.shadowMap){const H=q.shadowMap.enabled,X=q.shadowMap.type;if(q.shadowMap.enabled=!!C,eo.boo(C))q.shadowMap.type=eS;else if(eo.str(C)){var U;const j={basic:uY,percentage:O1,soft:eS,variance:Yg};q.shadowMap.type=(U=j[C])!=null?U:eS}else eo.obj(C)&&Object.assign(q.shadowMap,C);(H!==q.shadowMap.enabled||X!==q.shadowMap.type)&&(q.shadowMap.needsUpdate=!0)}return li.enabled=!D,c||(q.outputColorSpace=A?vm:xl,q.toneMapping=N?hu:PC),V.legacy!==D&&V.set(()=>({legacy:D})),V.linear!==A&&V.set(()=>({linear:A})),V.flat!==N&&V.set(()=>({flat:N})),x&&!eo.fun(x)&&!aF(x)&&!eo.equ(x,q,d1)&&F0(q,x),a=M,c=!0,m(),this},render(p){return!c&&!d&&this.configure(),d.then(()=>{FR.updateContainer(f.jsx(gAe,{store:s,children:p,onCreated:a,rootElement:t}),o,null,()=>{})}),s},unmount(){gZ(t)}}}function gAe({store:t,children:e,onCreated:n,rootElement:r}){return Zw(()=>{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(uZ.Provider,{value:t,children:e})}function gZ(t,e){const n=Tx.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),FR.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(),jEe(i.scene),Tx.delete(t)}catch{}},500)})}}const xAe=new Set,vAe=new Set,yAe=new Set;function bN(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function dS(t,e){switch(t){case"before":return bN(xAe,e);case"after":return bN(vAe,e);case"tail":return bN(yAe,e)}}let _N,SN;function UR(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),_N=e.internal.subscribers;for(let i=0;i<_N.length;i++)SN=_N[i],SN.ref.current(SN.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 oT=!1,BR=!1,wN,pF,f1;function xZ(t){pF=requestAnimationFrame(xZ),oT=!0,wN=0,dS("before",t),BR=!0;for(const n of Tx.values()){var e;f1=n.store.getState(),f1.internal.active&&(f1.frameloop==="always"||f1.internal.frames>0)&&!((e=f1.gl.xr)!=null&&e.isPresenting)&&(wN+=UR(t,f1))}if(BR=!1,dS("after",t),wN===0)return dS("tail",t),oT=!1,cancelAnimationFrame(pF)}function HR(t,e=1){var n;if(!t)return Tx.forEach(r=>HR(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):BR?t.internal.frames=2:t.internal.frames=1,oT||(oT=!0,requestAnimationFrame(xZ)))}function mF(t,e=!0,n,r){if(e&&dS("before",t),n)UR(t,n,r);else for(const i of Tx.values())UR(t,i.store.getState());e&&dS("after",t)}const MN={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 bAe(t){const{handlePointer:e}=WEe(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(MN).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]=MN[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]=MN[i];r.connected.removeEventListener(o,s)}n(i=>({events:{...i.events,connected:void 0}}))}}}}function gF(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function _Ae({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]=w.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=w.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=w.useRef(!1);w.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,x]=w.useMemo(()=>{const M=()=>{if(!a.current.element)return;const{left:C,top:A,width:N,height:D,bottom:R,right:L,x:k,y:O}=a.current.element.getBoundingClientRect(),F={left:C,top:A,width:N,height:D,bottom:R,right:L,x:k,y:O};a.current.element instanceof HTMLElement&&r&&(F.height=a.current.element.offsetHeight,F.width=a.current.element.offsetWidth),Object.freeze(F),d.current&&!TAe(a.current.lastBounds,F)&&o(a.current.lastBounds=F)};return[M,c?gF(M,c):M,l?gF(M,l):M]},[o,r,l,c]);function b(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(M=>M.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(M=>M.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=M=>{!M||M===a.current.element||(b(),a.current.element=M,a.current.scrollContainers=vZ(M),_())};return wAe(x,!!e),SAe(m),w.useEffect(()=>{b(),_()},[e,x,m]),w.useEffect(()=>b,[]),[S,s,p]}function SAe(t){w.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function wAe(t,e){w.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function vZ(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,...vZ(t.parentElement)]}const MAe=["x","y","top","bottom","left","right","width","height"],TAe=(t,e)=>MAe.every(n=>t[n]===e[n]);function CAe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:o=bAe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:C,scene:A,onPointerMissed:N,onCreated:D,...R}){w.useMemo(()=>aAe(hEe),[]);const L=IEe(),[k,O]=_Ae({scroll:!0,debounce:{scroll:50,resize:0},...r}),F=w.useRef(null),B=w.useRef(null);w.useImperativeHandle(t,()=>F.current);const Y=oZ(N),[V,q]=w.useState(!1),[G,$]=w.useState(!1);if(V)throw V;if(G)throw G;const Q=w.useRef(null);Zw(()=>{const re=F.current;if(O.width>0&&O.height>0&&re){Q.current||(Q.current=mAe(re));async function U(){await Q.current.configure({gl:s,scene:A,events:o,shadows:c,linear:d,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:C,size:O,onPointerMissed:(...H)=>Y.current==null?void 0:Y.current(...H),onCreated:H=>{H.events.connect==null||H.events.connect(a?PEe(a)?a.current:a:B.current),l&&H.setEvents({compute:(X,j)=>{const le=X[l+"X"],se=X[l+"Y"];j.pointer.set(le/j.size.width*2-1,-(se/j.size.height)*2+1),j.raycaster.setFromCamera(j.pointer,j.camera)}}),D==null||D(H)}}),Q.current.render(f.jsx(L,{children:f.jsx(LEe,{set:$,children:f.jsx(w.Suspense,{fallback:f.jsx(OEe,{set:q}),children:e??null})})}))}U()}}),w.useEffect(()=>{const re=F.current;if(re)return()=>gZ(re)},[]);const K=a?"none":"auto";return f.jsx("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...R,children:f.jsx("div",{ref:k,style:{width:"100%",height:"100%"},children:f.jsx("canvas",{ref:F,style:{display:"block"},children:n})})})}function EAe(t){return f.jsx(nZ,{children:f.jsx(CAe,{...t})})}function gh(){return gh=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},gh.apply(null,arguments)}const Qw=new Ve,cP=new Ve,AAe=new Ve,xF=new Wt;function NAe(t,e,n){const r=Qw.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 kAe(t,e){const n=Qw.setFromMatrixPosition(t.matrixWorld),r=cP.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(AAe);return i.angleTo(s)>Math.PI/2}function RAe(t,e,n,r){const i=Qw.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),xF.set(s.x,s.y),n.setFromCamera(xF,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 PAe(t,e){if(e instanceof tf)return e.zoom;if(e instanceof no){const n=Qw.setFromMatrixPosition(t.matrixWorld),r=cP.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 DAe(t,e,n){if(e instanceof no||e instanceof tf){const r=Qw.setFromMatrixPosition(t.matrixWorld),i=cP.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 VR=t=>Math.abs(t)<1e-10?0:t;function yZ(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=VR(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const IAe=(t=>e=>yZ(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),OAe=(t=>(e,n)=>yZ(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 LAe(t){return t&&typeof t=="object"&&"current"in t}const uP=w.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:M=[16777271,0],calculatePosition:C=NAe,as:A="div",wrapperClass:N,pointerEvents:D="auto",...R},L)=>{const{gl:k,camera:O,scene:F,size:B,raycaster:Y,events:V,viewport:q}=Nc(),[G]=w.useState(()=>document.createElement(A)),$=w.useRef(null),Q=w.useRef(null),K=w.useRef(0),re=w.useRef([0,0]),U=w.useRef(null),H=w.useRef(null),X=(a==null?void 0:a.current)||V.connected||k.domElement.parentNode,j=w.useRef(null),le=w.useRef(!1),se=w.useMemo(()=>p&&p!=="blending"||Array.isArray(p)&&p.length&&LAe(p[0]),[p]);w.useLayoutEffect(()=>{const de=k.domElement;p&&p==="blending"?(de.style.zIndex=`${Math.floor(M[0]/2)}`,de.style.position="absolute",de.style.pointerEvents="none"):(de.style.zIndex=null,de.style.position=null,de.style.pointerEvents=null)},[p]),w.useLayoutEffect(()=>{if(Q.current){const de=$.current=dU.createRoot(G);if(F.updateMatrixWorld(),d)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ye=C(Q.current,O,B);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ye[0]}px,${ye[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(G):X.appendChild(G)),()=>{X&&X.removeChild(G),de.unmount()}}},[X,d]),w.useLayoutEffect(()=>{N&&(G.className=N)},[N]);const J=w.useMemo(()=>d?{position:"absolute",top:0,left:0,width:B.width,height:B.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-B.height/2,left:-B.width/2,width:B.width,height:B.height},...n},[n,s,o,B,d]),ee=w.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);w.useLayoutEffect(()=>{if(le.current=!1,d){var de;(de=$.current)==null||de.render(w.createElement("div",{ref:U,style:J},w.createElement("div",{ref:H,style:ee},w.createElement("div",{ref:L,className:r,style:n,children:t}))))}else{var ye;(ye=$.current)==null||ye.render(w.createElement("div",{ref:L,style:J,className:r,children:t}))}});const ie=w.useRef(!0);xE(de=>{if(Q.current){O.updateMatrixWorld(),Q.current.updateWorldMatrix(!0,!1);const ye=d?re.current:C(Q.current,O,B);if(d||Math.abs(K.current-O.zoom)>e||Math.abs(re.current[0]-ye[0])>e||Math.abs(re.current[1]-ye[1])>e){const ge=kAe(Q.current,O);let Me=!1;se&&(Array.isArray(p)?Me=p.map(Pe=>Pe.current):p!=="blending"&&(Me=[F]));const fe=ie.current;if(Me){const Pe=RAe(Q.current,O,Y,Me);ie.current=Pe&&!ge}else ie.current=!ge;fe!==ie.current&&(m?m(!ie.current):G.style.display=ie.current?"block":"none");const Se=Math.floor(M[0]/2),me=p?se?[M[0],Se]:[Se-1,0]:M;if(G.style.zIndex=`${DAe(Q.current,O,me)}`,d){const[Pe,ce]=[B.width/2,B.height/2],He=O.projectionMatrix.elements[5]*ce,{isOrthographicCamera:Be,top:Ge,left:We,bottom:ae,right:Z}=O,he=IAe(O.matrixWorldInverse),be=Be?`scale(${He})translate(${VR(-(Z+We)/2)}px,${VR((Ge+ae)/2)}px)`:`translateZ(${He}px)`;let we=Q.current.matrixWorld;c&&(we=O.matrixWorldInverse.clone().transpose().copyPosition(we).scale(Q.current.scale),we.elements[3]=we.elements[7]=we.elements[11]=0,we.elements[15]=1),G.style.width=B.width+"px",G.style.height=B.height+"px",G.style.perspective=Be?"":`${He}px`,U.current&&H.current&&(U.current.style.transform=`${be}${he}translate(${Pe}px,${ce}px)`,H.current.style.transform=OAe(we,1/((l||10)/400)))}else{const Pe=l===void 0?1:PAe(Q.current,O)*l;G.style.transform=`translate3d(${ye[0]}px,${ye[1]}px,0) scale(${Pe})`}re.current=ye,K.current=O.zoom}}if(!se&&j.current&&!le.current)if(d){if(U.current){const ye=U.current.children[0];if(ye!=null&&ye.clientWidth&&ye!=null&&ye.clientHeight){const{isOrthographicCamera:ge}=O;if(ge||S)R.scale&&(Array.isArray(R.scale)?R.scale instanceof Ve?j.current.scale.copy(R.scale.clone().divideScalar(1)):j.current.scale.set(1/R.scale[0],1/R.scale[1],1/R.scale[2]):j.current.scale.setScalar(1/R.scale));else{const Me=(l||10)/400,fe=ye.clientWidth*Me,Se=ye.clientHeight*Me;j.current.scale.set(fe,Se,1)}le.current=!0}}}else{const ye=G.children[0];if(ye!=null&&ye.clientWidth&&ye!=null&&ye.clientHeight){const ge=1/q.factor,Me=ye.clientWidth*ge,fe=ye.clientHeight*ge;j.current.scale.set(Me,fe,1),le.current=!0}j.current.lookAt(de.camera.position)}});const oe=w.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 w.createElement("group",gh({},R,{ref:Q}),p&&!se&&w.createElement("mesh",{castShadow:x,receiveShadow:b,ref:j},S||w.createElement("planeGeometry",null),_||w.createElement("shaderMaterial",{side:ru,vertexShader:oe.vertexShader,fragmentShader:oe.fragmentShader})))}),bZ=parseInt(Hw.replace(/\D+/g,"")),_Z=bZ>=125?"uv1":"uv2";function jAe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new Ve,new Ve,new Ve],s=new Ve,o=new Ve,a=new Ve,l=new Ve;function c(_){const S=~~(_.x*r),M=~~(_.y*r),C=~~(_.z*r);return`${S},${M},${C}`}const d=t.index?t.toNonIndexed():t,p=d.attributes.position,m={};for(let _=0,S=p.count/3;_<S;_++){const M=3*_,C=i[0].fromBufferAttribute(p,M+0),A=i[1].fromBufferAttribute(p,M+1),N=i[2].fromBufferAttribute(p,M+2);s.subVectors(N,A),o.subVectors(C,A);const D=new Ve().crossVectors(s,o).normalize();for(let R=0;R<3;R++){const L=i[R],k=c(L);k in m||(m[k]=[]),m[k].push(D)}}const x=new Float32Array(p.count*3),b=new $i(x,3,!1);for(let _=0,S=p.count/3;_<S;_++){const M=3*_,C=i[0].fromBufferAttribute(p,M+0),A=i[1].fromBufferAttribute(p,M+1),N=i[2].fromBufferAttribute(p,M+2);s.subVectors(N,A),o.subVectors(C,A),a.crossVectors(s,o).normalize();for(let D=0;D<3;D++){const R=i[D],L=c(R),k=m[L];l.set(0,0,0);for(let O=0,F=k.length;O<F;O++){const B=k[O];a.dot(B)>n&&l.add(B)}l.normalize(),b.setXYZ(M+D,l.x,l.y,l.z)}}return d.setAttribute("normal",b),d}var zAe=Object.defineProperty,FAe=(t,e,n)=>e in t?zAe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,UAe=(t,e,n)=>(FAe(t,e+"",n),n);class BAe{constructor(){UAe(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 HAe=Object.defineProperty,VAe=(t,e,n)=>e in t?HAe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nr=(t,e,n)=>(VAe(t,typeof e!="symbol"?e+"":e,n),n);const VM=new Ux,vF=new lp,GAe=Math.cos(70*(Math.PI/180)),yF=(t,e)=>(t%e+e)%e;let WAe=class extends BAe{constructor(e,n){super(),nr(this,"object"),nr(this,"domElement"),nr(this,"enabled",!0),nr(this,"target",new Ve),nr(this,"minDistance",0),nr(this,"maxDistance",1/0),nr(this,"minZoom",0),nr(this,"maxZoom",1/0),nr(this,"minPolarAngle",0),nr(this,"maxPolarAngle",Math.PI),nr(this,"minAzimuthAngle",-1/0),nr(this,"maxAzimuthAngle",1/0),nr(this,"enableDamping",!1),nr(this,"dampingFactor",.05),nr(this,"enableZoom",!0),nr(this,"zoomSpeed",1),nr(this,"enableRotate",!0),nr(this,"rotateSpeed",1),nr(this,"enablePan",!0),nr(this,"panSpeed",1),nr(this,"screenSpacePanning",!0),nr(this,"keyPanSpeed",7),nr(this,"zoomToCursor",!1),nr(this,"autoRotate",!1),nr(this,"autoRotateSpeed",2),nr(this,"reverseOrbit",!1),nr(this,"reverseHorizontalOrbit",!1),nr(this,"reverseVerticalOrbit",!1),nr(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),nr(this,"mouseButtons",{LEFT:Hg.ROTATE,MIDDLE:Hg.DOLLY,RIGHT:Hg.PAN}),nr(this,"touches",{ONE:Vg.ROTATE,TWO:Vg.DOLLY_PAN}),nr(this,"target0"),nr(this,"position0"),nr(this,"zoom0"),nr(this,"_domElementKeyEvents",null),nr(this,"getPolarAngle"),nr(this,"getAzimuthalAngle"),nr(this,"setPolarAngle"),nr(this,"setAzimuthalAngle"),nr(this,"getDistance"),nr(this,"getZoomScale"),nr(this,"listenToKeyEvents"),nr(this,"stopListenToKeyEvents"),nr(this,"saveState"),nr(this,"reset"),nr(this,"update"),nr(this,"connect"),nr(this,"dispose"),nr(this,"dollyIn"),nr(this,"dollyOut"),nr(this,"getScale"),nr(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=Te=>{let Xe=yF(Te,2*Math.PI),ht=d.phi;ht<0&&(ht+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let ke=Math.abs(Xe-ht);2*Math.PI-ke<ke&&(Xe<ht?Xe+=2*Math.PI:ht+=2*Math.PI),p.phi=Xe-ht,r.update()},this.setAzimuthalAngle=Te=>{let Xe=yF(Te,2*Math.PI),ht=d.theta;ht<0&&(ht+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let ke=Math.abs(Xe-ht);2*Math.PI-ke<ke&&(Xe<ht?Xe+=2*Math.PI:ht+=2*Math.PI),p.theta=Xe-ht,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=Te=>{Te.addEventListener("keydown",ve),this._domElementKeyEvents=Te},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 Te=new Ve,Xe=new Ve(0,1,0),ht=new Ya().setFromUnitVectors(e.up,Xe),ke=ht.clone().invert(),et=new Ve,ct=new Ya,yt=2*Math.PI;return function(){const Je=r.object.position;ht.setFromUnitVectors(e.up,Xe),ke.copy(ht).invert(),Te.copy(Je).sub(r.target),Te.applyQuaternion(ht),d.setFromVector3(Te),r.autoRotate&&l===a.NONE&&q(Y()),r.enableDamping?(d.theta+=p.theta*r.dampingFactor,d.phi+=p.phi*r.dampingFactor):(d.theta+=p.theta,d.phi+=p.phi);let Ee=r.minAzimuthAngle,Ze=r.maxAzimuthAngle;isFinite(Ee)&&isFinite(Ze)&&(Ee<-Math.PI?Ee+=yt:Ee>Math.PI&&(Ee-=yt),Ze<-Math.PI?Ze+=yt:Ze>Math.PI&&(Ze-=yt),Ee<=Ze?d.theta=Math.max(Ee,Math.min(Ze,d.theta)):d.theta=d.theta>(Ee+Ze)/2?Math.max(Ee,d.theta):Math.min(Ze,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&&O||r.object.isOrthographicCamera?d.radius=j(d.radius):d.radius=j(d.radius*m),Te.setFromSpherical(d),Te.applyQuaternion(ke),Je.copy(r.target).add(Te),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 Ie=!1;if(r.zoomToCursor&&O){let Ue=null;if(r.object instanceof no&&r.object.isPerspectiveCamera){const rt=Te.length();Ue=j(rt*m);const ut=rt-Ue;r.object.position.addScaledVector(L,ut),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const rt=new Ve(k.x,k.y,0);rt.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),Ie=!0;const ut=new Ve(k.x,k.y,0);ut.unproject(r.object),r.object.position.sub(ut).add(rt),r.object.updateMatrixWorld(),Ue=Te.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Ue!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Ue).add(r.object.position):(VM.origin.copy(r.object.position),VM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(VM.direction))<GAe?e.lookAt(r.target):(vF.setFromNormalAndCoplanarPoint(r.object.up,r.target),VM.intersectPlane(vF,r.target))))}else r.object instanceof tf&&r.object.isOrthographicCamera&&(Ie=m!==1,Ie&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix()));return m=1,O=!1,Ie||et.distanceToSquared(r.object.position)>c||8*(1-ct.dot(r.object.quaternion))>c?(r.dispatchEvent(i),et.copy(r.object.position),ct.copy(r.object.quaternion),Ie=!1,!0):!1}})(),this.connect=Te=>{r.domElement=Te,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Oe),r.domElement.addEventListener("pointerdown",We),r.domElement.addEventListener("pointercancel",Z),r.domElement.addEventListener("wheel",we)},this.dispose=()=>{var Te,Xe,ht,ke,et,ct;r.domElement&&(r.domElement.style.touchAction="auto"),(Te=r.domElement)==null||Te.removeEventListener("contextmenu",Oe),(Xe=r.domElement)==null||Xe.removeEventListener("pointerdown",We),(ht=r.domElement)==null||ht.removeEventListener("pointercancel",Z),(ke=r.domElement)==null||ke.removeEventListener("wheel",we),(et=r.domElement)==null||et.ownerDocument.removeEventListener("pointermove",ae),(ct=r.domElement)==null||ct.ownerDocument.removeEventListener("pointerup",Z),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 RR,p=new RR;let m=1;const x=new Ve,b=new Wt,_=new Wt,S=new Wt,M=new Wt,C=new Wt,A=new Wt,N=new Wt,D=new Wt,R=new Wt,L=new Ve,k=new Wt;let O=!1;const F=[],B={};function Y(){return 2*Math.PI/60/60*r.autoRotateSpeed}function V(){return Math.pow(.95,r.zoomSpeed)}function q(Te){r.reverseOrbit||r.reverseHorizontalOrbit?p.theta+=Te:p.theta-=Te}function G(Te){r.reverseOrbit||r.reverseVerticalOrbit?p.phi+=Te:p.phi-=Te}const $=(()=>{const Te=new Ve;return function(ht,ke){Te.setFromMatrixColumn(ke,0),Te.multiplyScalar(-ht),x.add(Te)}})(),Q=(()=>{const Te=new Ve;return function(ht,ke){r.screenSpacePanning===!0?Te.setFromMatrixColumn(ke,1):(Te.setFromMatrixColumn(ke,0),Te.crossVectors(r.object.up,Te)),Te.multiplyScalar(ht),x.add(Te)}})(),K=(()=>{const Te=new Ve;return function(ht,ke){const et=r.domElement;if(et&&r.object instanceof no&&r.object.isPerspectiveCamera){const ct=r.object.position;Te.copy(ct).sub(r.target);let yt=Te.length();yt*=Math.tan(r.object.fov/2*Math.PI/180),$(2*ht*yt/et.clientHeight,r.object.matrix),Q(2*ke*yt/et.clientHeight,r.object.matrix)}else et&&r.object instanceof tf&&r.object.isOrthographicCamera?($(ht*(r.object.right-r.object.left)/r.object.zoom/et.clientWidth,r.object.matrix),Q(ke*(r.object.top-r.object.bottom)/r.object.zoom/et.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function re(Te){r.object instanceof no&&r.object.isPerspectiveCamera||r.object instanceof tf&&r.object.isOrthographicCamera?m=Te:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(Te){re(m/Te)}function H(Te){re(m*Te)}function X(Te){if(!r.zoomToCursor||!r.domElement)return;O=!0;const Xe=r.domElement.getBoundingClientRect(),ht=Te.clientX-Xe.left,ke=Te.clientY-Xe.top,et=Xe.width,ct=Xe.height;k.x=ht/et*2-1,k.y=-(ke/ct)*2+1,L.set(k.x,k.y,1).unproject(r.object).sub(r.object.position).normalize()}function j(Te){return Math.max(r.minDistance,Math.min(r.maxDistance,Te))}function le(Te){b.set(Te.clientX,Te.clientY)}function se(Te){X(Te),N.set(Te.clientX,Te.clientY)}function J(Te){M.set(Te.clientX,Te.clientY)}function ee(Te){_.set(Te.clientX,Te.clientY),S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(q(2*Math.PI*S.x/Xe.clientHeight),G(2*Math.PI*S.y/Xe.clientHeight)),b.copy(_),r.update()}function ie(Te){D.set(Te.clientX,Te.clientY),R.subVectors(D,N),R.y>0?U(V()):R.y<0&&H(V()),N.copy(D),r.update()}function oe(Te){C.set(Te.clientX,Te.clientY),A.subVectors(C,M).multiplyScalar(r.panSpeed),K(A.x,A.y),M.copy(C),r.update()}function de(Te){X(Te),Te.deltaY<0?H(V()):Te.deltaY>0&&U(V()),r.update()}function ye(Te){let Xe=!1;switch(Te.code){case r.keys.UP:K(0,r.keyPanSpeed),Xe=!0;break;case r.keys.BOTTOM:K(0,-r.keyPanSpeed),Xe=!0;break;case r.keys.LEFT:K(r.keyPanSpeed,0),Xe=!0;break;case r.keys.RIGHT:K(-r.keyPanSpeed,0),Xe=!0;break}Xe&&(Te.preventDefault(),r.update())}function ge(){if(F.length==1)b.set(F[0].pageX,F[0].pageY);else{const Te=.5*(F[0].pageX+F[1].pageX),Xe=.5*(F[0].pageY+F[1].pageY);b.set(Te,Xe)}}function Me(){if(F.length==1)M.set(F[0].pageX,F[0].pageY);else{const Te=.5*(F[0].pageX+F[1].pageX),Xe=.5*(F[0].pageY+F[1].pageY);M.set(Te,Xe)}}function fe(){const Te=F[0].pageX-F[1].pageX,Xe=F[0].pageY-F[1].pageY,ht=Math.sqrt(Te*Te+Xe*Xe);N.set(0,ht)}function Se(){r.enableZoom&&fe(),r.enablePan&&Me()}function me(){r.enableZoom&&fe(),r.enableRotate&&ge()}function Pe(Te){if(F.length==1)_.set(Te.pageX,Te.pageY);else{const ht=je(Te),ke=.5*(Te.pageX+ht.x),et=.5*(Te.pageY+ht.y);_.set(ke,et)}S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(q(2*Math.PI*S.x/Xe.clientHeight),G(2*Math.PI*S.y/Xe.clientHeight)),b.copy(_)}function ce(Te){if(F.length==1)C.set(Te.pageX,Te.pageY);else{const Xe=je(Te),ht=.5*(Te.pageX+Xe.x),ke=.5*(Te.pageY+Xe.y);C.set(ht,ke)}A.subVectors(C,M).multiplyScalar(r.panSpeed),K(A.x,A.y),M.copy(C)}function He(Te){const Xe=je(Te),ht=Te.pageX-Xe.x,ke=Te.pageY-Xe.y,et=Math.sqrt(ht*ht+ke*ke);D.set(0,et),R.set(0,Math.pow(D.y/N.y,r.zoomSpeed)),U(R.y),N.copy(D)}function Be(Te){r.enableZoom&&He(Te),r.enablePan&&ce(Te)}function Ge(Te){r.enableZoom&&He(Te),r.enableRotate&&Pe(Te)}function We(Te){var Xe,ht;r.enabled!==!1&&(F.length===0&&((Xe=r.domElement)==null||Xe.ownerDocument.addEventListener("pointermove",ae),(ht=r.domElement)==null||ht.ownerDocument.addEventListener("pointerup",Z)),qe(Te),Te.pointerType==="touch"?Re(Te):he(Te))}function ae(Te){r.enabled!==!1&&(Te.pointerType==="touch"?Ae(Te):be(Te))}function Z(Te){var Xe,ht,ke;Fe(Te),F.length===0&&((Xe=r.domElement)==null||Xe.releasePointerCapture(Te.pointerId),(ht=r.domElement)==null||ht.ownerDocument.removeEventListener("pointermove",ae),(ke=r.domElement)==null||ke.ownerDocument.removeEventListener("pointerup",Z)),r.dispatchEvent(o),l=a.NONE}function he(Te){let Xe;switch(Te.button){case 0:Xe=r.mouseButtons.LEFT;break;case 1:Xe=r.mouseButtons.MIDDLE;break;case 2:Xe=r.mouseButtons.RIGHT;break;default:Xe=-1}switch(Xe){case Hg.DOLLY:if(r.enableZoom===!1)return;se(Te),l=a.DOLLY;break;case Hg.ROTATE:if(Te.ctrlKey||Te.metaKey||Te.shiftKey){if(r.enablePan===!1)return;J(Te),l=a.PAN}else{if(r.enableRotate===!1)return;le(Te),l=a.ROTATE}break;case Hg.PAN:if(Te.ctrlKey||Te.metaKey||Te.shiftKey){if(r.enableRotate===!1)return;le(Te),l=a.ROTATE}else{if(r.enablePan===!1)return;J(Te),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function be(Te){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;ee(Te);break;case a.DOLLY:if(r.enableZoom===!1)return;ie(Te);break;case a.PAN:if(r.enablePan===!1)return;oe(Te);break}}function we(Te){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(Te.preventDefault(),r.dispatchEvent(s),de(Te),r.dispatchEvent(o))}function ve(Te){r.enabled===!1||r.enablePan===!1||ye(Te)}function Re(Te){switch(Ke(Te),F.length){case 1:switch(r.touches.ONE){case Vg.ROTATE:if(r.enableRotate===!1)return;ge(),l=a.TOUCH_ROTATE;break;case Vg.PAN:if(r.enablePan===!1)return;Me(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Vg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Se(),l=a.TOUCH_DOLLY_PAN;break;case Vg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;me(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ae(Te){switch(Ke(Te),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Pe(Te),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;ce(Te),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Be(Te),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ge(Te),r.update();break;default:l=a.NONE}}function Oe(Te){r.enabled!==!1&&Te.preventDefault()}function qe(Te){F.push(Te)}function Fe(Te){delete B[Te.pointerId];for(let Xe=0;Xe<F.length;Xe++)if(F[Xe].pointerId==Te.pointerId){F.splice(Xe,1);return}}function Ke(Te){let Xe=B[Te.pointerId];Xe===void 0&&(Xe=new Wt,B[Te.pointerId]=Xe),Xe.set(Te.pageX,Te.pageY)}function je(Te){const Xe=Te.pointerId===F[0].pointerId?F[1]:F[0];return B[Xe.pointerId]}this.dollyIn=(Te=V())=>{H(Te),r.update()},this.dollyOut=(Te=V())=>{U(Te),r.update()},this.getScale=()=>m,this.setScale=Te=>{re(Te),r.update()},this.getZoomScale=()=>V(),n!==void 0&&this.connect(n),this.update()}};const bF=new Do,GM=new Ve;class dP extends pE{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 In(e,3)),this.setAttribute("uv",new In(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 nT(n,6,1);return this.setAttribute("instanceStart",new cu(r,3,0)),this.setAttribute("instanceEnd",new cu(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 nT(r,n*2,1);return this.setAttribute("instanceColorStart",new cu(i,n,0)),this.setAttribute("instanceColorEnd",new cu(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 W9(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Do);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),bF.setFromBufferAttribute(n),this.boundingBox.union(bF))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Qo),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++)GM.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(GM)),GM.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(GM));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 SZ extends dP{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 fP extends vu{constructor(e){super({type:"LineMaterial",uniforms:ZS.clone(ZS.merge([wn.common,wn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Wt(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 <${bZ>=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 TN=new hi,_F=new Ve,SF=new Ve,Va=new hi,Ga=new hi,Bf=new hi,CN=new Ve,EN=new ur,$a=new $K,wF=new Ve,WM=new Do,$M=new Qo,Hf=new hi;let eh,fx;function MF(t,e,n){return Hf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Hf.multiplyScalar(1/Hf.w),Hf.x=fx/n.width,Hf.y=fx/n.height,Hf.applyMatrix4(t.projectionMatrixInverse),Hf.multiplyScalar(1/Hf.w),Math.abs(Math.max(Hf.x,Hf.y))}function $Ae(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++){$a.start.fromBufferAttribute(i,a),$a.end.fromBufferAttribute(s,a),$a.applyMatrix4(n);const c=new Ve,d=new Ve;eh.distanceSqToSegment($a.start,$a.end,d,c),d.distanceTo(c)<fx*.5&&e.push({point:d,pointOnLine:c,distance:eh.origin.distanceTo(d),object:t,face:null,faceIndex:a,uv:null,[_Z]:null})}}function qAe(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;eh.at(1,Bf),Bf.w=1,Bf.applyMatrix4(e.matrixWorldInverse),Bf.applyMatrix4(r),Bf.multiplyScalar(1/Bf.w),Bf.x*=s.x/2,Bf.y*=s.y/2,Bf.z=0,CN.copy(Bf),EN.multiplyMatrices(e.matrixWorldInverse,o);for(let m=0,x=d;m<x;m++){if(Va.fromBufferAttribute(l,m),Ga.fromBufferAttribute(c,m),Va.w=1,Ga.w=1,Va.applyMatrix4(EN),Ga.applyMatrix4(EN),Va.z>p&&Ga.z>p)continue;if(Va.z>p){const A=Va.z-Ga.z,N=(Va.z-p)/A;Va.lerp(Ga,N)}else if(Ga.z>p){const A=Ga.z-Va.z,N=(Ga.z-p)/A;Ga.lerp(Va,N)}Va.applyMatrix4(r),Ga.applyMatrix4(r),Va.multiplyScalar(1/Va.w),Ga.multiplyScalar(1/Ga.w),Va.x*=s.x/2,Va.y*=s.y/2,Ga.x*=s.x/2,Ga.y*=s.y/2,$a.start.copy(Va),$a.start.z=0,$a.end.copy(Ga),$a.end.z=0;const _=$a.closestPointToPointParameter(CN,!0);$a.at(_,wF);const S=qY.lerp(Va.z,Ga.z,_),M=S>=-1&&S<=1,C=CN.distanceTo(wF)<fx*.5;if(M&&C){$a.start.fromBufferAttribute(l,m),$a.end.fromBufferAttribute(c,m),$a.start.applyMatrix4(o),$a.end.applyMatrix4(o);const A=new Ve,N=new Ve;eh.distanceSqToSegment($a.start,$a.end,N,A),n.push({point:N,pointOnLine:A,distance:eh.origin.distanceTo(N),object:t,face:null,faceIndex:m,uv:null,[_Z]:null})}}}class wZ extends Hs{constructor(e=new dP,n=new fP({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)_F.fromBufferAttribute(n,o),SF.fromBufferAttribute(r,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+_F.distanceTo(SF);const s=new nT(i,2,1);return e.setAttribute("instanceDistanceStart",new cu(s,1,0)),e.setAttribute("instanceDistanceEnd",new cu(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;eh=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;fx=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),$M.copy(a.boundingSphere).applyMatrix4(o);let c;if(r)c=fx*.5;else{const p=Math.max(i.near,$M.distanceToPoint(eh.origin));c=MF(i,p,l.resolution)}if($M.radius+=c,eh.intersectsSphere($M)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),WM.copy(a.boundingBox).applyMatrix4(o);let d;if(r)d=fx*.5;else{const p=Math.max(i.near,WM.distanceToPoint(eh.origin));d=MF(i,p,l.resolution)}WM.expandByScalar(d),eh.intersectsBox(WM)!==!1&&(r?$Ae(this,n):qAe(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(TN),this.material.uniforms.resolution.value.set(TN.z,TN.w))}}class XAe extends wZ{constructor(e=new SZ,n=new fP({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const YAe=w.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:o,dashed:a,...l},c){var d,p;const m=Nc(M=>M.size),x=w.useMemo(()=>o?new wZ:new XAe,[o]),[b]=w.useState(()=>new fP),_=(r==null||(d=r[0])==null?void 0:d.length)===4?4:3,S=w.useMemo(()=>{const M=o?new dP:new SZ,C=e.map(A=>{const N=Array.isArray(A);return A instanceof Ve||A instanceof hi?[A.x,A.y,A.z]:A instanceof Wt?[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(M.setPositions(C.flat()),r){n=16777215;const A=r.map(N=>N instanceof Nn?N.toArray():N);M.setColors(A.flat(),_)}return M},[e,o,r,_]);return w.useLayoutEffect(()=>{x.computeLineDistances()},[e,x]),w.useLayoutEffect(()=>{a?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[a,b]),w.useEffect(()=>()=>{S.dispose(),b.dispose()},[S]),w.createElement("primitive",gh({object:x,ref:c},l),w.createElement("primitive",{object:S,attach:"geometry"}),w.createElement("primitive",gh({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 KAe(){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 ZAe(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 MZ=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 MZ=function(){return t},t},QAe=0,JAe=0,AN=!1,fS=Object.create(null),hS=Object.create(null),GR=Object.create(null);function Qy(t){if((!t||typeof t.init!="function")&&!AN)throw new Error("requires `options.init` function");var e=t.dependencies,n=t.init,r=t.getTransferables,i=t.workerId,s=ZAe(t);i==null&&(i="#default");var o="workerModule"+ ++QAe,a=t.name||o,l=null;e=e&&e.map(function(d){return typeof d=="function"&&!d.workerModuleData&&(AN=!0,d=Qy({workerId:i,name:"<"+a+"> function dependency: "+d.name,init:`function(){return (
`+m2(d)+`
)}`}),AN=!1),d&&d.workerModuleData&&(d=d.workerModuleData),d});function c(){for(var d=[],p=arguments.length;p--;)d[p]=arguments[p];if(!MZ())return s.apply(void 0,d);if(!l){l=TF(i,"registerModule",c.workerModuleData);var m=function(){l=null,hS[i].delete(m)};(hS[i]||(hS[i]=new Set)).add(m)}return l.then(function(x){var b=x.isCallable;if(b)return TF(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:m2(n),getTransferables:r&&m2(r)},c.onMainThread=s,c}function e6e(t){hS[t]&&hS[t].forEach(function(e){e()}),fS[t]&&(fS[t].terminate(),delete fS[t])}function m2(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function t6e(t){var e=fS[t];if(!e){var n=m2(KAe);e=fS[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=GR[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete GR[s],o(i)}}return e}function TF(t,e,n){return new Promise(function(r,i){var s=++JAe;GR[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},t6e(t).postMessage({messageId:s,action:e,data:n})})}function TZ(){var t=(function(e){function n(re,U,H,X,j,le,se,J){var ee=1-se;J.x=ee*ee*re+2*ee*se*H+se*se*j,J.y=ee*ee*U+2*ee*se*X+se*se*le}function r(re,U,H,X,j,le,se,J,ee,ie){var oe=1-ee;ie.x=oe*oe*oe*re+3*oe*oe*ee*H+3*oe*ee*ee*j+ee*ee*ee*se,ie.y=oe*oe*oe*U+3*oe*oe*ee*X+3*oe*ee*ee*le+ee*ee*ee*J}function i(re,U){for(var H=/([MLQCZ])([^MLQCZ]*)/g,X,j,le,se,J;X=H.exec(re);){var ee=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(ie){return parseFloat(ie)});switch(X[1]){case"M":se=j=ee[0],J=le=ee[1];break;case"L":(ee[0]!==se||ee[1]!==J)&&U("L",se,J,se=ee[0],J=ee[1]);break;case"Q":{U("Q",se,J,se=ee[2],J=ee[3],ee[0],ee[1]);break}case"C":{U("C",se,J,se=ee[4],J=ee[5],ee[0],ee[1],ee[2],ee[3]);break}case"Z":(se!==j||J!==le)&&U("L",se,J,j,le);break}}}function s(re,U,H){H===void 0&&(H=16);var X={x:0,y:0};i(re,function(j,le,se,J,ee,ie,oe,de,ye){switch(j){case"L":U(le,se,J,ee);break;case"Q":{for(var ge=le,Me=se,fe=1;fe<H;fe++)n(le,se,ie,oe,J,ee,fe/(H-1),X),U(ge,Me,X.x,X.y),ge=X.x,Me=X.y;break}case"C":{for(var Se=le,me=se,Pe=1;Pe<H;Pe++)r(le,se,ie,oe,de,ye,J,ee,Pe/(H-1),X),U(Se,me,X.x,X.y),Se=X.x,me=X.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(re,U){var H=re.getContext?re.getContext("webgl",c):re,X=l.get(H);if(!X){let Se=function(Ge){var We=le[Ge];if(!We&&(We=le[Ge]=H.getExtension(Ge),!We))throw new Error(Ge+" not supported");return We},me=function(Ge,We){var ae=H.createShader(We);return H.shaderSource(ae,Ge),H.compileShader(ae),ae},Pe=function(Ge,We,ae,Z){if(!se[Ge]){var he={},be={},we=H.createProgram();H.attachShader(we,me(We,H.VERTEX_SHADER)),H.attachShader(we,me(ae,H.FRAGMENT_SHADER)),H.linkProgram(we),se[Ge]={program:we,transaction:function(Re){H.useProgram(we),Re({setUniform:function(Oe,qe){for(var Fe=[],Ke=arguments.length-2;Ke-- >0;)Fe[Ke]=arguments[Ke+2];var je=be[qe]||(be[qe]=H.getUniformLocation(we,qe));H["uniform"+Oe].apply(H,[je].concat(Fe))},setAttribute:function(Oe,qe,Fe,Ke,je){var Te=he[Oe];Te||(Te=he[Oe]={buf:H.createBuffer(),loc:H.getAttribLocation(we,Oe),data:null}),H.bindBuffer(H.ARRAY_BUFFER,Te.buf),H.vertexAttribPointer(Te.loc,qe,H.FLOAT,!1,0,0),H.enableVertexAttribArray(Te.loc),j?H.vertexAttribDivisor(Te.loc,Ke):Se("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Te.loc,Ke),je!==Te.data&&(H.bufferData(H.ARRAY_BUFFER,je,Fe),Te.data=je)}})}}}se[Ge].transaction(Z)},ce=function(Ge,We){ee++;try{H.activeTexture(H.TEXTURE0+ee);var ae=J[Ge];ae||(ae=J[Ge]=H.createTexture(),H.bindTexture(H.TEXTURE_2D,ae),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.NEAREST),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MAG_FILTER,H.NEAREST)),H.bindTexture(H.TEXTURE_2D,ae),We(ae,ee)}finally{ee--}},He=function(Ge,We,ae){var Z=H.createFramebuffer();ie.push(Z),H.bindFramebuffer(H.FRAMEBUFFER,Z),H.activeTexture(H.TEXTURE0+We),H.bindTexture(H.TEXTURE_2D,Ge),H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Ge,0);try{ae(Z)}finally{H.deleteFramebuffer(Z),H.bindFramebuffer(H.FRAMEBUFFER,ie[--ie.length-1]||null)}},Be=function(){le={},se={},J={},ee=-1,ie.length=0};var oe=Se,de=me,ye=Pe,ge=ce,Me=He,fe=Be,j=typeof WebGL2RenderingContext<"u"&&H instanceof WebGL2RenderingContext,le={},se={},J={},ee=-1,ie=[];H.canvas.addEventListener("webglcontextlost",function(Ge){Be(),Ge.preventDefault()},!1),l.set(H,X={gl:H,isWebGL2:j,getExtension:Se,withProgram:Pe,withTexture:ce,withTextureFramebuffer:He,handleContextLoss:Be})}U(X)}function p(re,U,H,X,j,le,se,J){se===void 0&&(se=15),J===void 0&&(J=null),d(re,function(ee){var ie=ee.gl,oe=ee.withProgram,de=ee.withTexture;de("copy",function(ye,ge){ie.texImage2D(ie.TEXTURE_2D,0,ie.RGBA,j,le,0,ie.RGBA,ie.UNSIGNED_BYTE,U),oe("copy",o,a,function(Me){var fe=Me.setUniform,Se=Me.setAttribute;Se("aUV",2,ie.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),fe("1i","image",ge),ie.bindFramebuffer(ie.FRAMEBUFFER,J||null),ie.disable(ie.BLEND),ie.colorMask(se&8,se&4,se&2,se&1),ie.viewport(H,X,j,le),ie.scissor(H,X,j,le),ie.drawArrays(ie.TRIANGLES,0,3)})})})}function m(re,U,H){var X=re.width,j=re.height;d(re,function(le){var se=le.gl,J=new Uint8Array(X*j*4);se.readPixels(0,0,X,j,se.RGBA,se.UNSIGNED_BYTE,J),re.width=U,re.height=H,p(se,J,0,0,X,j)})}var x=Object.freeze({__proto__:null,withWebGLContext:d,renderImageData:p,resizeWebGLCanvasWithoutClearing:m});function b(re,U,H,X,j,le){le===void 0&&(le=1);var se=new Uint8Array(re*U),J=X[2]-X[0],ee=X[3]-X[1],ie=[];s(H,function(Se,me,Pe,ce){ie.push({x1:Se,y1:me,x2:Pe,y2:ce,minX:Math.min(Se,Pe),minY:Math.min(me,ce),maxX:Math.max(Se,Pe),maxY:Math.max(me,ce)})}),ie.sort(function(Se,me){return Se.maxX-me.maxX});for(var oe=0;oe<re;oe++)for(var de=0;de<U;de++){var ye=Me(X[0]+J*(oe+.5)/re,X[1]+ee*(de+.5)/U),ge=Math.pow(1-Math.abs(ye)/j,le)/2;ye<0&&(ge=1-ge),ge=Math.max(0,Math.min(255,Math.round(ge*255))),se[de*re+oe]=ge}return se;function Me(Se,me){for(var Pe=1/0,ce=1/0,He=ie.length;He--;){var Be=ie[He];if(Be.maxX+ce<=Se)break;if(Se+ce>Be.minX&&me-ce<Be.maxY&&me+ce>Be.minY){var Ge=M(Se,me,Be.x1,Be.y1,Be.x2,Be.y2);Ge<Pe&&(Pe=Ge,ce=Math.sqrt(Pe))}}return fe(Se,me)&&(ce=-ce),ce}function fe(Se,me){for(var Pe=0,ce=ie.length;ce--;){var He=ie[ce];if(He.maxX<=Se)break;var Be=He.y1>me!=He.y2>me&&Se<(He.x2-He.x1)*(me-He.y1)/(He.y2-He.y1)+He.x1;Be&&(Pe+=He.y1<He.y2?1:-1)}return Pe!==0}}function _(re,U,H,X,j,le,se,J,ee,ie){le===void 0&&(le=1),J===void 0&&(J=0),ee===void 0&&(ee=0),ie===void 0&&(ie=0),S(re,U,H,X,j,le,se,null,J,ee,ie)}function S(re,U,H,X,j,le,se,J,ee,ie,oe){le===void 0&&(le=1),ee===void 0&&(ee=0),ie===void 0&&(ie=0),oe===void 0&&(oe=0);for(var de=b(re,U,H,X,j,le),ye=new Uint8Array(de.length*4),ge=0;ge<de.length;ge++)ye[ge*4+oe]=de[ge];p(se,ye,ee,ie,re,U,1<<3-oe,J)}function M(re,U,H,X,j,le){var se=j-H,J=le-X,ee=se*se+J*J,ie=ee?Math.max(0,Math.min(1,((re-H)*se+(U-X)*J)/ee)):0,oe=re-(H+ie*se),de=U-(X+ie*J);return oe*oe+de*de}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);}",R=new Float32Array([0,0,2,0,0,2]),L=null,k=!1,O={},F=new WeakMap;function B(re){if(!k&&!G(re))throw new Error("WebGL generation not supported")}function Y(re,U,H,X,j,le,se){if(le===void 0&&(le=1),se===void 0&&(se=null),!se&&(se=L,!se)){var J=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!J)throw new Error("OffscreenCanvas or DOM canvas not supported");se=L=J.getContext("webgl",{depth:!1})}B(se);var ee=new Uint8Array(re*U*4);d(se,function(ye){var ge=ye.gl,Me=ye.withTexture,fe=ye.withTextureFramebuffer;Me("readable",function(Se,me){ge.texImage2D(ge.TEXTURE_2D,0,ge.RGBA,re,U,0,ge.RGBA,ge.UNSIGNED_BYTE,null),fe(Se,me,function(Pe){q(re,U,H,X,j,le,ge,Pe,0,0,0),ge.readPixels(0,0,re,U,ge.RGBA,ge.UNSIGNED_BYTE,ee)})})});for(var ie=new Uint8Array(re*U),oe=0,de=0;oe<ee.length;oe+=4)ie[de++]=ee[oe];return ie}function V(re,U,H,X,j,le,se,J,ee,ie){le===void 0&&(le=1),J===void 0&&(J=0),ee===void 0&&(ee=0),ie===void 0&&(ie=0),q(re,U,H,X,j,le,se,null,J,ee,ie)}function q(re,U,H,X,j,le,se,J,ee,ie,oe){le===void 0&&(le=1),ee===void 0&&(ee=0),ie===void 0&&(ie=0),oe===void 0&&(oe=0),B(se);var de=[];s(H,function(ye,ge,Me,fe){de.push(ye,ge,Me,fe)}),de=new Float32Array(de),d(se,function(ye){var ge=ye.gl,Me=ye.isWebGL2,fe=ye.getExtension,Se=ye.withProgram,me=ye.withTexture,Pe=ye.withTextureFramebuffer,ce=ye.handleContextLoss;if(me("rawDistances",function(He,Be){(re!==He._lastWidth||U!==He._lastHeight)&&ge.texImage2D(ge.TEXTURE_2D,0,ge.RGBA,He._lastWidth=re,He._lastHeight=U,0,ge.RGBA,ge.UNSIGNED_BYTE,null),Se("main",A,N,function(Ge){var We=Ge.setAttribute,ae=Ge.setUniform,Z=!Me&&fe("ANGLE_instanced_arrays"),he=!Me&&fe("EXT_blend_minmax");We("aUV",2,ge.STATIC_DRAW,0,R),We("aLineSegment",4,ge.DYNAMIC_DRAW,1,de),ae.apply(void 0,["4f","uGlyphBounds"].concat(X)),ae("1f","uMaxDistance",j),ae("1f","uExponent",le),Pe(He,Be,function(be){ge.enable(ge.BLEND),ge.colorMask(!0,!0,!0,!0),ge.viewport(0,0,re,U),ge.scissor(0,0,re,U),ge.blendFunc(ge.ONE,ge.ONE),ge.blendEquationSeparate(ge.FUNC_ADD,Me?ge.MAX:he.MAX_EXT),ge.clear(ge.COLOR_BUFFER_BIT),Me?ge.drawArraysInstanced(ge.TRIANGLES,0,3,de.length/4):Z.drawArraysInstancedANGLE(ge.TRIANGLES,0,3,de.length/4)})}),Se("post",o,D,function(Ge){Ge.setAttribute("aUV",2,ge.STATIC_DRAW,0,R),Ge.setUniform("1i","tex",Be),ge.bindFramebuffer(ge.FRAMEBUFFER,J),ge.disable(ge.BLEND),ge.colorMask(oe===0,oe===1,oe===2,oe===3),ge.viewport(ee,ie,re,U),ge.scissor(ee,ie,re,U),ge.drawArrays(ge.TRIANGLES,0,3)})}),ge.isContextLost())throw ce(),new Error("webgl context lost")})}function G(re){var U=!re||re===L?O:re.canvas||re,H=F.get(U);if(H===void 0){k=!0;var X=null;try{var j=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],le=Y(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,re);H=le&&j.length===le.length&&le.every(function(se,J){return se===j[J]}),H||(X="bad trial run results",console.info(j,le))}catch(se){H=!1,X=se.message}X&&console.warn("WebGL SDF generation not supported:",X),k=!1,F.set(U,H)}return H}var $=Object.freeze({__proto__:null,generate:Y,generateIntoCanvas:V,generateIntoFramebuffer:q,isSupported:G});function Q(re,U,H,X,j,le){j===void 0&&(j=Math.max(X[2]-X[0],X[3]-X[1])/2),le===void 0&&(le=1);try{return Y.apply($,arguments)}catch(se){return console.info("WebGL SDF generation failed, falling back to JS",se),b.apply(C,arguments)}}function K(re,U,H,X,j,le,se,J,ee,ie){j===void 0&&(j=Math.max(X[2]-X[0],X[3]-X[1])/2),le===void 0&&(le=1),J===void 0&&(J=0),ee===void 0&&(ee=0),ie===void 0&&(ie=0);try{return V.apply($,arguments)}catch(oe){return console.info("WebGL SDF generation failed, falling back to JS",oe),_.apply(C,arguments)}}return e.forEachPathCommand=i,e.generate=Q,e.generateIntoCanvas=K,e.javascript=C,e.pathToLineSegments=s,e.webgl=$,e.webglUtils=x,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function n6e(){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(ce,He){r[ce]=1<<He+1,i[r[ce]]=ce}),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 ce=function(Be){if(n.hasOwnProperty(Be)){var Ge=0;n[Be].split(",").forEach(function(We){var ae=We.split("+"),Z=ae[0],he=ae[1];Z=parseInt(Z,36),he=he?parseInt(he,36):0,d.set(Ge+=Z,r[Be]);for(var be=0;be<he;be++)d.set(++Ge,r[Be])})}};for(var He in n)ce(He)}}function m(ce){return p(),d.get(ce.codePointAt(0))||r.L}function x(ce){return i[m(ce)]}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 _(ce,He){var Be=36,Ge=0,We=new Map,ae=He&&new Map,Z;return ce.split(",").forEach(function he(be){if(be.indexOf("+")!==-1)for(var we=+be;we--;)he(Z);else{Z=be;var ve=be.split(">"),Re=ve[0],Ae=ve[1];Re=String.fromCodePoint(Ge+=parseInt(Re,Be)),Ae=String.fromCodePoint(Ge+=parseInt(Ae,Be)),We.set(Re,Ae),He&&ae.set(Ae,Re)}}),{map:We,reverseMap:ae}}var S,M,C;function A(){if(!S){var ce=_(b.pairs,!0),He=ce.map,Be=ce.reverseMap;S=He,M=Be,C=_(b.canonical,!1).map}}function N(ce){return A(),S.get(ce)||null}function D(ce){return A(),M.get(ce)||null}function R(ce){return A(),C.get(ce)||null}var L=r.L,k=r.R,O=r.EN,F=r.ES,B=r.ET,Y=r.AN,V=r.CS,q=r.B,G=r.S,$=r.ON,Q=r.BN,K=r.NSM,re=r.AL,U=r.LRO,H=r.RLO,X=r.LRE,j=r.RLE,le=r.PDF,se=r.LRI,J=r.RLI,ee=r.FSI,ie=r.PDI;function oe(ce,He){for(var Be=125,Ge=new Uint32Array(ce.length),We=0;We<ce.length;We++)Ge[We]=m(ce[We]);var ae=new Map;function Z(qi,Gs){var _s=Ge[qi];Ge[qi]=Gs,ae.set(_s,ae.get(_s)-1),_s&a&&ae.set(a,ae.get(a)-1),ae.set(Gs,(ae.get(Gs)||0)+1),Gs&a&&ae.set(a,(ae.get(a)||0)+1)}for(var he=new Uint8Array(ce.length),be=new Map,we=[],ve=null,Re=0;Re<ce.length;Re++)ve||we.push(ve={start:Re,end:ce.length-1,level:He==="rtl"?1:He==="ltr"?0:cf(Re,!1)}),Ge[Re]&q&&(ve.end=Re,ve=null);for(var Ae=j|X|H|U|s|ie|le|q,Oe=function(qi){return qi+(qi&1?1:2)},qe=function(qi){return qi+(qi&1?2:1)},Fe=0;Fe<we.length;Fe++){ve=we[Fe];var Ke=[{_level:ve.level,_override:0,_isolate:0}],je=void 0,Te=0,Xe=0,ht=0;ae.clear();for(var ke=ve.start;ke<=ve.end;ke++){var et=Ge[ke];if(je=Ke[Ke.length-1],ae.set(et,(ae.get(et)||0)+1),et&a&&ae.set(a,(ae.get(a)||0)+1),et&Ae)if(et&(j|X)){he[ke]=je._level;var ct=(et===j?qe:Oe)(je._level);ct<=Be&&!Te&&!Xe?Ke.push({_level:ct,_override:0,_isolate:0}):Te||Xe++}else if(et&(H|U)){he[ke]=je._level;var yt=(et===H?qe:Oe)(je._level);yt<=Be&&!Te&&!Xe?Ke.push({_level:yt,_override:et&H?k:L,_isolate:0}):Te||Xe++}else if(et&s){et&ee&&(et=cf(ke+1,!0)===1?J:se),he[ke]=je._level,je._override&&Z(ke,je._override);var lt=(et===J?qe:Oe)(je._level);lt<=Be&&Te===0&&Xe===0?(ht++,Ke.push({_level:lt,_override:0,_isolate:1,_isolInitIndex:ke})):Te++}else if(et&ie){if(Te>0)Te--;else if(ht>0){for(Xe=0;!Ke[Ke.length-1]._isolate;)Ke.pop();var Je=Ke[Ke.length-1]._isolInitIndex;Je!=null&&(be.set(Je,ke),be.set(ke,Je)),Ke.pop(),ht--}je=Ke[Ke.length-1],he[ke]=je._level,je._override&&Z(ke,je._override)}else et&le?(Te===0&&(Xe>0?Xe--:!je._isolate&&Ke.length>1&&(Ke.pop(),je=Ke[Ke.length-1])),he[ke]=je._level):et&q&&(he[ke]=ve.level);else he[ke]=je._level,je._override&&et!==Q&&Z(ke,je._override)}for(var Ee=[],Ze=null,Ie=ve.start;Ie<=ve.end;Ie++){var Ue=Ge[Ie];if(!(Ue&l)){var rt=he[Ie],ut=Ue&s,Dt=Ue===ie;Ze&&rt===Ze._level?(Ze._end=Ie,Ze._endsWithIsolInit=ut):Ee.push(Ze={_start:Ie,_end:Ie,_level:rt,_startsWithPDI:Dt,_endsWithIsolInit:ut})}}for(var Rt=[],St=0;St<Ee.length;St++){var Ht=Ee[St];if(!Ht._startsWithPDI||Ht._startsWithPDI&&!be.has(Ht._start)){for(var en=[Ze=Ht],Ut=void 0;Ze&&Ze._endsWithIsolInit&&(Ut=be.get(Ze._end))!=null;)for(var $e=St+1;$e<Ee.length;$e++)if(Ee[$e]._start===Ut){en.push(Ze=Ee[$e]);break}for(var dt=[],Tt=0;Tt<en.length;Tt++)for(var Bt=en[Tt],Ct=Bt._start;Ct<=Bt._end;Ct++)dt.push(Ct);for(var At=he[dt[0]],Ot=ve.level,cn=dt[0]-1;cn>=0;cn--)if(!(Ge[cn]&l)){Ot=he[cn];break}var Lt=dt[dt.length-1],wt=he[Lt],Zt=ve.level;if(!(Ge[Lt]&s)){for(var Jt=Lt+1;Jt<=ve.end;Jt++)if(!(Ge[Jt]&l)){Zt=he[Jt];break}}Rt.push({_seqIndices:dt,_sosType:Math.max(Ot,At)%2?k:L,_eosType:Math.max(Zt,wt)%2?k:L})}}for(var vn=0;vn<Rt.length;vn++){var Fn=Rt[vn],_e=Fn._seqIndices,nt=Fn._sosType,mt=Fn._eosType,xt=he[_e[0]]&1?k:L;if(ae.get(K))for(var vt=0;vt<_e.length;vt++){var qt=_e[vt];if(Ge[qt]&K){for(var tn=nt,Kt=vt-1;Kt>=0;Kt--)if(!(Ge[_e[Kt]]&l)){tn=Ge[_e[Kt]];break}Z(qt,tn&(s|ie)?$:tn)}}if(ae.get(O))for(var Vt=0;Vt<_e.length;Vt++){var dn=_e[Vt];if(Ge[dn]&O)for(var _n=Vt-1;_n>=-1;_n--){var An=_n===-1?nt:Ge[_e[_n]];if(An&o){An===re&&Z(dn,Y);break}}}if(ae.get(re))for(var rn=0;rn<_e.length;rn++){var Gn=_e[rn];Ge[Gn]&re&&Z(Gn,k)}if(ae.get(F)||ae.get(V))for(var xr=1;xr<_e.length-1;xr++){var sr=_e[xr];if(Ge[sr]&(F|V)){for(var Xn=0,dr=0,un=xr-1;un>=0&&(Xn=Ge[_e[un]],!!(Xn&l));un--);for(var ss=xr+1;ss<_e.length&&(dr=Ge[_e[ss]],!!(dr&l));ss++);Xn===dr&&(Ge[sr]===F?Xn===O:Xn&(O|Y))&&Z(sr,Xn)}}if(ae.get(O))for(var Ln=0;Ln<_e.length;Ln++){var vs=_e[Ln];if(Ge[vs]&O){for(var Rs=Ln-1;Rs>=0&&Ge[_e[Rs]]&(B|l);Rs--)Z(_e[Rs],O);for(Ln++;Ln<_e.length&&Ge[_e[Ln]]&(B|l|O);Ln++)Ge[_e[Ln]]!==O&&Z(_e[Ln],O)}}if(ae.get(B)||ae.get(F)||ae.get(V))for(var Li=0;Li<_e.length;Li++){var ys=_e[Li];if(Ge[ys]&(B|F|V)){Z(ys,$);for(var _r=Li-1;_r>=0&&Ge[_e[_r]]&l;_r--)Z(_e[_r],$);for(var pi=Li+1;pi<_e.length&&Ge[_e[pi]]&l;pi++)Z(_e[pi],$)}}if(ae.get(O))for(var Ps=0,ji=nt;Ps<_e.length;Ps++){var ea=_e[Ps],va=Ge[ea];va&O?ji===L&&Z(ea,L):va&o&&(ji=va)}if(ae.get(a)){var ka=k|O|Y,ec=ka|L,Ml=[];{for(var ya=[],Ds=0;Ds<_e.length;Ds++)if(Ge[_e[Ds]]&a){var tc=ce[_e[Ds]],Qa=void 0;if(N(tc)!==null)if(ya.length<63)ya.push({char:tc,seqIndex:Ds});else break;else if((Qa=D(tc))!==null)for(var Ra=ya.length-1;Ra>=0;Ra--){var Pa=ya[Ra].char;if(Pa===Qa||Pa===D(R(tc))||N(R(Pa))===tc){Ml.push([ya[Ra].seqIndex,Ds]),ya.length=Ra;break}}}Ml.sort(function(qi,Gs){return qi[0]-Gs[0]})}for(var Bc=0;Bc<Ml.length;Bc++){for(var Hc=Ml[Bc],nc=Hc[0],ta=Hc[1],co=!1,Lo=0,Tl=nc+1;Tl<ta;Tl++){var bs=_e[Tl];if(Ge[bs]&ec){co=!0;var Ja=Ge[bs]&ka?k:L;if(Ja===xt){Lo=Ja;break}}}if(co&&!Lo){Lo=nt;for(var el=nc-1;el>=0;el--){var Vc=_e[el];if(Ge[Vc]&ec){var ii=Ge[Vc]&ka?k:L;ii!==xt?Lo=ii:Lo=xt;break}}}if(Lo){if(Ge[_e[nc]]=Ge[_e[ta]]=Lo,Lo!==xt){for(var Wr=nc+1;Wr<_e.length;Wr++)if(!(Ge[_e[Wr]]&l)){m(ce[_e[Wr]])&K&&(Ge[_e[Wr]]=Lo);break}}if(Lo!==xt){for(var na=ta+1;na<_e.length;na++)if(!(Ge[_e[na]]&l)){m(ce[_e[na]])&K&&(Ge[_e[na]]=Lo);break}}}}for(var Sr=0;Sr<_e.length;Sr++)if(Ge[_e[Sr]]&a){for(var Si=Sr,zi=Sr,Kr=nt,Da=Sr-1;Da>=0;Da--)if(Ge[_e[Da]]&l)Si=Da;else{Kr=Ge[_e[Da]]&ka?k:L;break}for(var Cl=mt,rc=Sr+1;rc<_e.length;rc++)if(Ge[_e[rc]]&(a|l))zi=rc;else{Cl=Ge[_e[rc]]&ka?k:L;break}for(var _o=Si;_o<=zi;_o++)Ge[_e[_o]]=Kr===Cl?Kr:xt;Sr=zi}}}for(var gi=ve.start;gi<=ve.end;gi++){var Ch=he[gi],vd=Ge[gi];if(Ch&1?vd&(L|O|Y)&&he[gi]++:vd&k?he[gi]++:vd&(Y|O)&&(he[gi]+=2),vd&l&&(he[gi]=gi===0?ve.level:he[gi-1]),gi===ve.end||m(ce[gi])&(G|q))for(var yd=gi;yd>=0&&m(ce[yd])&c;yd--)he[yd]=ve.level}}return{levels:he,paragraphs:we};function cf(qi,Gs){for(var _s=qi;_s<ce.length;_s++){var El=Ge[_s];if(El&(k|re))return 1;if(El&(q|L)||Gs&&El===ie)return 0;if(El&s){var So=ba(_s);_s=So===-1?ce.length:So}}return 0}function ba(qi){for(var Gs=1,_s=qi+1;_s<ce.length;_s++){var El=Ge[_s];if(El&q)break;if(El&ie){if(--Gs===0)return _s}else El&s&&Gs++}return-1}}var de="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",ye;function ge(){if(!ye){var ce=_(de,!0),He=ce.map,Be=ce.reverseMap;Be.forEach(function(Ge,We){He.set(We,Ge)}),ye=He}}function Me(ce){return ge(),ye.get(ce)||null}function fe(ce,He,Be,Ge){var We=ce.length;Be=Math.max(0,Be==null?0:+Be),Ge=Math.min(We-1,Ge==null?We-1:+Ge);for(var ae=new Map,Z=Be;Z<=Ge;Z++)if(He[Z]&1){var he=Me(ce[Z]);he!==null&&ae.set(Z,he)}return ae}function Se(ce,He,Be,Ge){var We=ce.length;Be=Math.max(0,Be==null?0:+Be),Ge=Math.min(We-1,Ge==null?We-1:+Ge);var ae=[];return He.paragraphs.forEach(function(Z){var he=Math.max(Be,Z.start),be=Math.min(Ge,Z.end);if(he<be){for(var we=He.levels.slice(he,be+1),ve=be;ve>=he&&m(ce[ve])&c;ve--)we[ve]=Z.level;for(var Re=Z.level,Ae=1/0,Oe=0;Oe<we.length;Oe++){var qe=we[Oe];qe>Re&&(Re=qe),qe<Ae&&(Ae=qe|1)}for(var Fe=Re;Fe>=Ae;Fe--)for(var Ke=0;Ke<we.length;Ke++)if(we[Ke]>=Fe){for(var je=Ke;Ke+1<we.length&&we[Ke+1]>=Fe;)Ke++;Ke>je&&ae.push([je+he,Ke+he])}}}),ae}function me(ce,He,Be,Ge){var We=Pe(ce,He,Be,Ge),ae=[].concat(ce);return We.forEach(function(Z,he){ae[he]=(He.levels[Z]&1?Me(ce[Z]):null)||ce[Z]}),ae.join("")}function Pe(ce,He,Be,Ge){for(var We=Se(ce,He,Be,Ge),ae=[],Z=0;Z<ce.length;Z++)ae[Z]=Z;return We.forEach(function(he){for(var be=he[0],we=he[1],ve=ae.slice(be,we+1),Re=ve.length;Re--;)ae[we-Re]=ve[Re]}),ae}return e.closingToOpeningBracket=D,e.getBidiCharType=m,e.getBidiCharTypeName=x,e.getCanonicalBracket=R,e.getEmbeddingLevels=oe,e.getMirroredCharacter=Me,e.getMirroredCharactersMap=fe,e.getReorderSegments=Se,e.getReorderedIndices=Pe,e.getReorderedString=me,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const CZ=/\bvoid\s+main\s*\(\s*\)\s*{/g;function WR(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Or[i];return s?WR(s):r}return t.replace(e,n)}const Wa=[];for(let t=0;t<256;t++)Wa[t]=(t<16?"0":"")+t.toString(16);function r6e(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Wa[t&255]+Wa[t>>8&255]+Wa[t>>16&255]+Wa[t>>24&255]+"-"+Wa[e&255]+Wa[e>>8&255]+"-"+Wa[e>>16&15|64]+Wa[e>>24&255]+"-"+Wa[n&63|128]+Wa[n>>8&255]+"-"+Wa[n>>16&255]+Wa[n>>24&255]+Wa[r&255]+Wa[r>>8&255]+Wa[r>>16&255]+Wa[r>>24&255]).toUpperCase()}const zg=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},i6e=Date.now(),CF=new WeakMap,EF=new Map;let s6e=1e10;function $R(t,e){const n=c6e(e);let r=CF.get(t);if(r||CF.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=EF[p];if(!m){const x=o6e(this,c,e,n);m=EF[p]=x}c.vertexShader=m.vertexShader,c.fragmentShader=m.fragmentShader,zg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-i6e}}),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:s6e++}),d.uuid=r6e(),d.uniforms=zg({},c.uniforms,e.uniforms),d.defines=zg({},c.defines,e.defines),d.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",d.extensions=zg({},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&&(zg(this.extensions,c.extensions),zg(this.defines,c.defines),zg(this.uniforms,ZS.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=$R(t.isDerivedMaterial?t.getDepthMaterial():new uE({depthPacking:LY}),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=$R(t.isDerivedMaterial?t.getDistanceMaterial():new dE,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 o6e(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=WR(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=WR(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,M,C)=>/\battribute\s+vec[23]\s+$/.test(C.substr(0,M))?S:`troika_${S}_${i}`),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=AF(e,i,s,o,a),n=AF(n,i,c,d,p),{vertexShader:e,fragmentShader:n}}function AF(t,e,n,r,i){return(r||i||n)&&(t=t.replace(CZ,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function a6e(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let l6e=0;const NF=new Map;function c6e(t){const e=JSON.stringify(t,a6e);let n=NF.get(e);return n==null&&NF.set(e,n=++l6e),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 u6e(){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 M=[];for(s=e.CFF.readIndex(i,s,M),x.FDArray=[],d=0;d<M.length-1;d++){var C=e.CFF.readDict(i,s+M[d],s+M[d+1]);e.CFF._readFDict(i,C,_),x.FDArray.push(C)}s+=M[M.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 M=S>>4,C=15&S;if(M!=15&&_.push(M),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 M;S=l.tables.length,d.push(b);var C=a.readUshort(i,b);C==0?M=e.cmap.parse0(i,b):C==4?M=e.cmap.parse4(i,b):C==6?M=e.cmap.parse6(i,b):C==12?M=e.cmap.parse12(i,b):console.debug("unknown format: "+C,m,x,b),l.tables.push(M)}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,M=(16&c.flags[d])!=0;S?(c.xs.push(M?a[l]:-a[l]),l++):M?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,M=(32&c.flags[d])!=0,S?(c.ys.push(M?a[l]:-a[l]),l++):M?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 R=o.readShort(a,l);l+=2;var L=o.readShort(a,l);l+=2}else R=o.readInt8(a,l),l++,L=o.readInt8(a,l),l++;2&N?(D.m.tx=R,D.m.ty=L):(D.p1=R,D.p2=L),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 k=o.readUshort(a,l);for(l+=2,c.instr=[],d=0;d<k;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 M=0;M<S;M++){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 R=l.readUshort(i,C);C+=2,m!=0&&(Y=e.GPOS.readValueRecord(i,C,m),C+=2*b),x!=0&&(V=e.GPOS.readValueRecord(i,C,x),C+=2*_),N.push({gid2:R,val1:Y,val2:V})}d.pairsets.push(N)}}if(d.fmt==2){var L=l.readUshort(i,o);o+=2;var k=l.readUshort(i,o);o+=2;var O=l.readUshort(i,o);o+=2;var F=l.readUshort(i,o);for(o+=2,d.classDef1=e._lctf.readClassDef(i,c+L),d.classDef2=e._lctf.readClassDef(i,c+k),d.matrix=[],M=0;M<O;M++){var B=[];for(D=0;D<F;D++){var Y=null,V=null;m!=0&&(Y=e.GPOS.readValueRecord(i,o,m),o+=2*b),x!=0&&(V=e.GPOS.readValueRecord(i,o,x),o+=2*_),B.push({val1:Y,val2:V})}d.matrix.push(B)}}}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 q=l.readUshort(i,o);o+=2;var G=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=q;else if(a.ltype!=q)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,c+G)}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 M=l.readUshort(i,o);o+=2,d.cDef=e._lctf.readClassDef(i,c+M),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 R=l.readUshort(i,o);o+=2;var L=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=R;else if(a.ltype!=R)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+L)}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 M=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[M],R=m+12*c+A;if(b==0)N=a.readUnicode(i,R,C/2);else if(b==3&&_==0)N=a.readUnicode(i,R,C/2);else if(_==0)N=a.readASCII(i,R,C);else if(_==1)N=a.readUnicode(i,R,C/2);else if(_==3)N=a.readUnicode(i,R,C/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=a.readASCII(i,R,C),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var L="p"+b+","+S.toString(16);l[L]==null&&(l[L]={}),l[L][D!==void 0?D:M]=N,l[L]._lang=S}for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==1033)return l[k];for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==0)return l[k];for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==3084)return l[k];for(var k in l)if(l[k].postScriptName!=null)return l[k];for(var k in l){d=k;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,M=0,C=0;C<_;C++){for(;i[s+M+(1+C)]==-1;)M++;b.chain[C]!=i[s+M+(1+C)]&&(S=!1)}if(S){for(i[s]=b.nglyph,C=0;C<_+M;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],R=0;R<D.length;R++){var L=D[R],k=L.input;if(!(k.length>l)){for(S=!0,C=0;C<k.length;C++){var O=e._lctf.getInterval(p.cDef,i[s+1+C]);if(A==-1&&p.cDef[O+2]!=k[C]){S=!1;break}}if(S){var F=L.substLookupRecords;for(x=0;x<F.length;x+=2)F[x],F[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 B=p.lookupRec;for(R=0;R<B.length;R+=2){A=B[R];var Y=a[B[R+1]];e.U._applySubs(i,s+A,Y,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,M=0,C=0,A=0,N=0,D=0,R=0,L=0,k=0,O=0,F=0,B={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,B);var Y=B.val;if(b+=B.size,Y=="o1"||Y=="o18")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,p=!0;else if(Y=="o3"||Y=="o23")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,p=!0;else if(Y=="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(Y=="o5")for(;c.length>0;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);else if(Y=="o6"||Y=="o7")for(var V=c.length,q=Y=="o6",G=0;G<V;G++){var $=c.shift();q?_+=$:S+=$,q=!q,e.U.P.lineTo(l,_,S)}else if(Y=="o8"||Y=="o24"){V=c.length;for(var Q=0;Q+6<=V;)M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,M,C,A,N,_,S),Q+=6;Y=="o24"&&(_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S))}else{if(Y=="o11")break;if(Y=="o1234"||Y=="o1235"||Y=="o1236"||Y=="o1237")Y=="o1234"&&(C=S,A=(M=_+c.shift())+c.shift(),F=N=C+c.shift(),R=N,k=S,_=(L=(D=(O=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,M,C,A,N,O,F),e.U.P.curveTo(l,D,R,L,k,_,S)),Y=="o1235"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),O=A+c.shift(),F=N+c.shift(),D=O+c.shift(),R=F+c.shift(),L=D+c.shift(),k=R+c.shift(),_=L+c.shift(),S=k+c.shift(),c.shift(),e.U.P.curveTo(l,M,C,A,N,O,F),e.U.P.curveTo(l,D,R,L,k,_,S)),Y=="o1236"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),F=N=C+c.shift(),R=N,L=(D=(O=A+c.shift())+c.shift())+c.shift(),k=R+c.shift(),_=L+c.shift(),e.U.P.curveTo(l,M,C,A,N,O,F),e.U.P.curveTo(l,D,R,L,k,_,S)),Y=="o1237"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),O=A+c.shift(),F=N+c.shift(),D=O+c.shift(),R=F+c.shift(),L=D+c.shift(),k=R+c.shift(),Math.abs(L-_)>Math.abs(k-S)?_=L+c.shift():S=k+c.shift(),e.U.P.curveTo(l,M,C,A,N,O,F),e.U.P.curveTo(l,D,R,L,k,_,S));else if(Y=="o14"){if(c.length>0&&!p&&(m=c.shift()+o.nominalWidthX,p=!0),c.length==4){var K=c.shift(),re=c.shift(),U=c.shift(),H=c.shift(),X=e.CFF.glyphBySE(o,U),j=e.CFF.glyphBySE(o,H);e.U._drawCFF(o.CharStrings[X],s,o,a,l),s.x=K,s.y=re,e.U._drawCFF(o.CharStrings[j],s,o,a,l)}x&&(e.U.P.closePath(l),x=!1)}else if(Y=="o19"||Y=="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(Y=="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(Y=="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(Y=="o25"){for(;c.length>6;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,M,C,A,N,_,S)}else if(Y=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)M=_,C=S+c.shift(),_=A=M+c.shift(),S=(N=C+c.shift())+c.shift(),e.U.P.curveTo(l,M,C,A,N,_,S);else if(Y=="o27")for(c.length%2&&(S+=c.shift());c.length>0;)C=S,A=(M=_+c.shift())+c.shift(),N=C+c.shift(),_=A+c.shift(),S=N,e.U.P.curveTo(l,M,C,A,N,_,S);else if(Y=="o10"||Y=="o29"){var le=Y=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var se=c.pop(),J=le.Subrs[se+le.Bias];s.x=_,s.y=S,s.nStems=d,s.haveWidth=p,s.width=m,s.open=x,e.U._drawCFF(J,s,o,a,l),_=s.x,S=s.y,d=s.nStems,p=s.haveWidth,m=s.width,x=s.open}}else if(Y=="o30"||Y=="o31"){var ee=c.length,ie=(Q=0,Y=="o31");for(Q+=ee-(V=-3&ee);Q<V;)ie?(C=S,A=(M=_+c.shift())+c.shift(),S=(N=C+c.shift())+c.shift(),V-Q==5?(_=A+c.shift(),Q++):_=A,ie=!1):(M=_,C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),_=A+c.shift(),V-Q==5?(S=N+c.shift(),Q++):S=N,ie=!0),e.U.P.curveTo(l,M,C,A,N,_,S),Q+=4}else{if((Y+"").charAt(0)=="o")throw console.debug("Unknown operation: "+Y,i),Y;c.push(Y)}}}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 d6e(){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(Y,V){for(var q=new n(31),G=0;G<31;++G)q[G]=V+=1<<Y[G-1];var $=new r(q[30]);for(G=1;G<30;++G)for(var Q=q[G];Q<q[G+1];++Q)$[Q]=Q-q[G]<<5|G;return[q,$]},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(Y,V,q){for(var G=Y.length,$=0,Q=new n(V);$<G;++$)++Q[Y[$]-1];var K,re=new n(V);for($=0;$<V;++$)re[$]=re[$-1]+Q[$-1]<<1;{K=new n(1<<V);var U=15-V;for($=0;$<G;++$)if(Y[$])for(var H=$<<4|Y[$],X=V-Y[$],j=re[Y[$]-1]++<<X,le=j|(1<<X)-1;j<=le;++j)K[m[j]>>>U]=H}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 M=new e(32);for(x=0;x<32;++x)M[x]=5;var C=_(S,9),A=_(M,5),N=function(Y){for(var V=Y[0],q=1;q<Y.length;++q)Y[q]>V&&(V=Y[q]);return V},D=function(Y,V,q){var G=V/8|0;return(Y[G]|Y[G+1]<<8)>>(7&V)&q},R=function(Y,V){var q=V/8|0;return(Y[q]|Y[q+1]<<8|Y[q+2]<<16)>>(7&V)},L=["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"],k=function(Y,V,q){var G=new Error(V||L[Y]);if(G.code=Y,Error.captureStackTrace&&Error.captureStackTrace(G,k),!q)throw G;return G},O=function(Y,V,q){var G=Y.length;if(!G||q&&!q.l&&G<5)return V||new e(0);var $=!V||q,Q=!q||q.i;q||(q={}),V||(V=new e(3*G));var K,re=function(je){var Te=V.length;if(je>Te){var Xe=new e(Math.max(2*Te,je));Xe.set(V),V=Xe}},U=q.f||0,H=q.p||0,X=q.b||0,j=q.l,le=q.d,se=q.m,J=q.n,ee=8*G;do{if(!j){q.f=U=D(Y,H,1);var ie=D(Y,H+1,3);if(H+=3,!ie){var oe=Y[(Be=((K=H)/8|0)+(7&K&&1)+4)-4]|Y[Be-3]<<8,de=Be+oe;if(de>G){Q&&k(0);break}$&&re(X+oe),V.set(Y.subarray(Be,de),X),q.b=X+=oe,q.p=H=8*de;continue}if(ie==1)j=C,le=A,se=9,J=5;else if(ie==2){var ye=D(Y,H,31)+257,ge=D(Y,H+10,15)+4,Me=ye+D(Y,H+5,31)+1;H+=14;for(var fe=new e(Me),Se=new e(19),me=0;me<ge;++me)Se[o[me]]=D(Y,H+3*me,7);H+=3*ge;var Pe=N(Se),ce=(1<<Pe)-1,He=_(Se,Pe);for(me=0;me<Me;){var Be,Ge=He[D(Y,H,ce)];if(H+=15&Ge,(Be=Ge>>>4)<16)fe[me++]=Be;else{var We=0,ae=0;for(Be==16?(ae=3+D(Y,H,3),H+=2,We=fe[me-1]):Be==17?(ae=3+D(Y,H,7),H+=3):Be==18&&(ae=11+D(Y,H,127),H+=7);ae--;)fe[me++]=We}}var Z=fe.subarray(0,ye),he=fe.subarray(ye);se=N(Z),J=N(he),j=_(Z,se),le=_(he,J)}else k(1);if(H>ee){Q&&k(0);break}}$&&re(X+131072);for(var be=(1<<se)-1,we=(1<<J)-1,ve=H;;ve=H){var Re=(We=j[R(Y,H)&be])>>>4;if((H+=15&We)>ee){Q&&k(0);break}if(We||k(2),Re<256)V[X++]=Re;else{if(Re==256){ve=H,j=null;break}var Ae=Re-254;if(Re>264){var Oe=i[me=Re-257];Ae=D(Y,H,(1<<Oe)-1)+c[me],H+=Oe}var qe=le[R(Y,H)&we],Fe=qe>>>4;if(qe||k(3),H+=15&qe,he=p[Fe],Fe>3&&(Oe=s[Fe],he+=R(Y,H)&(1<<Oe)-1,H+=Oe),H>ee){Q&&k(0);break}$&&re(X+131072);for(var Ke=X+Ae;X<Ke;X+=4)V[X]=V[X-he],V[X+1]=V[X+1-he],V[X+2]=V[X+2-he],V[X+3]=V[X+3-he];X=Ke}}q.l=j,q.p=ve,q.b=X,j&&(U=1,q.m=se,q.d=le,q.n=J)}while(!U);return X==V.length?V:(function(je,Te,Xe){(Xe==null||Xe>je.length)&&(Xe=je.length);var ht=new(je instanceof n?n:je instanceof r?r:e)(Xe-Te);return ht.set(je.subarray(Te,Xe)),ht})(V,0,X)},F=new e(0),B=typeof TextDecoder<"u"&&new TextDecoder;try{B.decode(F,{stream:!0})}catch{}return t.convert_streams=function(Y){var V=new DataView(Y),q=0;function G(){var ye=V.getUint16(q);return q+=2,ye}function $(){var ye=V.getUint32(q);return q+=4,ye}function Q(ye){oe.setUint16(de,ye),de+=2}function K(ye){oe.setUint32(de,ye),de+=4}for(var re={signature:$(),flavor:$(),length:$(),numTables:G(),reserved:G(),totalSfntSize:$(),majorVersion:G(),minorVersion:G(),metaOffset:$(),metaLength:$(),metaOrigLength:$(),privOffset:$(),privLength:$()},U=0;Math.pow(2,U)<=re.numTables;)U++;U--;for(var H=16*Math.pow(2,U),X=16*re.numTables-H,j=12,le=[],se=0;se<re.numTables;se++)le.push({tag:$(),offset:$(),compLength:$(),origLength:$(),origChecksum:$()}),j+=16;var J,ee=new Uint8Array(12+16*le.length+le.reduce((function(ye,ge){return ye+ge.origLength+4}),0)),ie=ee.buffer,oe=new DataView(ie),de=0;return K(re.flavor),Q(re.numTables),Q(H),Q(U),Q(X),le.forEach((function(ye){K(ye.tag),K(ye.origChecksum),K(j),K(ye.origLength),ye.outOffset=j,(j+=ye.origLength)%4!=0&&(j+=4-j%4)})),le.forEach((function(ye){var ge,Me=Y.slice(ye.offset,ye.offset+ye.compLength);if(ye.compLength!=ye.origLength){var fe=new Uint8Array(ye.origLength);ge=new Uint8Array(Me,2),O(ge,fe)}else fe=new Uint8Array(Me);ee.set(fe,ye.outOffset);var Se=0;(j=ye.outOffset+ye.origLength)%4!=0&&(Se=4-j%4),ee.set(new Uint8Array(Se).buffer,ye.outOffset+ye.origLength),J=j+Se})),ie.slice(0,J)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function f6e(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(L){if(!d){const k={R:s,L:i,D:o,C:l,U:c,T:a};d=new Map;for(let O in r){let F=0;r[O].split(",").forEach(B=>{let[Y,V]=B.split("+");Y=parseInt(Y,36),V=V?parseInt(V,36):0,d.set(F+=Y,k[O]);for(let q=V;q--;)d.set(++F,k[O])})}}return d.get(L)||c}const m=1,x=2,b=3,_=4,S=[null,"isol","init","fina","medi"];function M(L){const k=new Uint8Array(L.length);let O=c,F=m,B=-1;for(let Y=0;Y<L.length;Y++){const V=L.codePointAt(Y);let q=p(V)|0,G=m;q&a||(O&(i|o|l)?q&(s|o|l)?(G=b,(F===m||F===b)&&k[B]++):q&(i|c)&&(F===x||F===_)&&k[B]--:O&(s|c)&&(F===x||F===_)&&k[B]--,F=k[Y]=G,O=q,B=Y,V>65535&&Y++)}return k}function C(L,k){const O=[];for(let B=0;B<k.length;B++){const Y=k.codePointAt(B);Y>65535&&B++,O.push(t.U.codeToGlyph(L,Y))}const F=L.GSUB;if(F){const{lookupList:B,featureList:Y}=F;let V;const q=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,G=[];Y.forEach($=>{if(q.test($.tag))for(let Q=0;Q<$.tab.length;Q++){if(G[$.tab[Q]])continue;G[$.tab[Q]]=!0;const K=B[$.tab[Q]],re=/^(isol|init|fina|medi)$/.test($.tag);re&&!V&&(V=M(k));for(let U=0;U<O.length;U++)(!V||!re||S[V[U]]===$.tag)&&t.U._applySubs(O,U,K,B)}})}return O}function A(L,k){const O=new Int16Array(k.length*3);let F=0;for(;F<k.length;F++){const q=k[F];if(q===-1)continue;O[F*3+2]=L.hmtx.aWidth[q];const G=L.GPOS;if(G){const $=G.lookupList;for(let Q=0;Q<$.length;Q++){const K=$[Q];for(let re=0;re<K.tabs.length;re++){const U=K.tabs[re];if(K.ltype===1){if(t._lctf.coverageIndex(U.coverage,q)!==-1&&U.pos){V(U.pos,F);break}}else if(K.ltype===2){let H=null,X=B();if(X!==-1){const j=t._lctf.coverageIndex(U.coverage,k[X]);if(j!==-1){if(U.fmt===1){const le=U.pairsets[j];for(let se=0;se<le.length;se++)le[se].gid2===q&&(H=le[se])}else if(U.fmt===2){const le=t.U._getGlyphClass(k[X],U.classDef1),se=t.U._getGlyphClass(q,U.classDef2);H=U.matrix[le][se]}if(H){H.val1&&V(H.val1,X),H.val2&&V(H.val2,F);break}}}}else if(K.ltype===4){const H=t._lctf.coverageIndex(U.markCoverage,q);if(H!==-1){const X=B(Y),j=X===-1?-1:t._lctf.coverageIndex(U.baseCoverage,k[X]);if(j!==-1){const le=U.markArray[H],se=U.baseArray[j][le.markClass];O[F*3]=se.x-le.x+O[X*3]-O[X*3+2],O[F*3+1]=se.y-le.y+O[X*3+1];break}}}else if(K.ltype===6){const H=t._lctf.coverageIndex(U.mark1Coverage,q);if(H!==-1){const X=B();if(X!==-1){const j=k[X];if(N(L,j)===3){const le=t._lctf.coverageIndex(U.mark2Coverage,j);if(le!==-1){const se=U.mark1Array[H],J=U.mark2Array[le][se.markClass];O[F*3]=J.x-se.x+O[X*3]-O[X*3+2],O[F*3+1]=J.y-se.y+O[X*3+1];break}}}}}}}}else if(L.kern&&!L.cff){const $=B();if($!==-1){const Q=L.kern.glyph1.indexOf(k[$]);if(Q!==-1){const K=L.kern.rval[Q].glyph2.indexOf(q);K!==-1&&(O[$*3+2]+=L.kern.rval[Q].vals[K])}}}}return O;function B(q){for(let G=F-1;G>=0;G--)if(k[G]!==-1&&(!q||q(k[G])))return G;return-1}function Y(q){return N(L,q)===1}function V(q,G){for(let $=0;$<3;$++)O[G*3+$]+=q[$]||0}}function N(L,k){const O=L.GDEF&&L.GDEF.glyphClassDef;return O?t.U._getGlyphClass(k,O):0}function D(...L){for(let k=0;k<L.length;k++)if(typeof L[k]=="number")return L[k]}function R(L){const k=Object.create(null),O=L["OS/2"],F=L.hhea,B=L.head.unitsPerEm,Y=D(O&&O.sTypoAscender,F&&F.ascender,B),V={unitsPerEm:B,ascender:Y,descender:D(O&&O.sTypoDescender,F&&F.descender,0),capHeight:D(O&&O.sCapHeight,Y),xHeight:D(O&&O.sxHeight,Y),lineGap:D(O&&O.sTypoLineGap,F&&F.lineGap),supportsCodePoint(q){return t.U.codeToGlyph(L,q)>0},forEachGlyph(q,G,$,Q){let K=0;const re=1/V.unitsPerEm*G,U=C(L,q);let H=0;const X=A(L,U);return U.forEach((j,le)=>{if(j!==-1){let se=k[j];if(!se){const{cmds:J,crds:ee}=t.U.glyphToPath(L,j);let ie="",oe=0;for(let fe=0,Se=J.length;fe<Se;fe++){const me=n[J[fe]];ie+=J[fe];for(let Pe=1;Pe<=me;Pe++)ie+=(Pe>1?",":"")+ee[oe++]}let de,ye,ge,Me;if(ee.length){de=ye=1/0,ge=Me=-1/0;for(let fe=0,Se=ee.length;fe<Se;fe+=2){let me=ee[fe],Pe=ee[fe+1];me<de&&(de=me),Pe<ye&&(ye=Pe),me>ge&&(ge=me),Pe>Me&&(Me=Pe)}}else de=ge=ye=Me=0;se=k[j]={index:j,advanceWidth:L.hmtx.aWidth[j],xMin:de,yMin:ye,xMax:ge,yMax:Me,path:ie}}Q.call(null,se,K+X[le*3]*re,X[le*3+1]*re,H),K+=X[le*3+2]*re,$&&(K+=$*G)}H+=q.codePointAt(H)>65535?2:1}),K}};return V}return function(k){const O=new Uint8Array(k,0,4),F=t._bin.readASCII(O,0,4);if(F==="wOFF")k=e(k);else if(F==="wOF2")throw new Error("woff2 fonts not supported");return R(t.parse(k)[0])}}const h6e=Qy({name:"Typr Font Parser",dependencies:[u6e,d6e,f6e],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 p6e(){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 R=D.split(":");N.buckets.set(parseInt(R[0],36),parseInt(R[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(R){return R&i})(A).toString(16),D=(function(R){return(R&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+D+".json"}function o(A,N){var D=A&r,R=N.codePointAt(D/6|0);return((R=(R||48)-48)&1<<D%6)!=0}function a(A,N){var D;(D=A,D.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(R){return R.split("-").map((function(L){return parseInt(L.trim(),16)}))}))).forEach((function(R){var L=R[0],k=R[1];k===void 0&&(k=L),N(L,k)}))}function l(A,N){a(A,(function(D,R){for(var L=D;L<=R;L++)N(L)}))}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(R){for(var L in R)return L})(A)}function M(A,N){var D=N;if(!A.includes(D)){D=1/0;for(var R=0;R<A.length;R++)Math.abs(A[R]-N)<Math.abs(D-N)&&(D=A[R])}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,R=N.lang;R===void 0&&(R=new RegExp("\\p{Script=Hangul}","u").test(D=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(D)?"ja":"en");var L=N.category;L===void 0&&(L="sans-serif");var k=N.style;k===void 0&&(k="normal");var O=N.weight;O===void 0&&(O=400);var F=(N.dataUrl||m).replace(/\/$/g,""),B=new Map,Y=new Uint8Array(A.length),V={},q={},G=new Array(A.length),$=new Map,Q=!1;function K(H){var X=_.get(H);return X||(X=fetch(F+"/"+H).then((function(j){if(!j.ok)throw new Error(j.statusText);return j.json().then((function(le){if(!Array.isArray(le)||le[0]!==1)throw new Error("Incorrect schema version; need 1, got "+le[0]);return le[1]}))})).catch((function(j){if(F!==m)return Q||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+F+'", trying default CDN. '+j.message),Q=!0),F=m,_.delete(H),K(H);throw j})),_.set(H,X)),X}for(var re=function(H){var X=A.codePointAt(H),j=s(X);G[H]=j,c[j]||$.has(j)||$.set(j,K(j).then((function(le){c[j]=le}))),X>65535&&(H++,U=H)},U=0;U<A.length;U++)re(U);return Promise.all($.values()).then((function(){$.clear();for(var H=function(j){var le=A.codePointAt(j),se=null,J=c[G[j]],ee=void 0;for(var ie in J){var oe=q[ie];if(oe===void 0&&(oe=q[ie]=new RegExp(ie).test(R||"en")),oe){for(var de in ee=ie,J[ie])if(o(le,J[ie][de])){se=de;break}break}}if(!se){e:for(var ye in J)if(ye!==ee){for(var ge in J[ye])if(o(le,J[ye][ge])){se=ge;break e}}}se||(console.debug("No font coverage for U+"+le.toString(16)),se="latin"),G[j]=se,d[se]||$.has(se)||$.set(se,K("font-meta/"+se+".json").then((function(Me){d[se]=Me}))),le>65535&&(j++,X=j)},X=0;X<A.length;X++)H(X);return Promise.all($.values())})).then((function(){for(var H,X=null,j=0;j<A.length;j++){var le=A.codePointAt(j);if(X&&(C(le)||x(X).has(le)))Y[j]=Y[j-1];else{X=d[G[j]];var se=V[X.id];if(!se){var J=X.typeforms,ee=S(J,L,"sans-serif"),ie=S(J[ee],k,"normal"),oe=M((H=J[ee])===null||H===void 0?void 0:H[ie],O);se=V[X.id]=F+"/font-files/"+X.id+"/"+ee+"."+ie+"."+oe+".woff"}var de=B.get(se);de==null&&(de=B.size,B.set(se,de)),Y[j]=de}le>65535&&(j++,Y[j]=Y[j-1])}return{fontUrls:Array.from(B.keys()),chars:Y}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function m6e(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 L=0;(function k(O=0){for(let F=O,B=o.length;F<B;F++){const Y=o.codePointAt(F);if(L===1&&b[x[F-1]].supportsCodePoint(Y)||F>0&&/\s/.test(o[F]))x[F]=x[F-1],L===2&&(S[S.length-1][1]=F);else for(let V=x[F],q=c.length;V<=q;V++)if(V===q){const G=L===2?S[S.length-1]:S[S.length]=[F,F];G[1]=F,L=2}else{x[F]=V;const{src:G,unicodeRange:$}=c[V];if(!$||A(Y,$)){const Q=n[G];if(!Q){s(G,()=>{k(F)});return}if(Q.supportsCodePoint(Y)){let K=_.get(Q);typeof K!="number"&&(K=b.length,b.push(Q),_.set(Q,K)),x[F]=K,L=1;break}}}Y>65535&&F+1<B&&(x[F+1]=x[F],F++,L===2&&(S[S.length-1][1]=F))}M()})()}else S.push([0,o.length-1]),M();function M(){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:R})=>{const L=b.length;let k=0;S.forEach(F=>{for(let B=0,Y=F[1]-F[0];B<=Y;B++)x[F[0]+B]=R[k++]+L;k++});let O=0;D.forEach((F,B)=>{s(F,Y=>{b[B+L]=Y,++O===D.length&&C()})})})}else C()}function C(){a({chars:x,fonts:b})}function A(N,D){for(let R=0;R<D.length;R++){const[L,k=L]=D[R];if(L<=N&&N<=k)return!0}return!1}}}const g6e=Qy({name:"FontResolver",dependencies:[m6e,h6e,p6e],init(t,e,n){return t(e,n())}});function x6e(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:M,weight:C,preResolvedFonts:A,unicodeFontsURL:N},D){const R=({chars:L,fonts:k})=>{let O,F;const B=[];for(let Y=0;Y<L.length;Y++)L[Y]!==F?(F=L[Y],B.push(O={start:Y,end:Y,fontObj:k[L[Y]]})):O.end=Y;D(B)};A?R(A):t(b,R,{lang:_,fonts:S,style:M,weight:C,unicodeFontsURL:N})}function a({text:b="",font:_,lang:S,sdfGlyphSize:M=64,fontSize:C=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:D=0,lineHeight:R="normal",maxWidth:L=1/0,direction:k,textAlign:O="left",textIndent:F=0,whiteSpace:B="normal",overflowWrap:Y="normal",anchorX:V=0,anchorY:q=0,metricsOnly:G=!1,unicodeFontsURL:$,preResolvedFonts:Q=null,includeCaretPositions:K=!1,chunkedBoundsSize:re=8192,colorRanges:U=null},H){const X=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,L=+L,R=R||"normal",F=+F,o({text:b,lang:S,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:$,preResolvedFonts:Q},le=>{j.fontLoad=p()-X;const se=isFinite(L);let J=null,ee=null,ie=null,oe=null,de=null,ye=null,ge=null,Me=null,fe=0,Se=0,me=B!=="nowrap";const Pe=new Map,ce=p();let He=F,Be=0,Ge=new m;const We=[Ge];le.forEach(we=>{const{fontObj:ve}=we,{ascender:Re,descender:Ae,unitsPerEm:Oe,lineGap:qe,capHeight:Fe,xHeight:Ke}=ve;let je=Pe.get(ve);if(!je){const et=C/Oe,ct=R==="normal"?(Re-Ae+qe)*et:R*C,yt=(ct-(Re-Ae)*et)/2,lt=Math.min(ct,(Re-Ae)*et),Je=(Re+Ae)/2*et+lt/2;je={index:Pe.size,src:ve.src,fontObj:ve,fontSizeMult:et,unitsPerEm:Oe,ascender:Re*et,descender:Ae*et,capHeight:Fe*et,xHeight:Ke*et,lineHeight:ct,baseline:-yt-Re*et,caretTop:Je,caretBottom:Je-lt},Pe.set(ve,je)}const{fontSizeMult:Te}=je,Xe=b.slice(we.start,we.end+1);let ht,ke;ve.forEachGlyph(Xe,C,D,(et,ct,yt,lt)=>{ct+=Be,lt+=we.start,ht=ct,ke=et;const Je=b.charAt(lt),Ee=et.advanceWidth*Te,Ze=Ge.count;let Ie;if("isEmpty"in et||(et.isWhitespace=!!Je&&new RegExp(i).test(Je),et.canBreakAfter=!!Je&&s.test(Je),et.isEmpty=et.xMin===et.xMax||et.yMin===et.yMax||r.test(Je)),!et.isWhitespace&&!et.isEmpty&&Se++,me&&se&&!et.isWhitespace&&ct+Ee+He>L&&Ze){if(Ge.glyphAt(Ze-1).glyphObj.canBreakAfter)Ie=new m,He=-ct;else for(let rt=Ze;rt--;)if(rt===0&&Y==="break-word"){Ie=new m,He=-ct;break}else if(Ge.glyphAt(rt).glyphObj.canBreakAfter){Ie=Ge.splitAt(rt+1);const ut=Ie.glyphAt(0).x;He-=ut;for(let Dt=Ie.count;Dt--;)Ie.glyphAt(Dt).x-=ut;break}Ie&&(Ge.isSoftWrapped=!0,Ge=Ie,We.push(Ge),fe=L)}let Ue=Ge.glyphAt(Ge.count);Ue.glyphObj=et,Ue.x=ct+He,Ue.y=yt,Ue.width=Ee,Ue.charIndex=lt,Ue.fontData=je,Je===`
`&&(Ge=new m,We.push(Ge),He=-(ct+Ee+D*C)+F)}),Be=ht+ke.advanceWidth*Te+D*C});let ae=0;We.forEach(we=>{let ve=!0;for(let Re=we.count;Re--;){const Ae=we.glyphAt(Re);ve&&!Ae.glyphObj.isWhitespace&&(we.width=Ae.x+Ae.width,we.width>fe&&(fe=we.width),ve=!1);let{lineHeight:Oe,capHeight:qe,xHeight:Fe,baseline:Ke}=Ae.fontData;Oe>we.lineHeight&&(we.lineHeight=Oe);const je=Ke-we.baseline;je<0&&(we.baseline+=je,we.cap+=je,we.ex+=je),we.cap=Math.max(we.cap,we.baseline+qe),we.ex=Math.max(we.ex,we.baseline+Fe)}we.baseline-=ae,we.cap-=ae,we.ex-=ae,ae+=we.lineHeight});let Z=0,he=0;if(V&&(typeof V=="number"?Z=-V:typeof V=="string"&&(Z=-fe*(V==="left"?0:V==="center"?.5:V==="right"?1:c(V)))),q&&(typeof q=="number"?he=-q:typeof q=="string"&&(he=q==="top"?0:q==="top-baseline"?-We[0].baseline:q==="top-cap"?-We[0].cap:q==="top-ex"?-We[0].ex:q==="middle"?ae/2:q==="bottom"?ae:q==="bottom-baseline"?-We[We.length-1].baseline:c(q)*ae)),!G){const we=e.getEmbeddingLevels(b,k);J=new Uint16Array(Se),ee=new Uint8Array(Se),ie=new Float32Array(Se*2),oe={},ge=[1/0,1/0,-1/0,-1/0],Me=[],K&&(ye=new Float32Array(b.length*4)),U&&(de=new Uint8Array(Se*3));let ve=0,Re=-1,Ae=-1,Oe,qe;if(We.forEach((Fe,Ke)=>{let{count:je,width:Te}=Fe;if(je>0){let Xe=0;for(let lt=je;lt--&&Fe.glyphAt(lt).glyphObj.isWhitespace;)Xe++;let ht=0,ke=0;if(O==="center")ht=(fe-Te)/2;else if(O==="right")ht=fe-Te;else if(O==="justify"&&Fe.isSoftWrapped){let lt=0;for(let Je=je-Xe;Je--;)Fe.glyphAt(Je).glyphObj.isWhitespace&&lt++;ke=(fe-Te)/lt}if(ke||ht){let lt=0;for(let Je=0;Je<je;Je++){let Ee=Fe.glyphAt(Je);const Ze=Ee.glyphObj;Ee.x+=ht+lt,ke!==0&&Ze.isWhitespace&&Je<je-Xe&&(lt+=ke,Ee.width+=ke)}}const et=e.getReorderSegments(b,we,Fe.glyphAt(0).charIndex,Fe.glyphAt(Fe.count-1).charIndex);for(let lt=0;lt<et.length;lt++){const[Je,Ee]=et[lt];let Ze=1/0,Ie=-1/0;for(let Ue=0;Ue<je;Ue++)if(Fe.glyphAt(Ue).charIndex>=Je){let rt=Ue,ut=Ue;for(;ut<je;ut++){let Dt=Fe.glyphAt(ut);if(Dt.charIndex>Ee)break;ut<je-Xe&&(Ze=Math.min(Ze,Dt.x),Ie=Math.max(Ie,Dt.x+Dt.width))}for(let Dt=rt;Dt<ut;Dt++){const Rt=Fe.glyphAt(Dt);Rt.x=Ie-(Rt.x+Rt.width-Ze)}break}}let ct;const yt=lt=>ct=lt;for(let lt=0;lt<je;lt++){const Je=Fe.glyphAt(lt);ct=Je.glyphObj;const Ee=ct.index,Ze=we.levels[Je.charIndex]&1;if(Ze){const Ie=e.getMirroredCharacter(b[Je.charIndex]);Ie&&Je.fontData.fontObj.forEachGlyph(Ie,0,0,yt)}if(K){const{charIndex:Ie,fontData:Ue}=Je,rt=Je.x+Z,ut=Je.x+Je.width+Z;ye[Ie*4]=Ze?ut:rt,ye[Ie*4+1]=Ze?rt:ut,ye[Ie*4+2]=Fe.baseline+Ue.caretBottom+he,ye[Ie*4+3]=Fe.baseline+Ue.caretTop+he;const Dt=Ie-Re;Dt>1&&d(ye,Re,Dt),Re=Ie}if(U){const{charIndex:Ie}=Je;for(;Ie>Ae;)Ae++,U.hasOwnProperty(Ae)&&(qe=U[Ae])}if(!ct.isWhitespace&&!ct.isEmpty){const Ie=ve++,{fontSizeMult:Ue,src:rt,index:ut}=Je.fontData,Dt=oe[rt]||(oe[rt]={});Dt[Ee]||(Dt[Ee]={path:ct.path,pathBounds:[ct.xMin,ct.yMin,ct.xMax,ct.yMax]});const Rt=Je.x+Z,St=Je.y+Fe.baseline+he;ie[Ie*2]=Rt,ie[Ie*2+1]=St;const Ht=Rt+ct.xMin*Ue,en=St+ct.yMin*Ue,Ut=Rt+ct.xMax*Ue,$e=St+ct.yMax*Ue;Ht<ge[0]&&(ge[0]=Ht),en<ge[1]&&(ge[1]=en),Ut>ge[2]&&(ge[2]=Ut),$e>ge[3]&&(ge[3]=$e),Ie%re===0&&(Oe={start:Ie,end:Ie,rect:[1/0,1/0,-1/0,-1/0]},Me.push(Oe)),Oe.end++;const dt=Oe.rect;if(Ht<dt[0]&&(dt[0]=Ht),en<dt[1]&&(dt[1]=en),Ut>dt[2]&&(dt[2]=Ut),$e>dt[3]&&(dt[3]=$e),J[Ie]=Ee,ee[Ie]=ut,U){const Tt=Ie*3;de[Tt]=qe>>16&255,de[Tt+1]=qe>>8&255,de[Tt+2]=qe&255}}}}}),ye){const Fe=b.length-Re;Fe>1&&d(ye,Re,Fe)}}const be=[];Pe.forEach(({index:we,src:ve,unitsPerEm:Re,ascender:Ae,descender:Oe,lineHeight:qe,capHeight:Fe,xHeight:Ke})=>{be[we]={src:ve,unitsPerEm:Re,ascender:Ae,descender:Oe,lineHeight:qe,capHeight:Fe,xHeight:Ke}}),j.typesetting=p()-ce,H({glyphIds:J,glyphFontIndices:ee,glyphPositions:ie,glyphData:oe,fontData:be,caretPositions:ye,glyphColors:de,chunkedBounds:Me,fontSize:C,topBaseline:he+We[0].baseline,blockBounds:[Z,he-ae,Z+fe,he],visibleBounds:ge,timings:j})})}function l(b,_){a({...b,metricsOnly:!0},S=>{const[M,C,A,N]=S.blockBounds;_({width:A-M,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 M=b[_*4],C=b[_*4+1],A=b[_*4+2],N=b[_*4+3],D=(C-M)/S;for(let R=0;R<S;R++){const L=(_+R)*4;b[L]=M+D*R,b[L+1]=M+D*(R+1),b[L+2]=A,b[L+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,M)=>(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 hx=()=>(self.performance||Date).now(),yE=TZ();let kF;function v6e(t,e,n,r,i,s,o,a,l,c,d=!0){return d?b6e(t,e,n,r,i,s,o,a,l,c).then(null,p=>(kF||(console.warn("WebGL SDF generation failed, falling back to JS",p),kF=!0),PF(t,e,n,r,i,s,o,a,l,c))):PF(t,e,n,r,i,s,o,a,l,c)}const g2=[],y6e=5;let qR=0;function EZ(){const t=hx();for(;g2.length&&hx()-t<y6e;)g2.shift()();qR=g2.length?setTimeout(EZ,0):0}const b6e=(...t)=>new Promise((e,n)=>{g2.push(()=>{const r=hx();try{yE.webgl.generateIntoCanvas(...t),e({timing:hx()-r})}catch(i){n(i)}}),qR||(qR=setTimeout(EZ,0))}),_6e=4,S6e=2e3,RF={};let w6e=0;function PF(t,e,n,r,i,s,o,a,l,c){const d="TroikaTextSDFGenerator_JS_"+w6e++%_6e;let p=RF[d];return p||(p=RF[d]={workerModule:Qy({name:d,workerId:d,dependencies:[TZ,hx],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=hx(),_=new Uint8Array(m.length*4);for(let S=0;S<m.length;S++)_[S*4+c]=m[S];return yE.webglUtils.renderImageData(o,_,a,l,t,e,1<<3-c),x+=hx()-b,--p.requests===0&&(p.idleTimer=setTimeout(()=>{e6e(d)},S6e)),{timing:x}})}function M6e(t){t._warm||(yE.webgl.isSupported(t),t._warm=!0)}const T6e=yE.webglUtils.resizeWebGLCanvasWithoutClearing,B_={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},C6e=new Nn;function h1(){return(self.performance||Date).now()}const DF=Object.create(null);function AZ(t,e){t=N6e({},t);const n=h1(),r=[];if(t.font&&r.push({label:"user",src:k6e(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||B_.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||B_.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=C6e.set(b).getHex()),m[x]=b}t.colorRanges=m}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=B_,{sdfGlyphSize:o}=t,a=i/o*4;let l=DF[o];if(!l){const m=document.createElement("canvas");m.width=i,m.height=o*256/a,l=DF[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:m,sdfTexture:new so(m,void 0,void 0,void 0,rs,rs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,E6e(l)}const{sdfTexture:c,sdfCanvas:d}=l;RZ(t).then(m=>{const{glyphIds:x,glyphFontIndices:b,fontData:_,glyphPositions:S,fontSize:M,timings:C}=m,A=[],N=new Float32Array(x.length*4);let D=0,R=0;const L=h1(),k=_.map(V=>{let q=l.glyphsByFont.get(V.src);return q||l.glyphsByFont.set(V.src,q=new Map),q});x.forEach((V,q)=>{const G=b[q],{src:$,unitsPerEm:Q}=_[G];let K=k[G].get(V);if(!K){const{path:j,pathBounds:le}=m.glyphData[$][V],se=Math.max(le[2]-le[0],le[3]-le[1])/o*(B_.sdfMargin*o+.5),J=l.glyphCount++,ee=[le[0]-se,le[1]-se,le[2]+se,le[3]+se];k[G].set(V,K={path:j,atlasIndex:J,sdfViewBox:ee}),A.push(K)}const{sdfViewBox:re}=K,U=S[R++],H=S[R++],X=M/Q;N[D++]=U+re[0]*X,N[D++]=H+re[1]*X,N[D++]=U+re[2]*X,N[D++]=H+re[3]*X,x[q]=K.atlasIndex}),C.quads=(C.quads||0)+(h1()-L);const O=h1();C.sdf={};const F=d.height,B=Math.ceil(l.glyphCount/a),Y=Math.pow(2,Math.ceil(Math.log2(B*o)));Y>F&&(console.info(`Increasing SDF texture size ${F}->${Y}`),T6e(d,i,Y),c.dispose()),Promise.all(A.map(V=>NZ(V,l,t.gpuAccelerateSDF).then(({timing:q})=>{C.sdf[V.atlasIndex]=q}))).then(()=>{A.length&&!l.contextLost&&(kZ(l),c.needsUpdate=!0),C.sdfTotal=h1()-O,C.total=h1()-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||M6e(d)})}function NZ({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}=B_,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 v6e(r,r,t,n,c,l,i,p,m,x,o)}function E6e(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(NZ(s,t,!0))})}),Promise.all(r).then(()=>{kZ(t),t.sdfTexture.needsUpdate=!0})})}function A6e({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;AZ({font:t,sdfGlyphSize:n,text:i},r)}function N6e(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let qM;function k6e(t){return qM||(qM=typeof document>"u"?{}:document.createElement("a")),qM.href=t,qM.href}function kZ(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 R6e=Qy({name:"Typesetter",dependencies:[x6e,g6e,n6e],init(t,e,n){return t(e,n())}}),RZ=Qy({name:"Typesetter",dependencies:[R6e],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}});RZ.onMainThread;const IF={};function P6e(t){let e=IF[t];return e||(e=IF[t]=new Ip(1,1,t,t).translate(.5,.5,0)),e}const D6e="aTroikaGlyphBounds",OF="aTroikaGlyphIndex",I6e="aTroikaGlyphColor";class O6e extends pE{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 Qo,this.boundingBox=new Do}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=P6e(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(D6e,e,4),this.updateAttributeData(OF,n,1),this.updateAttributeData(I6e,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),M=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?-M:0),r.max.set(S,e[3],n<0?0:M)}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(OF).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 wx(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const L6e=`
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;
`,j6e=`
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);
`,z6e=`
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;
}
`,F6e=`
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 U6e(t){const e=$R(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Wt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new hi(0,0,0,0)},uTroikaClipRect:{value:new hi(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Wt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Nn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Cr},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:L6e,vertexTransform:j6e,fragmentDefs:z6e,fragmentColorTransform:F6e,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(CZ,`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 hP=new Dp({color:16777215,side:ru,transparent:!0}),LF=8421504,jF=new ur,XM=new Ve,NN=new Ve,C_=[],B6e=new Ve,kN="+x+y";function zF(t){return Array.isArray(t)?t[0]:t}let PZ=()=>{const t=new Hs(new Ip(1,1),hP);return PZ=()=>t,t},DZ=()=>{const t=new Hs(new Ip(1,1,32,1),hP);return DZ=()=>t,t};const H6e={type:"syncstart"},V6e={type:"synccomplete"},IZ=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],G6e=IZ.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let OZ=class extends Hs{constructor(){const e=new O6e;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=LF,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=kN,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(H6e),AZ({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(V6e),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 U6e(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=hP.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 zF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return zF(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:R}=this;c=this._parsePercent(C)||0,d=Math.max(0,this._parsePercent(D)||0),m=R,_=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??LF),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 M=this.clipRect;if(M&&Array.isArray(M)&&M.length===4)r.uTroikaClipRect.value.fromArray(M);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 Nn;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||kN;if(o!==e._orientation){let a=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==kN&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,d,p,m]=l;XM.set(0,0,0)[d]=c==="-"?1:-1,NN.set(0,0,0)[m]=p==="-"?-1:1,jF.lookAt(B6e,XM.cross(NN),NN),a.setFromMatrix4(jF)}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 Wt){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 Wt){return XM.copy(e),this.localPositionToTextCoords(this.worldToLocal(XM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?DZ():PZ(),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,C_.length=0,o.raycast(e,C_);for(let d=0;d<C_.length;d++)C_[d].object=this,n.push(C_[d])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,G6e.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};IZ.forEach(t=>{const e="_private_"+t;Object.defineProperty(OZ.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Do;new Nn;const bo=w.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=Nc(({invalidate:b})=>b),[p]=w.useState(()=>new OZ),[m,x]=w.useMemo(()=>{const b=[];let _="";return w.Children.forEach(s,S=>{typeof S=="string"||typeof S=="number"?_+=S:b.push(S)}),[b,_]},[s]);return CEe(()=>new Promise(b=>A6e({font:r,characters:o},b)),["troika-text",r,o]),w.useLayoutEffect(()=>void p.sync(()=>{d(),a&&a(p)})),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",gh({object:p,ref:c,font:r,text:x,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)}),_m=w.forwardRef(({threshold:t=15,geometry:e,...n},r)=>{const i=w.useRef(null);w.useImperativeHandle(r,()=>i.current,[]);const s=w.useMemo(()=>[0,0,0,1,0,0],[]),o=w.useRef(null),a=w.useRef(null);return w.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 z9(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()}),w.createElement(YAe,gh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),W6e=w.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=Nc(R=>R.invalidate),m=Nc(R=>R.camera),x=Nc(R=>R.gl),b=Nc(R=>R.events),_=Nc(R=>R.setEvents),S=Nc(R=>R.set),M=Nc(R=>R.get),C=Nc(R=>R.performance),A=e||m,N=r||b.connected||x.domElement,D=w.useMemo(()=>new WAe(A),[A]);return xE(()=>{D.enabled&&D.update()},-1),w.useEffect(()=>(s&&D.connect(s===!0?N:s),D.connect(N),()=>void D.dispose()),[s,N,n,D,p]),w.useEffect(()=>{const R=O=>{p(),n&&C.regress(),o&&o(O)},L=O=>{a&&a(O)},k=O=>{l&&l(O)};return D.addEventListener("change",R),D.addEventListener("start",L),D.addEventListener("end",k),()=>{D.removeEventListener("start",L),D.removeEventListener("end",k),D.removeEventListener("change",R)}},[o,a,l,D,p,_]),w.useEffect(()=>{if(t){const R=M().controls;return S({controls:D}),()=>S({controls:R})}},[t,D]),w.createElement("primitive",gh({ref:d,object:D,enableDamping:i},c))}),Wf=1e-5;function $6e(t,e,n){const r=new nm,i=n-Wf;return r.absarc(Wf,Wf,Wf,-Math.PI/2,-Math.PI,!0),r.absarc(Wf,e-i*2,Wf,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Wf,Math.PI/2,0,!0),r.absarc(t-i*2,Wf,Wf,0,-Math.PI/2,!0),r}const od=w.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 w.createElement("mesh",gh({ref:p},d),w.createElement(q6e,{args:[e,n,r],radius:i,steps:s,smoothness:o,bevelSegments:a,creaseAngle:l}),c)}),q6e=w.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=w.useMemo(()=>$6e(e,n,i),[e,n,i]),m=w.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:s,bevelSize:i-Wf,bevelThickness:i,curveSegments:o}),[r,i,o,a,s]),x=w.useRef(null);return w.useLayoutEffect(()=>{x.current&&(x.current.center(),jAe(x.current,l))},[p,m,l]),w.useImperativeHandle(d,()=>x.current),w.createElement("extrudeGeometry",gh({ref:x,args:[p,m]},c))});function vi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Lr(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 Ta(t){return typeof t=="string"?t:""}function RN(t){return!!t}function pP(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 LZ(t){if(!t)return null;const e=pP(t.setup);if(!e)return null;const n=Ta(e.model),r=Ta(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=Lr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const M=vi(S);if(!M)continue;const C=Lr(M.gpu_index);C!==null&&l.set(`${b}-${C}`,{role:"trainer",gpu_index:C,rank:Lr(M.rank)??void 0,dp_rank:Lr(M.dp_rank)??void 0,tp_rank:Lr(M.tp_rank)??void 0,pp_rank:Lr(M.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=Lr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const M=vi(S);if(!M)continue;const C=Lr(M.gpu_index);C!==null&&l.set(`${b}-${C}`,{role:"inference",gpu_index:C,server_idx:Lr(M.server_idx)??void 0,tp_group_id:Lr(M.tp_group_id)??void 0,port:Lr(M.port)??void 0,url:Ta(M.url)||void 0})}}const p=[];for(const m of s){const x=vi(m);if(!x)continue;const b=Lr(x.node_id)??0,_=vi(x.hardware),S=vi(_==null?void 0:_.cpu),M={model:Ta(S==null?void 0:S.model),cores:Lr(S==null?void 0:S.cores)??0,logical_cores:Lr(S==null?void 0:S.logical_cores)??0,sockets:Lr(S==null?void 0:S.sockets)??1,architecture:Ta(S==null?void 0:S.architecture),frequency_mhz:Lr(S==null?void 0:S.frequency_mhz)??0},C=vi(_==null?void 0:_.memory),A={total_gb:Lr(C==null?void 0:C.total_gb)??0},N=vi(_==null?void 0:_.gpu),R=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((V,q)=>{const G=vi(V),$=q,Q=`${b}-${$}`,K=l.get(Q)??{role:"unassigned",gpu_index:$};return{hardware:{name:Ta(G==null?void 0:G.name),memory_total_gb:Lr(G==null?void 0:G.memory_total_gb)??0,pcie_gen:Lr(G==null?void 0:G.pcie_gen)??0,pcie_width:Lr(G==null?void 0:G.pcie_width)??0,serial:Ta(G==null?void 0:G.serial),uuid:Ta(G==null?void 0:G.uuid)},role:K,local_index:$}}),L=vi(N==null?void 0:N.interconnect),k=L?{nvlink:RN(L.nvlink),topology:Ta(L.topology),links_per_gpu:Lr(L.links_per_gpu)??0,speed_gbps:Lr(L.speed_gbps)??0,connections:Lr(L.connections)??0}:null,O=vi(x.software),F=vi(O==null?void 0:O.os),B=vi(O==null?void 0:O.container),Y=vi(O==null?void 0:O.packages);p.push({node_id:b,hostname:Ta(x.hostname),ip:Ta(x.ip),is_driver:RN(x.is_driver),cpu:M,memory:A,gpus:R,interconnect:k,os:Ta(F==null?void 0:F.platform),container:B?{runtime:Ta(B.runtime),is_container:RN(B.is_container)}:null,software:{cuda:Ta(Y==null?void 0:Y.cuda),pytorch:Ta(Y==null?void 0:Y.pytorch),python:Ta(Y==null?void 0:Y.python)}})}return{model:n,schema_version:r,nodes:p,total_gpus:Lr(i.total_gpus)??0,trainer_total_gpus:Lr(o==null?void 0:o.total_gpus)??0,inference_total_gpus:Lr(a==null?void 0:a.total_gpus)??0,trainer_config:o?{data_parallel_size:Lr(o.data_parallel_size)??0,megatron_tensor_parallel_size:Lr(o.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Lr(o.megatron_pipeline_parallel_size)??0,backend:Ta(o.backend),world_size:Lr(o.world_size)??0}:null,inference_config:a?{num_servers:Lr(a.num_servers)??0,tensor_parallel_size:Lr(a.tensor_parallel_size)??0,placement_strategy:Ta(a.placement_strategy)}:null}}const X6e={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"},Y6e={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 Su(){return qn(gs)?Y6e:X6e}function K6e(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 Z6e({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:o}){const a=Su(),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}=K6e(e.hardware.name),m=.095;return f.jsxs("group",{position:t,children:[f.jsxs(od,{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(_m,{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:ru})]}),f.jsx(bo,{position:[-.285,m,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:a.textBlack,anchorX:"left",anchorY:"middle",children:c})]}),f.jsx(bo,{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(bo,{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(bo,{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(bo,{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(bo,{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(uP,{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 Q6e({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){const s=Su(),o=.063;return f.jsxs("group",{position:t,children:[f.jsxs(od,{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(_m,{color:s.platformBorder,threshold:1,scale:1.002})]}),f.jsx(bo,{position:[0,o,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:s.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),f.jsx(bo,{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 J6e(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 eNe({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Su(),a=J6e(e.model);return f.jsxs("group",{position:t,children:[f.jsxs(od,{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(_m,{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(_m,{color:o.platformBorder,threshold:1,scale:1.002})]}),f.jsx(bo,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:o.textBlack,anchorX:"center",anchorY:"middle",children:a}),f.jsx(bo,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),f.jsx(bo,{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(uP,{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 tNe({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Su(),a=.063;return f.jsxs("group",{position:t,children:[f.jsxs(od,{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(_m,{color:o.platformBorder,threshold:1,scale:1.002})]}),f.jsx(bo,{position:[0,a,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),f.jsx(bo,{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(uP,{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 nNe({vramPositions:t,vramDepth:e,interconnect:n}){const r=Su();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(od,{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(od,{args:[.02,.02,_],radius:.001,smoothness:2,position:[m[0],p,S],children:f.jsx("meshBasicMaterial",{color:r.nvlink})})},x)}),f.jsx(bo,{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 rNe({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=Su(),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,M=_+p/2+.08,C=M+.4+x/2,A=t.gpus.map((D,R)=>[R*a-(l-a)/2,.14,_]),N=t.gpus.map((D,R)=>[R*a-(l-a)/2,.11,S]);return f.jsxs("group",{position:e,children:[f.jsxs(od,{args:[c,.06,d],radius:0,smoothness:4,children:[f.jsx("meshBasicMaterial",{color:s.platform}),f.jsx(_m,{color:s.platformBorder,threshold:1,scale:1.002})]}),f.jsxs(bo,{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(bo,{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,R)=>{const L=A[R],k=[e[0]+L[0],e[1]+L[1],e[2]+L[2]];return f.jsxs("group",{children:[f.jsx(Z6e,{position:L,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:k})}),f.jsx(Q6e,{position:N[R],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)})]},R)}),f.jsx(nNe,{vramPositions:N,vramDepth:m,interconnect:t.interconnect}),(()=>{const D=[0,.09,C],R=[.75,.11,C],L=[e[0]+D[0],e[1]+D[1],e[2]+D[2]],k=[e[0]+R[0],e[1]+R[1],e[2]+R[2]];return f.jsxs(f.Fragment,{children:[f.jsx(eNe,{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:L})}),f.jsx(tNe,{position:R,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:k})})]})})(),(()=>{var Q,K;const D=((Q=t.gpus[0])==null?void 0:Q.hardware.pcie_gen)??0,R=((K=t.gpus[0])==null?void 0:K.hardware.pcie_width)??0;if(D===0||o<1)return null;const L=[...A].sort((re,U)=>re[0]-U[0]),k=L[0][0],O=L[L.length-1][0],F=(k+O)/2,B=O-k,Y=.065,V=M,q=C-x/2,G=Math.abs(q-V),$=(V+q)/2;return f.jsxs("group",{children:[f.jsx(od,{args:[B,.02,.035],radius:.002,smoothness:4,position:[F,Y,M],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})}),A.map((re,U)=>{const H=_+p/2,X=Math.abs(M-H),j=(H+M)/2;return f.jsx("group",{children:f.jsx(od,{args:[.02,.02,X],radius:.001,smoothness:2,position:[re[0],Y,j],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})})},U)}),f.jsx(od,{args:[.02,.02,G],radius:.001,smoothness:2,position:[0,Y,$],children:f.jsx("meshBasicMaterial",{color:s.chipBorder})}),f.jsx(bo,{position:[.15,.035,$],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:G-.1,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${D} x${R}`})]})})(),(()=>{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(bo,{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 jZ(){const t=Su();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 iNe({node:t,position:e,onClick:n}){const r=Su(),[i,s]=w.useState(!1),o=w.useRef(null);w.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 xE(()=>{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(od,{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(_m,{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(bo,{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(bo,{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(bo,{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(bo,{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 sNe({topology:t,onSelectNode:e}){const n=Su(),r=n.background==="#ffffff"?"#ffffff":"#888888",i=n.background==="#ffffff"?"#ffffff":"#333333",s=2.5,o=1.5,a=w.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=w.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(jZ,{}),f.jsx("gridHelper",{args:[50,50,n.gridColor,n.gridColor],position:[0,-.04,0]}),f.jsxs(od,{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(_m,{color:n.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((c,d)=>f.jsx(iNe,{node:c,position:a[d],onClick:()=>e(c.node_id)},c.node_id))]})}function oNe({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=Nc(),i=Nc(m=>m.controls),s=w.useRef(new Ve(...e)),o=w.useRef(new Ve(...n)),a=w.useRef(!1),l=w.useRef(null),c=w.useRef(e.join(",")),d=e.join(",");w.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 w.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]),xE(()=>{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 aNe({topology:t,focusedItem:e,onClose:n}){const r=Su();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 lNe({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=Su(),o=s.background==="#ffffff"?"#ffffff":"#888888",a=s.background==="#ffffff"?"#ffffff":"#333333",l=w.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(jZ,{}),f.jsx("gridHelper",{args:[50,50,s.gridColor,s.gridColor],position:[0,-.04,0]}),t.nodes.map((c,d)=>f.jsx(rNe,{node:c,position:l[d],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},c.node_id))]})}function cNe(){const t=Su(),{gl:e}=Nc();return w.useEffect(()=>{e.setClearColor(t.background)},[e,t.background]),null}function zZ({topology:t}){const e=Su(),[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(null),l=t.nodes.length>1,c=l&&o===null,d=w.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=w.useMemo(()=>{const C=c?t:d,A=C.nodes.length,N=Math.max(...C.nodes.map(R=>R.gpus.length),1);if(c){const R=Math.max(4,A*1.5);return[R*.6,R*.9,R*.6]}const D=Math.max(3.5,A*1.8,N*.8);return[D*.8,D*.7,D*.8]},[t,d,c]),m=w.useMemo(()=>[0,0,0],[]),x=w.useCallback(C=>{s(C),C&&r(null)},[]),b=w.useCallback(()=>{s(null)},[]),_=w.useCallback(()=>{a(null),s(null),r(null)},[]),S=w.useCallback(C=>{a(C),s(null),r(null)},[]),M=i!==null;return f.jsxs("div",{className:"relative w-full h-full bg-background",children:[f.jsxs(EAe,{camera:{position:p,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:C})=>{C.setClearColor(e.background),C.toneMapping=hu},children:[c?f.jsx(sNe,{topology:t,onSelectNode:S}):f.jsx(lNe,{topology:d,hoveredItem:n,setHoveredItem:r,setSelectedItem:x,focusedItem:i}),f.jsx(oNe,{focusTarget:!c&&i?{position:i.worldPosition}:null,overviewPosition:p,overviewLookAt:m}),f.jsx(W6e,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{i&&b()}}),f.jsx(cNe,{})]}),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(aNe,{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":M?"Move to dismiss · Click Close to return":"Drag to orbit · Scroll to zoom · Right-click to pan · Click an object to focus"})]})}function FZ(t){if(t&&typeof t=="object"&&"value"in t)return FZ(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 uNe=[1,5,10,30,60,120,300],PN=Ko,FF=Ko,dNe=["torch_allocated_gb"],fNe="__timeline_noop_metric__";function bE(t){return pP(t==null?void 0:t.setup)}function hNe(t){const e=bE(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=Lr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Lr(d.rank);p!==null&&(n[p]={node_id:a,local_rank:Lr(d.local_rank)})}}return n}function pNe(t){const e=bE(t),n=vi(e==null?void 0:e.inference);return Lr(n==null?void 0:n.num_servers)??void 0}function mNe(t){const e=bE(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=Lr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const p=Lr(d.server_idx);p!==null&&(p in n||(n[p]=a))}}return n}function UF(t){const e=bE(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 gNe(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 xNe({value:t,onChange:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(""),o=w.useRef(null),a=c=>{c&&(s(PN(t)),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=gNe(i);c!==null&&(e(c),r(!1))};return f.jsxs(YT,{open:n,onOpenChange:a,children:[f.jsx(KT,{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:[PN(t),f.jsx(kr,{className:"size-3 text-muted-foreground"})]})}),f.jsxs(ZT,{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:uNe.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:PN(c)},c))})]})]})}function vNe(){var G,$,Q,K,re;const t=qn(bl),[e,n]=hn(vce),[r,i]=hn(yce),s=!0,{data:o,isFetching:a,isPlaceholderData:l,error:c}=Mde(t||"",e,r,!!t),{data:d}=gd(t||"",!!t,s),p=w.useMemo(()=>{var H;const U=(H=d==null?void 0:d.config)==null?void 0:H.trainer_devices;return FZ(U)},[(G=d==null?void 0:d.config)==null?void 0:G.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]=w.useState(()=>[...dNe]),M=w.useMemo(()=>{const U=Array.from(new Set(_.filter(H=>typeof H=="string"&&H.trim().length>0))).sort((H,X)=>H.localeCompare(X));return U.length>0?U:[fNe]},[_]),C=w.useMemo(()=>hNe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),A=w.useMemo(()=>{const U={},H=(o==null?void 0:o.trainer_events)??[];for(const X of H){const j=X.rank;if(!Number.isFinite(j))continue;const le=U[j]??{node_id:null,local_rank:null},se=le.node_id!==null?le.node_id:typeof X.node_id=="number"&&Number.isFinite(X.node_id)?X.node_id:null,J=le.local_rank!==null?le.local_rank:typeof X.local_rank=="number"&&Number.isFinite(X.local_rank)?X.local_rank:null;U[j]={node_id:se,local_rank:J}}return U},[o==null?void 0:o.trainer_events]),N=w.useMemo(()=>{const U={};return new Set([...Object.keys(C).map(Number),...Object.keys(A).map(Number)]).forEach(X=>{const j=C[X],le=A[X];U[X]={node_id:(j==null?void 0:j.node_id)??(le==null?void 0:le.node_id)??null,local_rank:(j==null?void 0:j.local_rank)??(le==null?void 0:le.local_rank)??null}}),U},[C,A]),D=w.useMemo(()=>mNe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),R=w.useMemo(()=>{const U={},H=(o==null?void 0:o.inference_events)??[];for(const X of H){const j=X.server;Number.isFinite(j)&&U[j]===void 0&&typeof X.node_id=="number"&&Number.isFinite(X.node_id)&&(U[j]=X.node_id)}return U},[o==null?void 0:o.inference_events]),L=w.useMemo(()=>{const U={};return new Set([...Object.keys(D).map(Number),...Object.keys(R).map(Number)]).forEach(X=>{U[X]=D[X]??R[X]??null}),U},[D,R]),k=w.useMemo(()=>{const U=((o==null?void 0:o.trainer_events)??[]).map(X=>X.rank).filter(X=>Number.isFinite(X)),H=Object.keys(N).map(Number);return Array.from(new Set([...U,...H])).sort((X,j)=>X-j)},[o==null?void 0:o.trainer_events,N]),O=w.useMemo(()=>k.map(U=>{var H,X;return{rank:U,node_id:((H=N[U])==null?void 0:H.node_id)??null,local_rank:((X=N[U])==null?void 0:X.local_rank)??null}}),[k,N]),F=w.useMemo(()=>{const U=[];let H=!1;return k.forEach(X=>{var le;const j=(le=N[X])==null?void 0:le.local_rank;j!=null&&(U[X]=j,H=!0)}),H?U:p},[N,k,p]),B=Ede(t||"",M,O,m,x,!!t&&m!==null&&x!==null&&O.length>0),Y=w.useMemo(()=>{const U={};return O.forEach((H,X)=>{var le;const j=(le=B[X])==null?void 0:le.data;U[H.rank]=(j==null?void 0:j.metrics)??[]}),U},[O,B]),V=w.useMemo(()=>{const U=[];B.forEach(j=>{const le=j.data;le!=null&&le.available_metrics&&le.available_metrics.forEach(se=>{typeof se=="string"&&U.push(se)})});const H=Array.from(new Set(U));if(H.length>0)return H;const X=new Set;return B.forEach(j=>{var se;const le=j.data;(se=le==null?void 0:le.metrics)==null||se.forEach(J=>{typeof J.metric_name=="string"&&X.add(J.metric_name)})}),Array.from(X).sort((j,le)=>j.localeCompare(le))},[B]),q=B.some(U=>U.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(p9,{currentPage:e,totalPages:(o==null?void 0:o.total_pages)??1,onPageChange:n}),f.jsx(xNe,{value:r,onChange:U=>{const H=Math.floor(e*r/U);i(U),n(H)}}),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:[FF(m-o.global_min_time)," – ",FF(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(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),f.jsx(sSe,{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:Y,trainerGpuMetricsIsLoading:q,trainerAvailableGpuMetrics:V,selectedTrainerGpuMetrics:_,onSelectedTrainerGpuMetricsChange:S,trainerSystemGpuIndices:F,trainerRankInfoByRank:N,totalSetupNodes:UF(d==null?void 0:d.summary),inferenceServerNodeMap:L,numInferenceServers:pNe(d==null?void 0:d.summary)??(($=d==null?void 0:d.config)==null?void 0:$.num_inference_servers),maxConcurrentPrompts:(Q=d==null?void 0:d.config)==null?void 0:Q.max_concurrent_prompts,groupSize:(K=d==null?void 0:d.config)==null?void 0:K.group_size,freeLaneAfterGeneration:(re=d==null?void 0:d.config)==null?void 0:re.free_lane_after_generation})]})}),f.jsx(yNe,{runPath:t,trainerEvents:o==null?void 0:o.trainer_events,totalSetupNodes:UF(d==null?void 0:d.summary)})]}):f.jsx(Rm,{description:"Select a run from the sidebar to view the timeline."})}function yNe({runPath:t,trainerEvents:e,totalSetupNodes:n}){const r=qn(gs),[i,s]=hn(JG),[o,a]=hn(QG),[l,c]=w.useState("inference"),[d,p]=w.useState(i),[m,x]=w.useState(o);i!==d&&(p(i),i&&c("inference")),o!==m&&(x(o),o&&c("trainer"));const{data:b}=Tde(t??"",(i==null?void 0:i.groupId)??null,!!i&&!!t),_=w.useMemo(()=>{if(!i||!(b!=null&&b.events))return null;const se={};for(const J of b.events)J.sample_id!==void 0&&(se[J.sample_id]||(se[J.sample_id]=[]),se[J.sample_id].push(J));return se},[i,b]),S=w.useMemo(()=>{if(!b)return null;const se=b.environment_response_times??[],J=b.compute_reward_times??[],ee={};for(const oe of se)ee[oe.sample_idx]||(ee[oe.sample_idx]=[]),ee[oe.sample_idx].push({turn_order:oe.turn_order,time:oe.time});for(const oe of Object.values(ee))oe.sort((de,ye)=>de.turn_order-ye.turn_order);const ie={};for(const oe of J)ie[oe.sample_idx]=oe.time;return{envBySample:ee,rewardBySample:ie}},[b]),M=w.useMemo(()=>{if(!_)return null;let se=1/0,J=-1/0;for(const[ee,ie]of Object.entries(_)){for(const oe of ie){se=Math.min(se,oe.start_time),J=Math.max(J,oe.end_time);let de=oe.end_time;oe.environment_response_time&&oe.environment_response_time>0&&(de+=oe.environment_response_time),oe.compute_reward_time&&oe.compute_reward_time>0&&(de+=oe.compute_reward_time),J=Math.max(J,de)}if(S){const oe=Number(ee),de=[...ie].sort((fe,Se)=>fe.start_time-Se.start_time),ye=S.envBySample[oe]??[];let ge=-1/0;for(let fe=0;fe<de.length;fe++)ge=de[fe].end_time,fe<ye.length&&ye[fe].time>0&&(ge+=ye[fe].time);const Me=S.rewardBySample[oe]??0;Me>0&&(ge+=Me),J=Math.max(J,ge)}}return se===1/0?null:{start:se,end:J,duration:J-se}},[_,S]),{data:C}=Cde(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=w.useMemo(()=>C!=null&&C.events&&C.events.length>0?C.events:e??[],[C,e]),N=w.useMemo(()=>{if(A.length===0)return{};const se={};for(const J of A)se[J.rank]||(se[J.rank]=[]),se[J.rank].push(J);return se},[A]),D=w.useMemo(()=>o?(N[o.rank]||[]).find(J=>J.event_type===o.eventType&&J.step===o.step&&J.rank===o.rank&&!J.event_type.includes("/"))??null:null,[o,N]),R=w.useMemo(()=>o?(N[o.rank]||[]).filter(J=>J.event_type.startsWith(o.eventType+"/")&&J.step===o.step):[],[o,N]),L=qn(zT),k=qn(ZG),O=w.useMemo(()=>!i||!_?[]:Object.keys(_).map(Number).map(se=>({group_id:i.groupId,sample_idx:se})),[i,_]),{data:F}=s8(t??"",O,!!t&&O.length>0&&L),B=!L||O.length===0||!!F,Y=w.useMemo(()=>!L||!(F!=null&&F.statuses)?!1:F.statuses.some(se=>se.kind==="rollouts_discarded"),[L,F]),V=w.useMemo(()=>_?Object.values(_).some(se=>se.some(J=>J.is_canceled)):!1,[_]),{data:q}=uW(t??"",(i==null?void 0:i.groupId)??null,(i==null?void 0:i.sampleId)??null,!!t&&!!i,i==null?void 0:i.isEval),G=w.useMemo(()=>!q||q.kind!=="rollouts_discarded"?null:q.discard_reason,[q]),$=w.useMemo(()=>{if(!q||q.kind===null)return null;const se=q.samples_data;if(!se||se.length===0)return null;const J=se.map(ee=>ee.reward).filter(ee=>ee!==null);return J.length===0?null:J.every(ee=>ee===0)?"all_zero":J.every(ee=>ee>0)?"all_positive":null},[q]),Q=se=>{switch(se){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return se.split("_").map(J=>J.charAt(0).toUpperCase()+J.slice(1)).join(" ")}},K=!!i,re=!!o&&R.length>0&&!!D,U=l==="inference"&&!K&&re?"trainer":l==="trainer"&&!re&&K?"inference":l;if(!K&&!re)return null;const H=()=>{U==="inference"?(s(null),re&&c("trainer")):(a(null),K&&c("inference"))},X=D?cW(D.event_type,D.step,D.microbatch,D.minibatch):null,j=D?V2(D.event_type):void 0,le=K&&re;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:[le&&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 ${U==="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 ${U==="trainer"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),U==="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:V?r?wS:"#adadad":Y?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${B?"":" animate-pulse bg-muted"}`,style:B?{backgroundColor:V?r?wS:QT:Y?r?SS:_S:i.isEval?"#10b981":"#0369a1"}:void 0}),f.jsxs("span",{className:"text-xs font-medium",children:["Group ",i.groupId]})]}),V&&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"}),G&&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:Q(G)}),G==="zero_advantage"&&$==="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"}),G==="zero_advantage"&&$==="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"})]}),U==="trainer"&&X&&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:[X.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:H,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:f.jsx(qa,{className:"w-4 h-4"})})]}),f.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[U==="inference"&&i&&_&&M&&f.jsx(wSe,{eventsBySampleId:_,selectedSampleId:i.sampleId,timeBounds:M,groupId:i.groupId,runPath:t??"",envResponseTimesBySample:S==null?void 0:S.envBySample,computeRewardTimeBySample:k?S==null?void 0:S.rewardBySample:void 0,onSampleClick:se=>{s({sampleId:se,groupId:i.groupId,isEval:i.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:i.isEval}),U==="trainer"&&D&&R.length>0&&f.jsx(DSe,{parentEvent:D,childEvents:R})]})]})}function mP(t,e){const n=typeof IntersectionObserver>"u",[r,i]=w.useState(n),[s,o]=w.useState(n),a=w.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 w.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 UZ(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?$l.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function BZ({isFullscreen:t,onClick:e}){return f.jsx("button",{onClick:e,className:bt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/card:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?f.jsx($T,{className:"h-3 w-3"}):f.jsx(WT,{className:"h-3 w-3"})})}const YM={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"}]}},bNe={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"}},_Ne={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)"}]}},XR=["mean","std","min","max"],_1="histogram",S1="distribution_over_time";function BF(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 P0(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 XR){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}_${_1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:_1,showZeroLine:o,unit:a,isHistogram:!0,histogramMetricType:BF(r.prefix)});const c=`${r.prefix}_${S1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:S1,showZeroLine:o,unit:a,isDistributionOverTime:!0,histogramMetricType:BF(r.prefix)})}}function SNe(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}`;P0(r,l,{label:g1(i),metrics:a.map(c=>({prefix:c,label:g1(c),simple:!0,group:o?g1(o):void 0}))})}P0(r,"rewards",YM.rewards),t.length>0&&P0(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:g1(i)},{prefix:`reward_${i}_gini_mean`,label:`${g1(i)} Sparsity (Gini)`,simple:!0}])}),P0(r,"advantage",YM.advantage),r.push(...wNe(n)),P0(r,"tokens",YM.tokens),P0(r,"rollouts_general",YM.rollouts_general);for(const[i,s]of Object.entries(bNe))P0(r,i,s);for(const[i,s]of Object.entries(_Ne))P0(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});for(const i of V$)r.push({category:"inference_performance_area",categoryLabel:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferencePerformanceArea:!0,inferenceAreaCategories:[...i.categories]});for(const i of q$)r.push({category:"trainer_performance_area",categoryLabel:"Trainer Performance",group:"Time Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isTrainerPerformanceArea:!0,trainerAreaCategories:[...i.categories]});for(const i of[{key:"trainer_perf_idle",label:"Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Working (excl. Weight Sync)",trainerMetricType:"working_except_weight_sync"},{key:"trainer_perf_forward",label:"Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_checkpoint",label:"Checkpoint",trainerMetricType:"checkpoint"}])r.push({category:"trainer_performance",categoryLabel:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isTrainerPerformance:!0,trainerMetricType:i.trainerMetricType});return r}function wNe(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=g1(s),a=`${r} / ${o}`,l=`${i}reward_${s}`,c="evals";for(const d of XR){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}_${_1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:_1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${S1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:S1,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 XR){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}_${_1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:_1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${S1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:S1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function g1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function MNe(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 TNe(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.isInferencePerformanceArea?"inference_performance_area":n.isTrainerPerformance?"trainer_performance":n.isTrainerPerformanceArea?"trainer_performance_area":n.isHistogram?"histogram":n.isDistributionOverTime?"distribution_over_time":n.isEvalMetric?"eval_metric":"step_metric",evalName:n.evalName,histogramMetricType:n.histogramMetricType,inferenceMetricType:n.inferenceMetricType,inferenceAreaCategories:n.inferenceAreaCategories,trainerMetricType:n.trainerMetricType,trainerAreaCategories:n.trainerAreaCategories,simple:!n.suffix}))}function gP({openAtom:t=Q7}={}){const[e,n]=hn(t);return!qn(bl)||e?null:f.jsx(En,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function Fg({id:t,children:e}){const{attributes:n,listeners:r,setNodeRef:i,transform:s,transition:o,isDragging:a}=sC({id:t}),l={transform:s?`translate3d(${Math.round(s.x)}px, ${Math.round(s.y)}px, 0)`:void 0,transition:o,opacity:a?.4:1,position:"relative",zIndex:a?50:void 0},c=f.jsx("button",{...n,...r,className:"-ml-1.5 cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100",children:f.jsx(GT,{className:"h-3 w-3 text-muted-foreground"})});return f.jsx("div",{ref:i,style:l,children:e(c)})}function xP({currentStep:t,maxSelectableStep:e,openAtom:n=Q7,selectedMetricsAtom:r=Ece,selectedStepAtom:i=jT,includeDiscardedDefaults:s=!1,evalConfig:o}){var ye,ge;const[a,l]=hn(n),[c,d]=hn(r),[p,m]=w.useState(!1),x=p&&(o==null?void 0:o.selectedSampleIdx)!=null,[b,_]=w.useState(!1),[S,M]=w.useState(10),[C,A]=w.useState("10"),N=qn(bl),D=qn(LT),R=qn(FT),L=!0,k=!!o,{data:O}=km(),{data:F}=gd(N||"",!!N,L),B=w.useMemo(()=>(F==null?void 0:F.available_rollout_metric_names)??[],[F==null?void 0:F.available_rollout_metric_names]),Y=w.useMemo(()=>{var Me;return((Me=F==null?void 0:F.step_metrics_info)==null?void 0:Me.custom_metric_sections)??{}},[(ye=F==null?void 0:F.step_metrics_info)==null?void 0:ye.custom_metric_sections]),V=w.useMemo(()=>{var Me;return((Me=F==null?void 0:F.eval_info)==null?void 0:Me.evals)??[]},[(ge=F==null?void 0:F.eval_info)==null?void 0:ge.evals]),q=w.useRef(!1);w.useEffect(()=>{if(k||q.current)return;if(c.length>0){q.current=!0;return}if(!F)return;q.current=!0;const Me=["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",...B.flatMap(fe=>[`reward_${fe}_mean`,`reward_${fe}_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(Me)},[F,B,k]);const G=w.useRef(new Set);w.useEffect(()=>{if(k||B.length===0)return;const Me=[];for(const fe of B){if(!G.current.has(fe)){const Se=`reward_${fe}_mean`,me=`reward_${fe}_distribution_over_time`;c.includes(Se)||Me.push(Se),c.includes(me)||Me.push(me)}G.current.add(fe)}Me.length>0&&d(fe=>[...fe,...Me])},[B,k]);const $=w.useRef("");w.useEffect(()=>{if(!k||!o)return;const Me=`${o.prefix}|${o.rewardNames.join(",")}`;if(Me===$.current)return;$.current=Me;const fe=o.prefix,Se=[`${fe}length_completion_mean`,`${fe}length_completion_std`,`${fe}length_completion_min`,`${fe}length_completion_max`,`${fe}length_completion_distribution_over_time`,...o.rewardNames.flatMap(me=>[`${fe}reward_${me}_mean`,`${fe}reward_${me}_distribution_over_time`])];d(Se)},[o,k,d]);const Q=w.useMemo(()=>{const Me=(O==null?void 0:O.runs)||[],fe=new Set(D);return N&&fe.add(N),Me.filter(Se=>fe.has(Se.run_id)).map(Se=>({runPath:Se.run_id,runName:Se.name,color:Se.color,isSelected:Se.run_id===N}))},[N,D,O==null?void 0:O.runs]),K=w.useMemo(()=>SNe(B,Y,V),[B,Y,V]);w.useMemo(()=>MNe(K),[K]);const re=w.useMemo(()=>{const Me=new Set(K.map(Se=>Se.metricKey)),fe={};return c.map((Se,me)=>{const Pe=fe[Se]||0;return fe[Se]=Pe+1,{metricKey:Se,originalIndex:me,sortableId:`${Se}::${Pe}`}}).filter(({metricKey:Se})=>Me.has(Se))},[c,K]),U=w.useMemo(()=>re.map(Me=>Me.metricKey),[re]),H=w.useMemo(()=>TNe(K),[K]),X=w.useMemo(()=>U.map(Me=>{const fe=K.find(Se=>Se.metricKey===Me);return{id:Me,metricKey:Me,label:(fe==null?void 0:fe.label)||Me,plotType:fe!=null&&fe.isInferencePerformance?"inference_performance":fe!=null&&fe.isInferencePerformanceArea?"inference_performance_area":fe!=null&&fe.isTrainerPerformance?"trainer_performance":fe!=null&&fe.isTrainerPerformanceArea?"trainer_performance_area":fe!=null&&fe.isHistogram?"histogram":fe!=null&&fe.isDistributionOverTime?"distribution_over_time":fe!=null&&fe.isEvalMetric?"eval_metric":"step_metric"}}),[U,K]),j=Me=>{Me&&d(fe=>[...fe,Me])},le=Me=>{d(fe=>fe.filter((Se,me)=>me!==Me))},se=sy(id(cm,{activationConstraint:{distance:5}}),id(lm,{coordinateGetter:cy})),J=w.useCallback(Me=>{const{active:fe,over:Se}=Me;if(!Se||fe.id===Se.id)return;const me=re.find(ce=>ce.sortableId===fe.id),Pe=re.find(ce=>ce.sortableId===Se.id);!me||!Pe||d(ce=>um(ce,me.originalIndex,Pe.originalIndex))},[d,re]),ee=Me=>K.find(fe=>fe.metricKey===Me),[ie,oe]=w.useState(null),de=w.useCallback(Me=>{if(!Me||!a){oe(null);return}const fe=Me.querySelector('[data-slot="scroll-area-viewport"]');fe&&oe(fe)},[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:k?"Eval Metrics":"Training Metrics"}),f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:f.jsx(Wue,{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(my,{catalog:H,onSelect:Me=>j(Me.metricKey),existingPlots:X,allowDuplicates:!0,children:f.jsxs("button",{type:"button",className:bt("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",U.length>0?"text-foreground":"text-muted-foreground"),children:[f.jsx("span",{className:"font-medium",children:"Charts"}),U.length>0&&f.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:U.length}),f.jsx(kr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),f.jsx(AS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:C,onValueChange:A,onValueCommit:Me=>{const fe=parseInt(Me,10);!isNaN(fe)&&fe>=2&&fe<=100?(M(fe),A(fe.toString())):A(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),f.jsx(Px,{ref:de,className:"flex-1 min-h-0",children:f.jsxs("div",{className:"p-4 space-y-4",children:[k&&f.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[f.jsx(En,{variant:p?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!1),children:"All"}),f.jsx(En,{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"})]}),U.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"}):f.jsx(ay,{sensors:se,collisionDetection:oy,onDragEnd:J,children:f.jsx(ly,{items:re.map(({sortableId:Me})=>Me),strategy:h8,children:f.jsx("div",{className:"space-y-4",children:re.map(({metricKey:Me,originalIndex:fe,sortableId:Se})=>{const me=ee(Me);if(x&&(me!=null&&me.isHistogram||me!=null&&me.isDistributionOverTime||me!=null&&me.suffix&&me.suffix!=="mean"&&me.suffix!==""))return null;const Pe=k&&x?`/s/${o.selectedSampleIdx}/`:"/",He=k&&Me.startsWith("eval/")?Me.replace(/^(eval\/[^/]+)\//,`$1${Pe}`):Me,Be=(me==null?void 0:me.histogramMetricType)||"",Ge=k&&Be.startsWith("eval/")?Be.replace(/^(eval\/[^/]+)\//,`$1${Pe}`):Be,We=x&&(me==null?void 0:me.suffix)==="mean"?(me.label||Me).replace(/ - Mean$/,""):(me==null?void 0:me.label)||Me;if(me!=null&&me.isInferencePerformance&&me.inferenceMetricType){const ae=f.jsx("button",{onClick:()=>le(fe),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:f.jsx(qa,{className:"h-3.5 w-3.5"})});return f.jsx(Fg,{id:Se,children:Z=>f.jsx(H$,{runs:Q,shouldPoll:L,hoveredRunId:R,scrollRoot:ie,inferenceMetricType:me.inferenceMetricType,label:We,headerPrefix:Z,headerSuffix:ae})},Se)}if(me!=null&&me.isInferencePerformanceArea&&me.inferenceAreaCategories){const ae=f.jsx("button",{onClick:()=>le(fe),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:f.jsx(qa,{className:"h-3.5 w-3.5"})});return f.jsx(Fg,{id:Se,children:Z=>f.jsx(G$,{runs:Q,shouldPoll:L,scrollRoot:ie,label:We,categories:me.inferenceAreaCategories,headerPrefix:Z,headerSuffix:ae})},Se)}if(me!=null&&me.isTrainerPerformance&&me.trainerMetricType){const ae=f.jsx("button",{onClick:()=>le(fe),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:f.jsx(qa,{className:"h-3.5 w-3.5"})});return f.jsx(Fg,{id:Se,children:Z=>f.jsx($$,{runs:Q,shouldPoll:L,hoveredRunId:R,scrollRoot:ie,trainerMetricType:me.trainerMetricType,label:We,headerPrefix:Z,headerSuffix:ae})},Se)}if(me!=null&&me.isTrainerPerformanceArea&&me.trainerAreaCategories){const ae=f.jsx("button",{onClick:()=>le(fe),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:f.jsx(qa,{className:"h-3.5 w-3.5"})});return f.jsx(Fg,{id:Se,children:Z=>f.jsx(X$,{runs:Q,shouldPoll:L,scrollRoot:ie,label:We,categories:me.trainerAreaCategories,headerPrefix:Z,headerSuffix:ae})},Se)}return me!=null&&me.isHistogram?f.jsx(Fg,{id:Se,children:ae=>f.jsx(NNe,{runPath:N,step:t,metricType:Ge,label:We,showZeroLine:me==null?void 0:me.showZeroLine,unit:me==null?void 0:me.unit,isTokenMetric:(me==null?void 0:me.category)==="tokens",onRemove:()=>le(fe),scrollRoot:ie,headerPrefix:ae})},Se):me!=null&&me.isDistributionOverTime?f.jsx(Fg,{id:Se,children:ae=>f.jsx(RNe,{runPath:N,metricType:Ge,label:We,showZeroLine:me==null?void 0:me.showZeroLine,unit:me==null?void 0:me.unit,isTokenMetric:(me==null?void 0:me.category)==="tokens",currentStep:t,shouldPoll:L,onRemove:()=>le(fe),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:ie,headerPrefix:ae})},Se):f.jsx(Fg,{id:Se,children:ae=>f.jsx(ENe,{runs:Q,shouldPoll:L,metricKey:He,label:We,showZeroLine:me==null?void 0:me.showZeroLine,unit:me==null?void 0:me.unit,isTokenMetric:(me==null?void 0:me.category)==="tokens",showEma:b,emaSpan:S,currentStep:t,onRemove:()=>le(fe),hoveredRunId:R,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:ie,filterKey:`${Me}-${fe}`,headerPrefix:ae})},Se)})})})})]})})]})}function CNe(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 Vf(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:o,sampleIdx:a}=CNe(e),l=dW(t,e,n&&!i,r),c=Pde(t,s,o,n&&i,r,a);return i?c:l}function ENe({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=jT,maxSelectableStep:x,scrollRoot:b=null,filterKey:_,headerPrefix:S}){var je,Te,Xe,ht,ke,et,ct,yt,lt,Je;const M=td(m),C=qn(gs),{isFullscreen:A,toggleFullscreen:N,fullscreenPortal:D}=UZ(),R=w.useRef(null),L=w.useRef(null),k=w.useRef(null),O=w.useRef(null),F=w.useRef(null),B=_??n,[Y,V]=hn(Z7),q=k8.has(n),G=Y[B],$=(G==null?void 0:G.ignoreOutliers)??!1,Q=(G==null?void 0:G.ignoreFirstStep)??q,K=(G==null?void 0:G.minY)??null,re=(G==null?void 0:G.maxY)??null,U=w.useCallback(Ee=>{V(Ze=>{const Ie={ignoreOutliers:!1,ignoreFirstStep:q,minY:null,maxY:null,tagFilters:{},envFilters:[]},Ue=Ze[B]??Ie,rt=Ee(Ue);if(rt.ignoreOutliers===Ie.ignoreOutliers&&rt.ignoreFirstStep===Ie.ignoreFirstStep&&rt.minY===Ie.minY&&rt.maxY===Ie.maxY&&Object.keys(rt.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(Ze,B))return Ze;const Dt={...Ze};return delete Dt[B],Dt}return{...Ze,[B]:rt}})},[B,V,q]),H=w.useCallback(Ee=>U(Ze=>({...Ze,ignoreOutliers:Ee})),[U]),X=w.useCallback(Ee=>U(Ze=>({...Ze,ignoreFirstStep:Ee})),[U]),j=w.useCallback(Ee=>U(Ze=>({...Ze,minY:Ee})),[U]),le=w.useCallback(Ee=>U(Ze=>({...Ze,maxY:Ee})),[U]),J=mP(R,{root:b,threshold:0})||A,ee=Vf(((je=t[0])==null?void 0:je.runPath)||"",n,J&&!!t[0],e),ie=Vf(((Te=t[1])==null?void 0:Te.runPath)||"",n,J&&!!t[1],e),oe=Vf(((Xe=t[2])==null?void 0:Xe.runPath)||"",n,J&&!!t[2],e),de=Vf(((ht=t[3])==null?void 0:ht.runPath)||"",n,J&&!!t[3],e),ye=Vf(((ke=t[4])==null?void 0:ke.runPath)||"",n,J&&!!t[4],e),ge=Vf(((et=t[5])==null?void 0:et.runPath)||"",n,J&&!!t[5],e),Me=Vf(((ct=t[6])==null?void 0:ct.runPath)||"",n,J&&!!t[6],e),fe=Vf(((yt=t[7])==null?void 0:yt.runPath)||"",n,J&&!!t[7],e),Se=Vf(((lt=t[8])==null?void 0:lt.runPath)||"",n,J&&!!t[8],e),me=Vf(((Je=t[9])==null?void 0:Je.runPath)||"",n,J&&!!t[9],e),Pe=w.useMemo(()=>{const Ee=t.filter(Ie=>!Ie.isSelected),Ze=t.filter(Ie=>Ie.isSelected);return[...Ee,...Ze]},[t]),ce=w.useMemo(()=>Pe.slice(0,10),[Pe]),He=w.useMemo(()=>{const Ee=new Map;return ce.forEach((Ze,Ie)=>{Ee.set(Ze.runPath,Ie)}),Ee},[ce]),{uplotData:Be,seriesConfig:Ge,isFetching:We,isRefetching:ae,isPlaceholderData:Z,hasData:he,minStep:be,maxStep:we}=w.useMemo(()=>{const Ee=[ee,ie,oe,de,ye,ge,Me,fe,Se,me],Ze=new Map;t.forEach((Ut,$e)=>{$e<10&&Ze.set(Ut.runPath,Ee[$e])});const Ie=new Set,Ue=new Map;let rt=!1,ut=!1,Dt=!1;if(Pe.forEach((Ut,$e)=>{var Ct;if($e>=10)return;const dt=Ze.get(Ut.runPath);if(!dt)return;dt.isFetching&&(rt=!0),dt.isRefetching&&(ut=!0),dt.isPlaceholderData&&(Dt=!0);const Tt=((Ct=dt.data)==null?void 0:Ct.metrics)||[],Bt=new Map;Tt.forEach(At=>{Ie.add(At.step),Bt.set(At.step,At.value)}),Ue.set($e,Bt)}),Ie.size===0)return{uplotData:null,seriesConfig:[],isFetching:rt,isRefetching:ut,isPlaceholderData:Dt,hasData:!1,minStep:0,maxStep:0};const Rt=Array.from(Ie).sort((Ut,$e)=>Ut-$e),St=new Float64Array(Rt),Ht=[{label:"Step"}],en=[St];return Pe.forEach((Ut,$e)=>{if($e>=10)return;const dt=Ue.get($e)||new Map,Tt=Rt.map(Ot=>dt.get(Ot)??null),Bt=p===Ut.runPath,Ct=p!==null;let At;Ct&&!Bt?At=.1:At=a?.3:1,en.push(Tt),Ht.push({label:Sp(Ut),stroke:Ut.color,width:1,alpha:At,spanGaps:!0,points:{show:!1}})}),a&&Pe.forEach((Ut,$e)=>{if($e>=10)return;const dt=Ue.get($e)||new Map,Tt=2/(l+1);let Bt=null;const Ct=[];Rt.forEach(Lt=>{const wt=dt.get(Lt);wt!==void 0?(Bt===null?Bt=wt:Bt=Tt*wt+(1-Tt)*Bt,Ct.push(Bt)):Ct.push(null)});const At=p===Ut.runPath,Ot=p!==null;let cn;Ot&&!At?cn=.1:cn=1,en.push(Ct),Ht.push({label:`${Sp(Ut)} (EMA)`,stroke:Ut.color,width:1.5,alpha:cn,spanGaps:!0,points:{show:!1}})}),{uplotData:en,seriesConfig:Ht,isFetching:rt,isRefetching:ut,isPlaceholderData:Dt,hasData:!0,minStep:Rt[0],maxStep:Rt[Rt.length-1]}},[t,Pe,ee,ie,oe,de,ye,ge,Me,fe,Se,me,a,l,p]),ve=n.split("_").pop()||"",Re=w.useCallback(Ee=>Ee==null?"N/A":o&&(ve==="min"||ve==="max")?Math.round(Ee).toLocaleString():gu(Ee),[o,ve]),Ae=w.useCallback(Ee=>Math.abs(Ee)>=1e3?`${parseFloat((Ee/1e3).toFixed(1))}k`:o?ve==="min"||ve==="max"?Math.round(Ee).toString():String(parseFloat(Ee.toFixed(1))):Number.isInteger(Ee)?Ee.toLocaleString():Math.abs(Ee)<.01&&Ee!==0?Ee.toExponential(1):String(parseFloat(Ee.toFixed(2))),[o,ve]),Oe=w.useCallback(Ee=>Ee>=1e3?`${(Ee/1e3).toFixed(0)}k`:Ee.toString(),[]);w.useEffect(()=>{if(!L.current||!Be||!he)return;const Ee=L.current,Ze=Ee.clientWidth,Ie=Ee.clientHeight||160;let Ue=null;if($){const Lt=[];for(let wt=1;wt<Be.length;wt++){const Zt=Be[wt],Jt=Q?1:0;for(let vn=Jt;vn<Zt.length;vn++){const Fn=Zt[vn];Fn!=null&&Lt.push(Fn)}}Ue=pC(Lt)}let rt=1/0,ut=-1/0;for(let Lt=1;Lt<Be.length;Lt++){const wt=Be[Lt],Zt=Q?1:0;for(let Jt=Zt;Jt<wt.length;Jt++){const vn=wt[Jt];if(vn!=null){if($&&Ue&&(vn<Ue.lower||vn>Ue.upper))continue;vn<rt&&(rt=vn),vn>ut&&(ut=vn)}}}const Dt=ut-rt,Rt=Math.max(Math.abs(ut),Math.abs(rt)),St=Math.max(Rt*.05,1e-10),Ht=Math.max(Dt*.1,St);let en,Ut;i?(en=Math.min(rt-Ht,0),Ut=Math.max(ut+Ht,0)):(en=rt-Ht,Ut=ut+Ht),K!==null&&(en=K),re!==null&&(Ut=re);const $e=C?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",dt=C?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Tt=(Lt,wt)=>{if(!wt||wt.length===0)return 36;const Zt=Math.max(...wt.map(Jt=>Jt.length));return Math.max(36,Zt*6+12)},Bt=c!=null&&Number.isFinite(be)&&Number.isFinite(we)&&c>=be&&c<=we,Ct={width:Ze,height:Ie,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[en,Ut]}},axes:[{stroke:dt,grid:{stroke:$e,width:1},ticks:{stroke:$e,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Lt,wt)=>wt.map(Oe)},{stroke:dt,grid:{stroke:$e,width:1},ticks:{stroke:$e,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Tt,values:(Lt,wt)=>wt.map(Ae)}],series:Ge,hooks:{draw:[Lt=>{if(Bt&&c!=null){const wt=Lt.ctx,Zt=Lt.valToPos(c,"x",!0),Jt=Lt.valToPos(Ut,"y",!0),vn=Lt.valToPos(en,"y",!0);wt.save(),wt.strokeStyle=C?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",wt.lineWidth=2,wt.beginPath(),wt.moveTo(Zt,Jt),wt.lineTo(Zt,vn),wt.stroke(),wt.restore()}if(i&&en<0&&Ut>0){const wt=Lt.ctx,Zt=Lt.valToPos(0,"y",!0),Jt=Lt.valToPos(Lt.scales.x.min,"x",!0),vn=Lt.valToPos(Lt.scales.x.max,"x",!0);wt.save(),wt.strokeStyle=C?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",wt.lineWidth=1,wt.setLineDash([5,5]),wt.beginPath(),wt.moveTo(Jt,Zt),wt.lineTo(vn,Zt),wt.stroke(),wt.restore()}}],setCursor:[Lt=>{if(!O.current)return;const{left:wt,idx:Zt}=Lt.cursor;if(F.current=Zt??null,Zt==null||wt===void 0||wt<0){O.current.style.display="none";return}const Jt=Be[0][Zt];if(Jt===void 0){O.current.style.display="none";return}let vn=`<div class="font-medium mb-1">Step ${Number(Jt).toLocaleString()}</div>`;const Fn=ce.length;t.forEach(vt=>{var dn,_n;const qt=He.get(vt.runPath);if(qt===void 0)return;const tn=qt+1,Kt=(dn=Be[tn])==null?void 0:dn[Zt];let Vt;if(a){const An=Fn+qt+1;Vt=(_n=Be[An])==null?void 0:_n[Zt]}Kt!=null&&(vn+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${vt.color}"></div>
                    <span>${Iw(vt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${a?.7:1}">${Re(Kt)}${s?` ${s}`:""}</span>
                    ${a&&Vt!==void 0&&Vt!==null?`<span class="text-muted-foreground">(EMA: ${Re(Vt)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=vn,O.current.style.display="block",O.current.style.left="0px",O.current.style.top="0px";const _e=O.current.getBoundingClientRect(),nt=L.current.getBoundingClientRect();let mt=nt.left+wt+15;mt+_e.width+20>window.innerWidth&&(mt=nt.left+wt-_e.width-15+Lt.bbox.left),mt=Math.max(4,mt);let xt=nt.top-_e.height+20;xt<4&&(xt=nt.top+8),O.current.style.left=`${mt-_e.left}px`,O.current.style.top=`${xt-_e.top}px`}]}};k.current&&k.current.destroy();const At=new ps(Ct,Be,Ee);k.current=At;const Ot=()=>{const Lt=F.current;if(Lt!=null){let wt=Be[0][Lt];wt!==void 0&&!isNaN(wt)&&(x!=null&&wt>x&&(wt=x),M(wt))}};Ee.addEventListener("click",Ot);const cn=new ResizeObserver(Lt=>{for(const wt of Lt){const{width:Zt,height:Jt}=wt.contentRect;At&&Zt>0&&Jt>0&&At.setSize({width:Zt,height:Jt})}});return cn.observe(Ee),()=>{Ee.removeEventListener("click",Ot),cn.disconnect(),At.destroy(),k.current=null}},[Be,Ge,he,i,Ae,Oe,Re,Pe,a,s,c,be,we,M,x,t,ce,He,C,$,Q,K,re,A]);const qe=w.useCallback(()=>{O.current&&(O.current.style.display="none")},[]),Fe=We&&(!ae||Z),Ke=$||Q||K!==null||re!==null;return D(f.jsxs("div",{ref:R,className:bt("group/card bg-background",A?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!A&&Fe&&"opacity-50"),children:[f.jsxs("div",{className:"shrink-0 mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[!A&&S,f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",A?"text-sm":"text-xs"),title:r,children:r})}),f.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:$,onCheckedChange:H,children:"Ignore Outliers"}),f.jsx(Er,{checked:Q,onCheckedChange:X,children:"Ignore First Step"}),f.jsx(Bs,{}),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:K??"",onChange:Ee=>{const Ze=Ee.target.value;j(Ze===""?null:Number(Ze))},onClick:Ee=>Ee.stopPropagation(),onKeyDown:Ee=>Ee.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:re??"",onChange:Ee=>{const Ze=Ee.target.value;le(Ze===""?null:Number(Ze))},onClick:Ee=>Ee.stopPropagation(),onKeyDown:Ee=>Ee.stopPropagation()})]})]})]}),f.jsx(BZ,{isFullscreen:A,onClick:N}),!A&&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(qa,{className:"h-3.5 w-3.5"})})]})]}),Ke&&f.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[$&&f.jsx(ko,{label:"Ignore Outliers",onRemove:()=>H(!1)}),Q&&f.jsx(ko,{label:"Ignore First Step",onRemove:()=>X(!1)}),K!==null&&f.jsx(ko,{label:`Min Y: ${K}`,onRemove:()=>j(null)}),re!==null&&f.jsx(ko,{label:`Max Y: ${re}`,onRemove:()=>le(null)})]})]}),he?f.jsxs("div",{className:bt("cursor-pointer relative bg-background rounded",A?"flex-1 min-h-0":"h-40"),ref:L,onMouseLeave:qe,children:[f.jsx("div",{ref:O,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&&!Z&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",A?"flex-1 min-h-0":"h-40"),children:We?"Loading...":"No data"})]}))}function ANe(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 NNe({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:o,scrollRoot:a=null,headerPrefix:l}){const c=qn(gs),d=w.useRef(null),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=mP(d,{root:a,threshold:0}),{data:_,isFetching:S,isRefetching:M,isPlaceholderData:C}=Ide(t,e??null,n,b&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:A,hasData:N}=w.useMemo(()=>{const k=(_==null?void 0:_.values)??[];if(k.length===0)return{histogramData:null,hasData:!1};const{binEdges:O,counts:F}=ANe(k,25),B=O.slice(0,-1).map((Y,V)=>(Y+O[V+1])/2);return{histogramData:{binEdges:O,binCenters:B,counts:F,totalCount:k.length,min:Math.min(...k),max:Math.max(...k),mean:k.reduce((Y,V)=>Y+V,0)/k.length},hasData:!0}},[_==null?void 0:_.values]),D=w.useCallback(k=>k==null?"N/A":s?Math.round(k).toLocaleString():gu(k),[s]);w.useEffect(()=>{if(!p.current||!A||!N)return;const k=p.current,O=k.clientWidth,F=k.clientHeight||160,B=new Float64Array(A.binCenters),Y=new Float64Array(A.counts),V=[B,Y],G=Math.max(...A.counts)*1.1,$=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Q=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",K="rgba(59, 130, 246, 0.7)",re=A.binEdges[1]-A.binEdges[0],H={width:O,height:F,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,G]}},axes:[{stroke:Q,grid:{stroke:$,width:1},ticks:{stroke:$,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(le,se)=>se.map(J=>Math.abs(J)>=1e3?`${parseFloat((J/1e3).toFixed(1))}k`:Math.abs(J)<.01&&J!==0?J.toExponential(1):String(parseFloat(J.toFixed(2))))},{stroke:Q,grid:{stroke:$,width:1},ticks:{stroke:$,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(le,se)=>{if(!se||se.length===0)return 36;const J=Math.max(...se.map(ee=>ee.length));return Math.max(36,J*6+12)},values:(le,se)=>se.map(J=>J>=1e3?`${(J/1e3).toFixed(0)}k`:Math.round(J).toString())}],series:[{label:"Value"},{label:"Count",stroke:K,fill:K,width:0,paths:(le,se)=>{const J=new Path2D,{data:ee}=le,ie=ee[0],oe=ee[se];for(let de=0;de<ie.length;de++){const ye=ie[de],ge=oe[de];if(ge==null||ge===0)continue;const Me=le.valToPos(ye-re/2,"x",!0),fe=le.valToPos(ye+re/2,"x",!0),Se=le.valToPos(0,"y",!0),me=le.valToPos(ge,"y",!0),Pe=Math.max(1,fe-Me-1);J.rect(Me+.5,me,Pe,Se-me)}return{stroke:J,fill:J}}}],hooks:{draw:[le=>{if(i&&A.min<0&&A.max>0){const se=le.ctx,J=le.valToPos(0,"x",!0),ee=le.valToPos(0,"y",!0),ie=le.valToPos(G,"y",!0);se.save(),se.strokeStyle=c?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",se.lineWidth=1,se.setLineDash([5,5]),se.beginPath(),se.moveTo(J,ee),se.lineTo(J,ie),se.stroke(),se.restore()}}],setCursor:[le=>{if(!x.current)return;const{left:se,idx:J}=le.cursor;if(J==null||se===void 0||se<0){x.current.style.display="none";return}const ee=A.binCenters[J],ie=A.counts[J],oe=A.binEdges[J],de=A.binEdges[J+1];if(ee===void 0||ie===void 0){x.current.style.display="none";return}const ye=(ie/A.totalCount*100).toFixed(1);x.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${D(oe)} - ${D(de)}</div>
              <div class="text-muted-foreground">Count: ${ie.toLocaleString()} (${ye}%)</div>
            `,x.current.style.display="block",x.current.style.left="0px",x.current.style.top="0px";const ge=x.current.getBoundingClientRect(),Me=p.current.getBoundingClientRect();let fe=Me.left+se+15;fe+ge.width+20>window.innerWidth&&(fe=Me.left+se-ge.width-15+le.bbox.left),fe=Math.max(4,fe);let Se=Me.top-ge.height+20;Se<4&&(Se=Me.top+8),x.current.style.left=`${fe-ge.left}px`,x.current.style.top=`${Se-ge.top}px`}]}};m.current&&m.current.destroy();const X=new ps(H,V,k);m.current=X;const j=new ResizeObserver(le=>{for(const se of le){const{width:J,height:ee}=se.contentRect;X&&J>0&&ee>0&&X.setSize({width:J,height:ee})}});return j.observe(k),()=>{j.disconnect(),X.destroy(),m.current=null}},[A,N,i,D,c]);const R=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]),L=S&&(!M||C);return f.jsxs("div",{ref:d,className:bt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",L&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l,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(qa,{className:"h-3.5 w-3.5"})})})]}),N?f.jsxs("div",{className:"h-40 relative bg-background rounded",ref:p,onMouseLeave:R,children:[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"}}),M&&!C&&f.jsx(Zl,{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:S?"Loading...":e==null?"Select a step to view histogram":"No data"})]})}const aT=100;function kNe(t,e,n){const r=t.length;if(r<=aT)return{steps:t,counts:e};const i=Math.ceil(r/aT),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 RNe({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:o,onRemove:a,selectedStepAtom:l=jT,maxSelectableStep:c,scrollRoot:d=null,headerPrefix:p}){const m=qn(gs),{isFullscreen:x,toggleFullscreen:b,fullscreenPortal:_}=UZ(),S=w.useRef(null),M=w.useRef(null),C=w.useRef(null),A=w.useRef(null),N=w.useRef(null),D=td(l),[R,L]=w.useState(0),O=mP(S,{root:d,threshold:0})||x,{data:F,isFetching:B,isRefetching:Y,isPlaceholderData:V}=fW(t,e,O&&!!t&&!!e,o),q=F&&F.steps.length>0&&F.bin_edges.length>0,G=q&&F.steps.length>aT,$=w.useMemo(()=>!q||!F?null:G?kNe(F.steps,F.counts,F.bin_edges):{steps:F.steps,counts:F.counts},[q,F,G]),Q=w.useCallback(le=>le==null?"N/A":i?Math.round(le).toLocaleString():gu(le),[i]),K=w.useCallback(le=>Math.abs(le)>=1e3?`${parseFloat((le/1e3).toFixed(1))}k`:i?Math.round(le).toString():Number.isInteger(le)?le.toLocaleString():Math.abs(le)<.01&&le!==0?le.toExponential(1):String(parseFloat(le.toFixed(2))),[i]),re=w.useCallback(()=>{const le={top:8,right:8,bottom:24,left:40};if(!C.current||!F)return le;const se=C.current.getContext("2d");if(!se)return le;const J="10px system-ui, sans-serif",ee=5;let ie=0;se.save(),se.setTransform(1,0,0,1,0,0),se.font=J;for(let oe=0;oe<ee;oe++){const de=(F.global_min??0)+oe/(ee-1)*((F.global_max??0)-(F.global_min??0)),ye=K(de);ie=Math.max(ie,se.measureText(ye).width)}return se.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(ie)+12)}},[F,K]);w.useEffect(()=>{if(!M.current||!C.current||!q||!F||!$)return;const le=M.current,se=C.current,J=se.getContext("2d");if(!J)return;const ee=le.clientWidth,ie=le.clientHeight||160,oe=m?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de=m?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ye="10px system-ui, sans-serif",ge=window.devicePixelRatio||1;se.width=ee*ge,se.height=ie*ge,se.style.width=`${ee}px`,se.style.height=`${ie}px`,J.scale(ge,ge),J.font=ye,J.clearRect(0,0,ee,ie);const Me=re(),fe=ee-Me.left-Me.right,Se=ie-Me.top-Me.bottom,me=$.steps,Pe=F.bin_edges,ce=$.counts,He=me.length,Be=Pe.length-1;if(He===0||Be===0)return;let Ge=0;for(const Re of ce)for(const Ae of Re)Ae>Ge&&(Ge=Ae);const We=Math.min(5,He),ae=5,Z=fe/Math.max(He,1),he=Re=>Me.left+(Re+.5)*Z,be=Re=>{const Ae=(F.global_max??1)-(F.global_min??0),Oe=(Re-(F.global_min??0))/(Ae||1);return Me.top+Se-Oe*Se},we=Re=>Re===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Re/Ge)*.75})`;J.strokeStyle=de,J.lineWidth=1;for(let Re=0;Re<We;Re++){const Ae=Math.floor(Re/Math.max(We-1,1)*(He-1)),Oe=he(Ae);J.beginPath(),J.moveTo(Oe,Me.top),J.lineTo(Oe,ie-Me.bottom),J.stroke()}for(let Re=0;Re<ae;Re++){const Ae=(F.global_min??0)+Re/(ae-1)*((F.global_max??0)-(F.global_min??0)),Oe=be(Ae);J.beginPath(),J.moveTo(Me.left,Oe),J.lineTo(ee-Me.right,Oe),J.stroke()}const ve=Z;for(let Re=0;Re<He;Re++){const Ae=Me.left+Re*Z,Oe=ce[Re];for(let qe=0;qe<Be;qe++){const Fe=Oe[qe];if(Fe===0)continue;const Ke=Pe[qe+1],je=Pe[qe],Te=be(Ke),Xe=be(je),ht=Math.max(1,Xe-Te);J.fillStyle=we(Fe),J.fillRect(Ae,Te,ve,ht)}}if(r&&(F.global_min??0)<0&&(F.global_max??0)>0){const Re=be(0);J.strokeStyle=m?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",J.lineWidth=1,J.setLineDash([5,5]),J.beginPath(),J.moveTo(Me.left,Re),J.lineTo(ee-Me.right,Re),J.stroke(),J.setLineDash([])}if(s!=null){let Re=-1,Ae=1/0;for(let Oe=0;Oe<me.length;Oe++){const qe=Math.abs(me[Oe]-s);qe<Ae&&(Ae=qe,Re=Oe)}if(Re>=0){const Oe=he(Re);J.strokeStyle=m?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",J.lineWidth=1,J.beginPath(),J.moveTo(Oe,Me.top),J.lineTo(Oe,ie-Me.bottom),J.stroke()}}J.strokeStyle=oe,J.lineWidth=1,J.beginPath(),J.moveTo(Me.left,ie-Me.bottom),J.lineTo(ee-Me.right,ie-Me.bottom),J.stroke(),J.beginPath(),J.moveTo(Me.left,Me.top),J.lineTo(Me.left,ie-Me.bottom),J.stroke(),J.fillStyle=oe,J.font=ye,J.textAlign="center";for(let Re=0;Re<We;Re++){const Ae=Math.floor(Re/Math.max(We-1,1)*(He-1)),Oe=me[Ae],qe=he(Ae),Fe=Oe>=1e3?`${(Oe/1e3).toFixed(0)}k`:Oe.toString();J.fillText(Fe,qe,ie-6)}J.textAlign="right",J.textBaseline="middle";for(let Re=0;Re<ae;Re++){const Ae=(F.global_min??0)+Re/(ae-1)*((F.global_max??0)-(F.global_min??0)),Oe=be(Ae);J.fillText(K(Ae),Me.left-4,Oe)}},[F,$,q,r,s,K,re,m,R,x]),w.useEffect(()=>{if(!M.current)return;const le=M.current,se=new ResizeObserver(()=>{L(J=>J+1)});return se.observe(le),()=>{se.disconnect()}},[]);const U=w.useCallback(le=>{if(!F||!$||!C.current||!M.current)return;const se=C.current.getBoundingClientRect(),J=le.clientX-se.left,ee=M.current.clientWidth,ie=re(),oe=ee-ie.left-ie.right;if(oe<=0)return;const de=(J-ie.left)/oe,ye=Math.round(de*($.steps.length-1));if(ye>=0&&ye<$.steps.length){let ge=$.steps[ye];c!=null&&ge>c&&(ge=c),D(ge)}},[F,$,re,D,c]),H=w.useCallback(le=>{var Fe;if(!F||!$||!A.current||!C.current||!M.current)return;const se=C.current.getBoundingClientRect(),J=le.clientX-se.left,ee=le.clientY-se.top,ie=M.current.clientWidth,oe=M.current.clientHeight||160,de=re(),ye=ie-de.left-de.right,ge=oe-de.top-de.bottom;if(ye<=0||ge<=0){N.current&&(N.current.style.display="none");return}if(J<de.left||J>ie-de.right||ee<de.top||ee>oe-de.bottom){A.current.style.display="none",N.current&&(N.current.style.display="none");return}const Me=(J-de.left)/ye,fe=Math.min($.steps.length-1,Math.max(0,Math.round(Me*($.steps.length-1)))),Se=$.steps[fe];if(N.current){const Ke=ye/Math.max($.steps.length,1),je=de.left+(fe+.5)*Ke;N.current.style.display="block",N.current.style.left=`${je}px`,N.current.style.top=`${de.top}px`,N.current.style.bottom=`${de.bottom}px`}const me=1-(ee-de.top)/ge,Pe=F.bin_edges.length-1,ce=Math.min(Pe-1,Math.max(0,Math.floor(me*Pe))),He=F.bin_edges[ce],Be=F.bin_edges[ce+1],Ge=((Fe=$.counts[fe])==null?void 0:Fe[ce])??0,ae=($.counts[fe]??[]).reduce((Ke,je)=>Ke+je,0),Z=ae>0?(Ge/ae*100).toFixed(1):"0.0",be=G&&F.steps.length>aT?" (aggregated)":"";A.current.innerHTML=`
        <div class="font-medium mb-1">Step ${Se.toLocaleString()}${be}</div>
        <div class="text-muted-foreground">Range: ${Q(He)} to ${Q(Be)}</div>
        <div class="text-muted-foreground">Count: ${Ge.toLocaleString()} (${Z}%)</div>
      `,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const we=A.current.getBoundingClientRect(),ve=le.clientX;let Re=ve;Re+we.width+20>window.innerWidth&&(Re=ve-we.width);const Ae=Math.max(4,window.innerWidth-we.width-4);Re=Math.min(Math.max(4,Re),Ae);const Oe=M.current.getBoundingClientRect();let qe=Oe.top-we.height+20;qe<4&&(qe=Oe.top+8),A.current.style.left=`${Re-we.left}px`,A.current.style.top=`${qe-we.top}px`},[F,$,Q,re,G]),X=w.useCallback(()=>{A.current&&(A.current.style.display="none"),N.current&&(N.current.style.display="none")},[]),j=B&&(!Y||V);return _(f.jsxs("div",{ref:S,className:bt("group/card bg-background",x?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!x&&j&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[!x&&p,f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",x?"text-sm":"text-xs"),title:n,children:n})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(BZ,{isFullscreen:x,onClick:b}),!x&&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(qa,{className:"h-3.5 w-3.5"})})]})]}),q?f.jsxs("div",{className:bt("relative bg-background rounded",x?"flex-1 min-h-0":"h-40"),ref:M,children:[f.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:C,onClick:U,onMouseMove:H,onMouseLeave:X}),f.jsx("div",{ref:N,className:"absolute z-[2] border-l border-dashed border-border pointer-events-none",style:{display:"none"}}),f.jsx("div",{ref:A,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"}}),Y&&!V&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):f.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",x?"flex-1 min-h-0":"h-40"),children:B?"Loading...":"No data"})]}))}function rw(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function PNe(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function DN(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 HF(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 IN(t,e,n=85,r=!1){if(t===null||e===null||e<=0)return null;const i=Math.max(0,Math.min(e,t));return r?`hsl(0 0% ${30+i/e*60}%)`:`hsl(0 0% ${n-i/e*(n-5)}%)`}function vP({openAtom:t=J7}={}){const[e,n]=hn(t);return!qn(bl)||e?null:f.jsx(En,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const VF=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function yP({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=J7,selectedGroupIdAtom:x=eW,selectedSampleIdxAtom:b=tW,viewModeAtom:_=rW,getGroupBadge:S,renderLeftControls:M,onGroupClick:C,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var ht,ke,et,ct,yt,lt,Je,Ee,Ze;const[D,R]=hn(m),[L,k]=hn(x),[O,F]=hn(b),[B,Y]=hn(_),[V,q]=hn(Nce),[G,$]=hn(kce),Q=qn(bl),K=qn(gs),{data:re}=gd(Q||"",!!Q,!0),U=(ht=re==null?void 0:re.config)==null?void 0:ht.max_tokens,H=w.useMemo(()=>HF(U),[U]),X=(ke=re==null?void 0:re.config)==null?void 0:ke.group_size,j=w.useMemo(()=>HF(X),[X]),le=w.useMemo(()=>{if(j==null||j<=1)return null;const Ie=Math.sqrt(j-1);return{min:-Ie,max:Ie}},[j]),se=N??((et=re==null?void 0:re.config)==null?void 0:et.environments),J=w.useMemo(()=>Uw(se),[se]),ee=w.useMemo(()=>{var ut;const Ie=Mp(se),Ue=Mp((ut=re==null?void 0:re.summary)==null?void 0:ut.env_details),rt=Bw(re==null?void 0:re.data_metric_ranges);return Tp(Tp(Ie,Ue),rt)},[se,(ct=re==null?void 0:re.summary)==null?void 0:ct.env_details,re==null?void 0:re.data_metric_ranges]),ie=w.useMemo(()=>{var Ue;const Ie=[se,(Ue=re==null?void 0:re.summary)==null?void 0:Ue.env_details];for(const rt of Ie){const ut=h9(rt);if(ut.length!==0)return ut.some(Dt=>(Dt==null?void 0:Dt.is_multi_turn)===!0)}return!1},[se,(yt=re==null?void 0:re.summary)==null?void 0:yt.env_details]),[oe,de]=w.useState(new Map),ye=w.useMemo(()=>{if(!r)return null;const Ie=new Map;for(const Ue of r){let rt=Ie.get(Ue.sample_idx);rt||(rt=new Map,Ie.set(Ue.sample_idx,rt)),rt.set(Ue.metric_name,{value:Ue.value,env:Ue.env})}return Ie},[r]);ye!==null&&ye!==oe&&de(ye);const ge=ye??oe,[Me,fe]=w.useState([]),Se=w.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const Ie=new Set;for(const Ue of r)Ie.add(Ue.metric_name);return[...Ie].sort()},[i,r]);Se!==null&&Se!==Me&&fe(Se);const me=Se??Me,Pe=(Ie,Ue)=>{q(rt=>Ue===!0?rt.includes(Ie)?rt:[...rt,Ie]:rt.filter(ut=>ut!==Ie))};w.useEffect(()=>{if(!me.length&&!e)return;const Ie=new Set;A&&(Ie.add("reward"),Ie.add("advantage")),ie?Ie.add("gen_length"):(Ie.add("gen_length_sum"),Ie.add("gen_length_avg"));const Ue=VF.filter(ut=>!Ie.has(ut)),rt=new Set([...Ue,...me]);q(ut=>{let Dt=ut;!ie&&!ut.includes("gen_length")&&(ut.includes("gen_length_avg")||ut.includes("gen_length_sum"))?Dt=[...Dt.filter(St=>St!=="gen_length_avg"&&St!=="gen_length_sum"),"gen_length"]:ie&&!ut.includes("gen_length_avg")&&ut.includes("gen_length")&&(Dt=[...Dt.filter(St=>St!=="gen_length"),"gen_length_avg"]);const Rt=Dt.filter(St=>rt.has(St));return Rt.length===ut.length&&Rt.every((St,Ht)=>St===ut[Ht])?ut:Rt})},[me,e,q,A,ie]);const ce=w.useMemo(()=>{const Ie=new Set;A&&(Ie.add("reward"),Ie.add("advantage")),ie?Ie.add("gen_length"):(Ie.add("gen_length_sum"),Ie.add("gen_length_avg"));const Ue=[],rt=new Set;for(const ut of VF)Ie.has(ut)||V.includes(ut)&&!rt.has(ut)&&(Ue.push(ut),rt.add(ut));for(const ut of me)V.includes(ut)&&!rt.has(ut)&&(Ue.push(ut),rt.add(ut));return Ue},[V,me,A,ie]),[He,Be]=w.useState([]),Ge=w.useRef(0),We=w.useRef(null),ae=w.useRef(o),Z=w.useRef(0);w.useEffect(()=>{var rt;const Ie=(rt=We.current)==null?void 0:rt.querySelector('[data-slot="scroll-area-viewport"]');if(!Ie)return;const Ue=()=>{Z.current=Ie.scrollTop};return Ie.addEventListener("scroll",Ue,{passive:!0}),()=>Ie.removeEventListener("scroll",Ue)},[D]),w.useEffect(()=>{var Ie;if(o!==ae.current){ae.current=o,Ge.current=0,Z.current=0;const Ue=(Ie=We.current)==null?void 0:Ie.querySelector('[data-slot="scroll-area-viewport"]');Ue&&(Ue.scrollTop=0)}},[o]);const he=w.useMemo(()=>{if(!t)return new Map;const Ie=new Map;for(const Ue of t)Ie.set(Ue.group_id,Ue);return Ie},[t]),be=w.useMemo(()=>{if(!n)return new Map;const Ie=new Map;for(const Ue of n)Ie.set(Ue.sample_idx,Ue);return Ie},[n]),we=w.useMemo(()=>{if(!e)return null;const Ie=new Map,Ue=new Map;for(const Rt of e){const St=Ie.get(Rt.sample_idx)||[];St.push(Rt),Ie.set(Rt.sample_idx,St),Ue.set(Rt.sample_idx,Rt.group_id)}const rt=new Map;for(const[Rt,St]of Ie){const Ht=[...St].sort((wt,Zt)=>wt.turn_order-Zt.turn_order),en=Ue.get(Rt)??-1,Ut=he.get(en)??null,$e=be.get(Rt),dt=Ht.find(wt=>wt.turn_type==="model"),Tt=(dt==null?void 0:dt.content)??"";let Bt=null,Ct=null,At=0,Ot=0;for(const wt of Ht)wt.turn_type==="model"&&typeof wt.tokens=="number"&&(At+=wt.tokens,Ot+=1);Ot>0&&(Bt=At/Ot,Ct=At);const cn={sample_idx:Rt,group_id:en,prompt:Ut,responsePreview:Tt,turnsCount:Ht.length,turnsData:Ht,reward:($e==null?void 0:$e.reward)??null,advantage:($e==null?void 0:$e.advantage)??null,assistantTokens:Bt,assistantTokensTotal:Ct},Lt=rt.get(en)||[];Lt.push(cn),rt.set(en,Lt)}const ut=[];for(const[Rt,St]of rt){const Ht=he.get(Rt)??null;St.sort((en,Ut)=>en.sample_idx-Ut.sample_idx),ut.push({group_id:Rt,prompt:Ht,samples:St,sampleCount:St.length})}return ut.sort((Rt,St)=>Rt.group_id-St.group_id)},[e,he,be]);we!==null&&we!==He&&Be(we);const ve=we??He;w.useLayoutEffect(()=>{var Ue;const Ie=(Ue=We.current)==null?void 0:Ue.querySelector('[data-slot="scroll-area-viewport"]');Ie&&Z.current>0&&Ie.scrollTop!==Z.current&&(Ie.scrollTop=Z.current)},[ve]);const Re=w.useMemo(()=>L===null?null:ve.find(Ie=>Ie.group_id===L)??null,[ve,L]),Ae=Re!==null,Oe=w.useMemo(()=>{let Ie=0;for(const Ue of ve)for(const rt of Ue.samples)rt.assistantTokens!==null&&rt.assistantTokens>Ie&&(Ie=rt.assistantTokens);return Ie>0?Ie:null},[ve]),qe=H??Oe,Fe=w.useMemo(()=>{let Ie=0;for(const Ue of ve)for(const rt of Ue.samples)rt.assistantTokensTotal!==null&&rt.assistantTokensTotal>Ie&&(Ie=rt.assistantTokensTotal);return Ie>0?Ie:null},[ve]),Ke=H!=null?Math.max(H,Fe??0)||null:Fe;w.useEffect(()=>{!Ae&&B==="samples"&&!s&&Y("groups")},[Ae,B,Y,s]);const je=Ie=>{var rt;const Ue=(rt=We.current)==null?void 0:rt.querySelector('[data-slot="scroll-area-viewport"]');if(Ue&&(Ge.current=Ue.scrollTop),C){const ut=ve.find(Dt=>Dt.group_id===Ie);ut&&C(Ie,ut);return}k(Ie),Y("samples")},Te=Ie=>{F(Ie)},Xe=Ie=>{var Ue;if(Ie==="samples"&&!Ae){Y("groups");return}if(Ie==="groups"||Ie==="samples"){if(B==="groups"&&Ie==="samples"){const rt=(Ue=We.current)==null?void 0:Ue.querySelector('[data-slot="scroll-area-viewport"]');rt&&(Ge.current=rt.scrollTop)}Y(Ie)}};return w.useEffect(()=>{B==="groups"&&Ge.current>0&&requestAnimationFrame(()=>{var Ue;const Ie=(Ue=We.current)==null?void 0:Ue.querySelector('[data-slot="scroll-area-viewport"]');Ie&&(Ie.scrollTop=Ge.current,Z.current=Ge.current)})},[B]),w.useEffect(()=>{B!=="samples"||O===null||requestAnimationFrame(()=>{var rt;const Ie=(rt=We.current)==null?void 0:rt.querySelector('[data-slot="scroll-area-viewport"]');if(!Ie)return;const Ue=Ie.querySelector(`[data-sample-idx="${O}"]`);Ue&&(Ue.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{Z.current=Ie.scrollTop},350))})},[B,O]),!Q||!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(p9,{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:[M?M({viewMode:B,setViewMode:Y,hasSelectedGroupInStep:Ae,groups:ve}):f.jsxs(dm,{type:"single",variant:"outline",size:"sm",value:B,onValueChange:Xe,children:[f.jsx(Xa,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),f.jsx(Xa,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!Ae,children:"Samples"})]}),f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",children:f.jsx(aW,{className:"h-4 w-4"})})}),f.jsxs(lo,{align:"end",className:"min-w-[180px]",children:[f.jsx(om,{children:"Settings"}),f.jsx(Bs,{}),f.jsx(Er,{checked:G,onCheckedChange:Ie=>$(Ie===!0),onSelect:Ie=>Ie.preventDefault(),children:"Show Tooltips"})]})]}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",children:f.jsx(Ek,{className:"h-4 w-4"})})}),f.jsxs(lo,{align:"end",className:"min-w-[180px]",children:[f.jsx(om,{children:"Display Metrics"}),f.jsx(Bs,{}),ie?f.jsxs(f.Fragment,{children:[f.jsx(Er,{checked:V.includes("gen_length_sum"),onCheckedChange:Ie=>Pe("gen_length_sum",Ie),onSelect:Ie=>Ie.preventDefault(),children:"Gen. Length Sum"}),f.jsx(Er,{checked:V.includes("gen_length_avg"),onCheckedChange:Ie=>Pe("gen_length_avg",Ie),onSelect:Ie=>Ie.preventDefault(),children:"Gen. Length Avg"})]}):f.jsx(Er,{checked:V.includes("gen_length"),onCheckedChange:Ie=>Pe("gen_length",Ie),onSelect:Ie=>Ie.preventDefault(),children:"Gen. Length"}),!A&&f.jsx(Er,{checked:V.includes("reward"),onCheckedChange:Ie=>Pe("reward",Ie),onSelect:Ie=>Ie.preventDefault(),children:"Reward"}),!A&&f.jsx(Er,{checked:V.includes("advantage"),onCheckedChange:Ie=>Pe("advantage",Ie),onSelect:Ie=>Ie.preventDefault(),children:"Advantage"}),me.length>0&&f.jsx(Bs,{}),me.map(Ie=>f.jsx(Er,{checked:V.includes(Ie),onCheckedChange:Ue=>Pe(Ie,Ue),onSelect:Ue=>Ue.preventDefault(),children:YR(Ie)},Ie))]})]}),f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>R(!1),children:f.jsx(Vue,{className:"h-4 w-4"})})]})]})]}),f.jsx(Px,{ref:We,className:bt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:ve.length===0?f.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):B==="groups"||!Re?f.jsx("div",{className:"p-2 space-y-1",children:ve.map(Ie=>f.jsx(DNe,{group:Ie,onClick:()=>je(Ie.group_id),isSelected:L===Ie.group_id,tokenScaleMax:qe,tokenScaleSumMax:Ke,envRewardRanges:J,envMetricRanges:ee,advantageRange:le,badge:S?S(Ie):null,displayMetrics:ce,metricsBySampleIdx:ge,tooltipsEnabled:G,darkMode:K},Ie.group_id))}):f.jsxs("div",{className:"flex flex-col min-h-0",children:[f.jsxs(Nx,{delayDuration:300,open:G?void 0:!1,children:[f.jsx(kx,{asChild:!0,children:f.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((lt=Re.prompt)==null?void 0:lt.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:rw(Re.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:rw((Je=Re.prompt)==null?void 0:Je.prompt,150)})]})]})}),f.jsxs(Rx,{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:[((Ee=Re.prompt)==null?void 0:Ee.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:Re.prompt.system_prompt})]}),((Ze=Re.prompt)==null?void 0:Ze.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:Re.prompt.prompt})]})]})]}),f.jsx("div",{className:"p-2 space-y-1",children:Re.samples.map(Ie=>f.jsx("div",{"data-sample-idx":Ie.sample_idx,children:f.jsx(jNe,{sample:Ie,isSelected:O===Ie.sample_idx,onClick:()=>Te(Ie.sample_idx),envRewardRanges:J,envMetricRanges:ee,advantageRange:le,displayMetrics:ce,metricsBySampleIdx:ge,tokenScaleMax:qe,tokenScaleSumMax:Ke,tooltipsEnabled:G,darkMode:K})},Ie.sample_idx))})]})})]})}function DNe({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:o,advantageRange:a,badge:l,displayMetrics:c,metricsBySampleIdx:d,tooltipsEnabled:p,darkMode:m}){var x,b,_,S;return f.jsxs(Nx,{delayDuration:300,open:p?void 0:!1,children:[f.jsx(kx,{asChild:!0,children:f.jsx("button",{onClick:e,className:bt("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:[((x=t.prompt)==null?void 0:x.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:rw(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:rw((b=t.prompt)==null?void 0:b.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(M=>f.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(C=>{const A=KR(C,M,d,r,i,s,a,o,void 0,m);return f.jsx("div",{title:A.label,className:bt("h-1.5 w-1.5 rounded-none",A.color?"":"bg-muted"),style:A.color?{backgroundColor:A.color}:void 0},C.sample_idx)})},M))})]})})}),f.jsxs(Rx,{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:[((_=t.prompt)==null?void 0:_.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})]}),((S=t.prompt)==null?void 0:S.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 INe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function YR(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function HZ(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function ONe(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return HZ(t)}}function LNe(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 KR(t,e,n,r,i,s,o,a,l,c){var d,p;switch(e){case"gen_length":return{value:t.assistantTokensTotal,color:IN(t.assistantTokensTotal,i,l,c),label:t.assistantTokensTotal!==null?`Gen. Length: ${t.assistantTokensTotal}`:"Gen. Length: n/a"};case"gen_length_sum":return{value:t.assistantTokensTotal,color:IN(t.assistantTokensTotal,i,l,c),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:IN(t.assistantTokens,r,l,c),label:t.assistantTokens!==null?`Gen. Length Avg: ${Math.round(t.assistantTokens)}`:"Gen. Length Avg: n/a"};case"reward":{const m=((d=t.prompt)==null?void 0:d.env)??null,x=m?s==null?void 0:s.get(m):void 0;return{value:t.reward,color:t.reward!==null?DN(t.reward,(x==null?void 0:x.min)??null,(x==null?void 0:x.max)??null)??PNe(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?DN(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 m=n.get(t.sample_idx),x=m==null?void 0:m.get(e);if(!x)return{value:null,color:null,label:`${YR(e)}: n/a`};const b=x.env??((p=t.prompt)==null?void 0:p.env)??null,_=LNe(a,b,e),S=DN(x.value,(_==null?void 0:_.min)??null,(_==null?void 0:_.max)??null,_==null?void 0:_.invert);return{value:x.value,color:S??null,label:`${YR(e)}: ${HZ(x.value)}`}}}}function jNe({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:o,metricsBySampleIdx:a,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:d,darkMode:p}){return f.jsxs(Nx,{delayDuration:300,open:d?void 0:!1,children:[f.jsx(kx,{asChild:!0,children:f.jsx("button",{onClick:n,className:bt("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(m=>KR(t,m,a,l,c,r,s,i,70,p).value!==null).length):2,overflowWrap:"anywhere"},children:rw(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(m=>{const x=KR(t,m,a,l,c,r,s,i,70,p);return x.value===null?null:f.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:x.color?{color:x.color}:void 0,title:x.label,children:ONe(x.value,m)},m)})})})]})})}),f.jsx(Rx,{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(m=>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:INe(m.turn_type)}),m.tokens!=null&&f.jsxs("span",{className:"font-normal normal-case",children:[m.tokens.toLocaleString()," tokens"]})]}),f.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:m.content||"(empty)"})]},`${m.sample_idx}-${m.turn_order}`)),t.turnsData.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function zNe(){var fe,Se,me,Pe,ce;const t=qn(bl),[e]=l7(),[n,r]=hn(jT),[i,s]=hn(eW),[o,a]=hn(tW),l=qn(nW),[c,d]=hn(J7),[,p]=hn(rW),m=qn(Q7),[x,b]=hn(UT),[_,S]=hn(BT),M=x.length+(_?1:0),C=He=>{b(Be=>Be.includes(He)?Be.filter(Ge=>Ge!==He):[...Be,He])},[A,N]=w.useState(0),[D,R]=w.useState(0),[L,k]=w.useState(!0),O=!0,F=w.useMemo(()=>{const He=e.get("step");if(!He)return null;const Be=Number(He);return Number.isFinite(Be)?Be:null},[e]),B=w.useMemo(()=>{const He=e.get("sample");if(!He)return null;const Be=Number(He);return Number.isFinite(Be)?Be:null},[e]),Y=w.useMemo(()=>{const He=e.get("group");if(!He)return null;const Be=Number(He);return Number.isFinite(Be)?Be:null},[e]),V=w.useRef(null),q=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){V.current=null,q.current={group:null,sample:null};return}if(F==null){V.current=null;return}F!==V.current&&(r(F),V.current=F)},[F,t,r]),w.useEffect(()=>{t&&(Y==null||B==null||q.current.group===Y&&q.current.sample===B||(s(Y),a(B),d(!0),p("samples"),q.current={group:Y,sample:B}))},[Y,B,t,s,a,d,p]);const{data:G,isLoading:$,error:Q}=vde(t||"",n,!!t),{data:K}=gd(t||"",!!t,O),re=w.useMemo(()=>{var He;return Uw((He=K==null?void 0:K.config)==null?void 0:He.environments)},[(fe=K==null?void 0:K.config)==null?void 0:fe.environments]),U=w.useMemo(()=>{var We,ae;const He=Mp((We=K==null?void 0:K.config)==null?void 0:We.environments),Be=Mp((ae=K==null?void 0:K.summary)==null?void 0:ae.env_details),Ge=Bw(K==null?void 0:K.data_metric_ranges);return Tp(Tp(He,Be),Ge)},[(Se=K==null?void 0:K.config)==null?void 0:Se.environments,(me=K==null?void 0:K.summary)==null?void 0:me.env_details,K==null?void 0:K.data_metric_ranges]),H=w.useMemo(()=>{var We;const He=(We=K==null?void 0:K.config)==null?void 0:We.group_size,Be=typeof He=="object"&&He!==null&&"value"in He?Number(He.value):Number(He);if(!Be||isNaN(Be)||Be<=1)return null;const Ge=Math.sqrt(Be-1);return{min:-Ge,max:Ge}},[(Pe=K==null?void 0:K.config)==null?void 0:Pe.group_size]),X=w.useMemo(()=>{var He;return(He=G==null?void 0:G.available_steps)!=null&&He.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G,n]);w.useEffect(()=>{X!==null&&n===null&&F==null&&r(X)},[X,F,n,r]);const j=He=>{r(He)},[le,se]=w.useState([]),[J,ee]=w.useState(null);t!==J&&(se([]),ee(t));const ie=G==null?void 0:G.available_steps,oe=w.useMemo(()=>{const He=ie??[];return[...new Set([...le,...He])].sort((Ge,We)=>Ge-We)},[ie,le]);oe.length>le.length&&se(oe);const de=oe.length>0,ye=de?oe[oe.length-1]:0,ge=w.useMemo(()=>{if(n==null)return oe.length-1;const He=oe.indexOf(n);return He>=0?He:oe.length-1},[oe,n]),Me=He=>{He>=0&&He<oe.length&&j(oe[He])};return t?f.jsxs("div",{className:"flex h-full overflow-hidden",children:[f.jsx(yP,{prompts:G==null?void 0:G.prompts,data:G==null?void 0:G.rollouts,samplesData:G==null?void 0:G.samples_data,rolloutMetrics:G==null?void 0:G.rollout_metrics,availableMetricNames:G==null?void 0:G.available_rollout_metric_names,isLoading:$,step:n??void 0,currentStepIndex:ge,totalSteps:oe.length,onStepChange:Me,hasSteps:de,stepValues:oe}),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(vP,{}),l&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step ",((ce=l.sample.turns[0])==null?void 0:ce.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(RC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&f.jsxs(f.Fragment,{children:[f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(He=>He+1),k(!1)},children:"Collapse All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{R(He=>He+1),k(!0)},children:"Expand All"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsxs(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),f.jsxs(lo,{align:"start",className:"w-auto",children:[f.jsx(Er,{checked:_,onCheckedChange:He=>S(!!He),onSelect:He=>He.preventDefault(),children:"Format Think"}),f.jsx(Er,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:He=>He.preventDefault(),children:"Markdown"}),f.jsx(Er,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:He=>He.preventDefault(),children:"LaTeX"}),f.jsx(Er,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:He=>He.preventDefault(),children:"Code"})]})]})]})]}),f.jsx(gP,{})]})})}),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:[Q&&f.jsx(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",Q instanceof Error?Q.message:"Unknown error"]})})}),f.jsx(I1,{prompts:G==null?void 0:G.prompts,data:G==null?void 0:G.rollouts,samplesData:G==null?void 0:G.samples_data,rolloutMetrics:G==null?void 0:G.rollout_metrics,goldenAnswers:G==null?void 0:G.golden_answers,infoTurns:G==null?void 0:G.info_turns,isLoading:$,step:n??void 0,scrollToSampleId:B,filterGroupId:i,filterSampleIdx:o,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:L,envRewardRanges:re,envMetricRanges:U,advantageRange:H,renderOptions:x,formatThinkBlocks:_})]})})]}),f.jsx(xP,{currentStep:n,maxSelectableStep:ye})]}):f.jsx(Rm,{description:"Select a run from the sidebar to view rollouts."})}function FNe(){var be,we,ve,Re,Ae;const t=qn(bl),[e]=l7(),[n,r]=hn(xI),[i,s]=hn(vI),[o,a]=hn(yI),l=qn(bI),[c,d]=hn(wA),[,p]=hn(_I),m=qn(SA),[x,b]=hn(UT),[_,S]=hn(BT),M=x.length+(_?1:0),C=Oe=>{b(qe=>qe.includes(Oe)?qe.filter(Fe=>Fe!==Oe):[...qe,Oe])},[A,N]=w.useState(0),[D,R]=w.useState(0),[L,k]=w.useState(!0),O=!0,F=w.useMemo(()=>{const Oe=e.get("step")??e.get("trainer_step");if(!Oe)return null;const qe=Number(Oe);return Number.isFinite(qe)?qe:null},[e]),B=w.useMemo(()=>{const Oe=e.get("sample");if(!Oe)return null;const qe=Number(Oe);return Number.isFinite(qe)?qe:null},[e]),Y=w.useMemo(()=>{const Oe=e.get("group");if(!Oe)return null;const qe=Number(Oe);return Number.isFinite(qe)?qe:null},[e]),V=w.useRef(null),q=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){V.current=null,q.current={group:null,sample:null};return}if(F==null){V.current=null;return}F!==V.current&&(r(F),V.current=F)},[F,t,r]),w.useEffect(()=>{t&&(Y==null||B==null||q.current.group===Y&&q.current.sample===B||(s(Y),a(B),d(!0),p("samples"),q.current={group:Y,sample:B}))},[Y,B,t,s,a,d,p]);const{data:G,isLoading:$,error:Q}=yde(t||"",n,!!t),{data:K}=gd(t||"",!!t,O),re=w.useMemo(()=>{var Oe;return Uw((Oe=K==null?void 0:K.config)==null?void 0:Oe.environments)},[(be=K==null?void 0:K.config)==null?void 0:be.environments]),U=w.useMemo(()=>{var Ke,je;const Oe=Mp((Ke=K==null?void 0:K.config)==null?void 0:Ke.environments),qe=Mp((je=K==null?void 0:K.summary)==null?void 0:je.env_details),Fe=Bw(K==null?void 0:K.data_metric_ranges);return Tp(Tp(Oe,qe),Fe)},[(we=K==null?void 0:K.config)==null?void 0:we.environments,(ve=K==null?void 0:K.summary)==null?void 0:ve.env_details,K==null?void 0:K.data_metric_ranges]),H=w.useMemo(()=>{var Ke;const Oe=(Ke=K==null?void 0:K.config)==null?void 0:Ke.group_size,qe=typeof Oe=="object"&&Oe!==null&&"value"in Oe?Number(Oe.value):Number(Oe);if(!qe||isNaN(qe)||qe<=1)return null;const Fe=Math.sqrt(qe-1);return{min:-Fe,max:Fe}},[(Re=K==null?void 0:K.config)==null?void 0:Re.group_size]),X=w.useMemo(()=>{var Oe;return(Oe=G==null?void 0:G.available_trainer_steps)!=null&&Oe.length&&n===null?G.available_trainer_steps[G.available_trainer_steps.length-1]:null},[G,n]);w.useEffect(()=>{X!==null&&n===null&&F==null&&r(X)},[X,F,n,r]);const j=Oe=>{r(Oe)},[le,se]=w.useState([]),[J,ee]=w.useState(null),[ie,oe]=w.useState(new Map);t!==J&&(se([]),ee(t),oe(new Map));const de=G==null?void 0:G.available_trainer_steps,ye=w.useMemo(()=>{const Oe=de??[];return[...new Set([...le,...Oe])].sort((Fe,Ke)=>Fe-Ke)},[de,le]);ye.length>le.length&&se(ye);const ge=ye.length>0,Me=ge?ye[ye.length-1]:0,fe=w.useMemo(()=>{if(n==null)return ye.length-1;const Oe=ye.indexOf(n);return Oe>=0?Oe:ye.length-1},[ye,n]),Se=Oe=>{Oe>=0&&Oe<ye.length&&j(ye[Oe])},me=w.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(Oe=>({step:Oe.trainer_step,group_id:Oe.group_id,env:Oe.env,system_prompt:Oe.system_prompt,tokens_system_prompt:Oe.tokens_system_prompt,prompt:Oe.prompt,tokens_prompt:Oe.tokens_prompt}))},[G]),Pe=w.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(Oe=>({step:Oe.trainer_step,group_id:Oe.group_id,sample_idx:Oe.sample_idx,turn_order:Oe.turn_order,turn_type:Oe.turn_type,content:Oe.content,tokens:Oe.tokens}))},[G]),ce=w.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(Oe=>({step:Oe.trainer_step,group_id:Oe.group_id,sample_idx:Oe.sample_idx,reward:Oe.reward,advantage:Oe.advantage,turns:Oe.turns,total_tokens:Oe.total_tokens,raw_string:Oe.raw_string}))},[G]),He=w.useMemo(()=>{if(!(G!=null&&G.rollout_metrics))return;const Oe=n??0;return G.rollout_metrics.map(qe=>({step:Oe,sample_idx:qe.sample_idx,env:qe.env,metric_name:qe.metric_name,value:qe.value}))},[G,n]),Be=w.useMemo(()=>{if(!(G!=null&&G.golden_answers))return;const Oe=n??0;return G.golden_answers.map(qe=>({step:Oe,sample_idx:qe.sample_idx,env:qe.env,key:qe.key,value:qe.value}))},[G,n]),Ge=w.useMemo(()=>{if(!(G!=null&&G.info_turns))return;const Oe=n??0;return G.info_turns.map(qe=>({step:Oe,sample_idx:qe.sample_idx,turn_order:qe.turn_order,env:qe.env,info_key:qe.info_key,info_value:qe.info_value,info_type:qe.info_type}))},[G,n]),We=w.useMemo(()=>{if(!(G!=null&&G.prompts))return null;const Oe=new Map;for(const qe of G.prompts)Oe.set(qe.group_id,qe.discard_reason);return Oe},[G]),ae=We??ie;We&&We!==ie&&oe(We);const Z=Oe=>{switch(Oe){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return Oe.split("_").map(qe=>qe.charAt(0).toUpperCase()+qe.slice(1)).join(" ")}},he=Oe=>{switch(Oe){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(yP,{prompts:me,data:Pe,samplesData:ce,rolloutMetrics:He,isLoading:$,step:n??void 0,currentStepIndex:fe,totalSteps:ye.length,onStepChange:Se,hasSteps:ge,stepValues:ye,openAtom:wA,selectedGroupIdAtom:vI,selectedSampleIdxAtom:yI,viewModeAtom:_I,getGroupBadge:Oe=>{const qe=ae.get(Oe.group_id);return qe?f.jsx(uy,{variant:he(qe),className:"text-[10px] h-4 px-1.5",children:Z(qe)}):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(vP,{openAtom:wA}),l&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step"," ",((Ae=l.sample.turns[0])==null?void 0:Ae.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(RC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&f.jsxs(f.Fragment,{children:[f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(Oe=>Oe+1),k(!1)},children:"Collapse All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{R(Oe=>Oe+1),k(!0)},children:"Expand All"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsxs(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),f.jsxs(lo,{align:"start",className:"w-auto",children:[f.jsx(Er,{checked:_,onCheckedChange:Oe=>S(!!Oe),onSelect:Oe=>Oe.preventDefault(),children:"Format Think"}),f.jsx(Er,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:Oe=>Oe.preventDefault(),children:"Markdown"}),f.jsx(Er,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:Oe=>Oe.preventDefault(),children:"LaTeX"}),f.jsx(Er,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:Oe=>Oe.preventDefault(),children:"Code"})]})]})]})]}),f.jsx(gP,{openAtom:SA})]})})}),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:[Q&&f.jsx(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",Q instanceof Error?Q.message:"Unknown error"]})})}),f.jsx(I1,{prompts:me,data:Pe,samplesData:ce,rolloutMetrics:He,goldenAnswers:Be,infoTurns:Ge,isLoading:$,step:n??void 0,scrollToSampleId:B,filterGroupId:i,filterSampleIdx:o,lastValidSampleAtom:bI,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:L,envRewardRanges:re,envMetricRanges:U,advantageRange:H,renderOptions:x,formatThinkBlocks:_})]})})]}),f.jsx(xP,{currentStep:n,maxSelectableStep:Me,openAtom:SA,selectedMetricsAtom:Ace,selectedStepAtom:xI,includeDiscardedDefaults:!0})]}):f.jsx(Rm,{description:"Select a run from the sidebar to view discarded rollouts."})}function UNe(){const t=qn(bl),{data:e,error:n}=gd(t||"",!!t,!1),r=w.useMemo(()=>LZ(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(zZ,{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(Rm,{description:"Select a run from the sidebar to view cluster topology."})}const hs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],ZR=["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"],GF=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],WF=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],$F=["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 BNe(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 lT(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function iw(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 QR(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:lT(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?hs[s%hs.length]:hs[i.gpu_index%hs.length]}))}function HNe(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:lT(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?hs[s%hs.length]:hs[i.gpu_index%hs.length]}))}function JR({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:bt("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?iw(i.color,.25):i.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function VNe({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:bt("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?iw(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:bt("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?iw(s.color,.25):s.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function VZ(t){const e=Math.abs(t);if(e>=60)return eC(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 ud(t)}const GZ=28;function WZ(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 $Z(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 j1({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(qa,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function qZ(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?$l.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function XZ({isFullscreen:t,onClick:e}){return f.jsx("button",{onClick:e,className:bt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?f.jsx($T,{className:"h-3 w-3"}):f.jsx(WT,{className:"h-3 w-3"})})}function GNe({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=qn(gs),{isFullscreen:a,toggleFullscreen:l,fullscreenPortal:c}=qZ(),d=w.useRef(null),p=w.useRef(null),m=w.useRef(null),[x,b]=w.useState(!1),[_,S]=w.useState(null),[M,C]=w.useState(null),A=gC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:N,seriesConfig:D,hasData:R,nodeIds:L,timeRange:k,outlierBounds:O}=w.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 q=1/0,G=-1/0;const $=[];for(const se of e){const J=typeof se.node_id=="number"&&Number.isFinite(se.node_id)?se.node_id:0;V.add(J),se.timestamp<q&&(q=se.timestamp),se.timestamp>G&&(G=se.timestamp),$.push(se.value)}const Q=Array.from(V).sort((se,J)=>se-J),K=i??{start:q,end:G},re={},U=new Set;for(const se of e){const J=typeof se.node_id=="number"&&Number.isFinite(se.node_id)?se.node_id:0;U.add(se.timestamp),re[se.timestamp]||(re[se.timestamp]={}),re[se.timestamp][J]=se.value}const H=Array.from(U).sort((se,J)=>se-J);if(H.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:Q,timeRange:K,outlierBounds:null};const X=H.map(se=>se-K.start),j=[{label:"Time"}],le=[X];for(let se=0;se<Q.length;se++){const J=Q[se],ee=H.map(ie=>{var oe;return((oe=re[ie])==null?void 0:oe[J])??null});le.push(ee),j.push({label:`Node ${J}`,stroke:hs[se%hs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:j,hasData:!0,nodeIds:Q,timeRange:K,outlierBounds:$Z($)}},[e,i]),F=L.length>1,B=w.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))),[]);w.useEffect(()=>{if(!d.current||!N||!R)return;const V=d.current,q=V.clientWidth,G=200;let $=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY;for(let oe=1;oe<N.length;oe+=1){const de=N[oe];for(let ye=0;ye<de.length;ye+=1){const ge=de[ye];ge!=null&&(x&&O?ge>=O.lower&&ge<=O.upper&&(ge<$&&($=ge),ge>Q&&(Q=ge)):(ge<$&&($=ge),ge>Q&&(Q=ge)))}}$===Number.POSITIVE_INFINITY&&O&&($=O.lower,Q=O.upper);const K=Q-$,re=Math.max(Math.abs(Q),Math.abs($)),U=Math.max(re*.05,1e-10),H=Math.max(K*.1,U),X=[_!==null?_:Math.max(0,$-H),M!==null?M:Q+H],j=o?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",le=o?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",J={width:q,height:G,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:F},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(oe,de,ye)=>{const ge=k.end-k.start;return ge>0?[0,ge]:[de,ye]}},y:{range:X}},axes:[{stroke:le,grid:{stroke:j,width:1},ticks:{stroke:j,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(oe,de,ye,ge)=>[ye,ge],values:(oe,de)=>de.map(ye=>am(k.start+Number(ye),k.end-k.start))},{stroke:le,grid:{stroke:j,width:1},ticks:{stroke:j,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(oe,de)=>{if(!de||de.length===0)return 40;const ye=Math.max(...de.map(ge=>ge.length));return Math.max(40,ye*7+14)},values:(oe,de)=>de.map(B)}],series:D,hooks:{setCursor:[oe=>{if(!m.current||!d.current)return;const{left:de,idx:ye}=oe.cursor;if(ye==null||de===void 0||de<0){m.current.style.display="none";return}const ge=N[0][ye];if(ge===void 0){m.current.style.display="none";return}const Me=N[0],fe=(()=>{const Z=oe.scales.x,he=Number(Z.min),be=Number(Z.max);if(!Number.isFinite(he)||!Number.isFinite(be))return null;const we=Math.abs(be-he);if(we<=0)return null;const ve=Math.max(1,oe.bbox.width);return we*GZ/ve})(),Se=VZ(Number(ge)+s),me=k.start+Number(ge);let ce=`<div class="font-medium mb-1">${am(me,k.end-k.start)}</div>`;ce+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Se}</div>`,ce+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${me.toFixed(3)}</div>`;let He=!1;for(let Z=0;Z<L.length;Z+=1){const he=N[Z+1],be=WZ(he,Me,ye,fe);if(be===null)continue;const we=he==null?void 0:he[be];if(we==null)continue;He=!0;const ve=gu(we);ce+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${hs[Z%hs.length]}"></div>
                  <span class="text-muted-foreground">Node ${L[Z]}:</span>
                  <span class="font-medium">${ve} ${A.unit}</span>
                </div>
              `}if(!He){m.current.style.display="none";return}m.current.innerHTML=ce,m.current.style.display="block";const Be=d.current.getBoundingClientRect(),Ge=m.current.getBoundingClientRect();let We=Be.left+de+15;We+Ge.width+20>window.innerWidth&&(We=Be.left+de-Ge.width-15+oe.bbox.left),We=Math.max(4,We);let ae=Be.top-Ge.height+20;ae<4&&(ae=Be.top+8),m.current.style.left=`${We}px`,m.current.style.top=`${ae}px`}]}};p.current&&p.current.destroy();const ee=new ps(J,N,V);p.current=ee;const ie=new ResizeObserver(oe=>{for(const de of oe){const{width:ye,height:ge}=de.contentRect;ee&&ye>0&&ge>0&&ee.setSize({width:ye,height:ge})}});return ie.observe(V),()=>{ie.disconnect(),ee.destroy(),p.current=null}},[N,R,D,t,k,s,F,A.unit,L,B,x,O,_,M,o,a]);const Y=w.useCallback(()=>{m.current&&(m.current.style.display="none")},[]);return c(f.jsxs("div",{className:bt("group/chart bg-background",a?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!a&&n&&"opacity-60"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:bt("font-medium truncate",a?"text-sm":"text-xs"),title:t,children:A.label}),x&&f.jsx(j1,{label:"Ignore Outliers",onRemove:()=>b(!1)}),_!==null&&f.jsx(j1,{label:`Min Y: ${_}`,onRemove:()=>S(null)}),M!==null&&f.jsx(j1,{label:`Max Y: ${M}`,onRemove:()=>C(null)})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:x,onCheckedChange:b,children:"Ignore Outliers"}),f.jsx(Bs,{}),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:_??"",onChange:V=>{const q=V.target.value;S(q===""?null:Number(q))},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:M??"",onChange:V=>{const q=V.target.value;C(q===""?null:Number(q))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]})]})]}),f.jsx(XZ,{isFullscreen:a,onClick:l})]})]}),R?f.jsxs("div",{className:bt("relative bg-background rounded",a?"flex-1 min-h-0":"h-[200px]"),ref:d,onMouseLeave:Y,children:[r&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),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"}})]}):f.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",a?"flex-1 min-h-0":"h-[200px]"),children:n?"Loading...":`No data for ${A.label}`})]}))}function e7({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=w.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=w.useMemo(()=>o&&e.length>0?e:o&&e.length===0?ZR: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(Q$,{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 WNe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=w.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=WF.filter(d=>l.has(d));for(const d of l)c.includes(d)||c.push(d);return c},[t,e]),a=w.useMemo(()=>o.length>0?o:n?WF: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(GNe,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function $Ne({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=qn(gs),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:d}=qZ(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),[b,_]=w.useState(!1),[S,M]=w.useState(null),[C,A]=w.useState(null),N=gC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:D,seriesConfig:R,hasData:L,serverIds:k,timeRange:O,outlierBounds:F}=w.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 q=1/0,G=-1/0;const $=[];for(const se of e)V.add(se.server),se.timestamp<q&&(q=se.timestamp),se.timestamp>G&&(G=se.timestamp),$.push(se.value);const Q=Array.from(V).sort((se,J)=>se-J),K=s??{start:q,end:G},re={},U=new Set;for(const se of e)U.add(se.timestamp),re[se.timestamp]||(re[se.timestamp]={}),re[se.timestamp][se.server]=se.value;const H=Array.from(U).sort((se,J)=>se-J);if(H.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:Q,timeRange:K,outlierBounds:null};const X=H.map(se=>se-K.start),j=[{label:"Time"}],le=[X];for(let se=0;se<Q.length;se++){const J=Q[se],ee=H.map(oe=>{var de;return((de=re[oe])==null?void 0:de[J])??null}),ie=!!i&&i.size>0&&!i.has(J);le.push(ee),j.push({label:`Server ${J}`,stroke:ie?iw(hs[se%hs.length],.25):hs[se%hs.length],width:ie?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:j,hasData:!0,serverIds:Q,timeRange:K,outlierBounds:$Z($)}},[e,s,i]),B=w.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))),[]);w.useEffect(()=>{if(!p.current||!D||!L)return;const V=p.current,q=V.clientWidth,G=200;let $=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY;for(let oe=1;oe<D.length;oe+=1){const de=D[oe];for(let ye=0;ye<de.length;ye+=1){const ge=de[ye];ge!=null&&(b&&F?ge>=F.lower&&ge<=F.upper&&(ge<$&&($=ge),ge>Q&&(Q=ge)):(ge<$&&($=ge),ge>Q&&(Q=ge)))}}$===Number.POSITIVE_INFINITY&&F&&($=F.lower,Q=F.upper);const K=Q-$,re=Math.max(Math.abs(Q),Math.abs($)),U=Math.max(re*.05,1e-10),H=Math.max(K*.1,U),X=[S!==null?S:Math.max(0,$-H),C!==null?C:Q+H],j=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",le=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",J={width:q,height:G,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:(oe,de,ye)=>{const ge=O.end-O.start;return ge>0?[0,ge]:[de,ye]}},y:{range:X}},axes:[{stroke:le,grid:{stroke:j,width:1},ticks:{stroke:j,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(oe,de,ye,ge)=>[ye,ge],values:(oe,de)=>de.map(ye=>am(O.start+Number(ye),O.end-O.start))},{stroke:le,grid:{stroke:j,width:1},ticks:{stroke:j,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(oe,de)=>{if(!de||de.length===0)return 40;const ye=Math.max(...de.map(ge=>ge.length));return Math.max(40,ye*7+14)},values:(oe,de)=>de.map(B)}],series:R,hooks:{setCursor:[oe=>{if(!x.current||!p.current)return;const{left:de,idx:ye}=oe.cursor;if(ye==null||de===void 0||de<0){x.current.style.display="none";return}const ge=D[0][ye];if(ge===void 0){x.current.style.display="none";return}const Me=D[0],fe=(()=>{const Z=oe.scales.x,he=Number(Z.min),be=Number(Z.max);if(!Number.isFinite(he)||!Number.isFinite(be))return null;const we=Math.abs(be-he);if(we<=0)return null;const ve=Math.max(1,oe.bbox.width);return we*GZ/ve})(),Se=VZ(Number(ge)+o),me=O.start+Number(ge);let ce=`<div class="font-medium mb-1">${am(me,O.end-O.start)}</div>`;ce+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Se}</div>`,ce+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${me.toFixed(3)}</div>`;let He=!1;for(let Z=0;Z<k.length;Z+=1){const he=D[Z+1],be=WZ(he,Me,ye,fe);if(be===null)continue;const we=he==null?void 0:he[be];if(we==null)continue;He=!0;const ve=gu(we);ce+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${hs[Z%hs.length]}"></div>
                  <span class="text-muted-foreground">Server ${k[Z]}:</span>
                  <span class="font-medium">${ve} ${N.unit}</span>
                </div>
              `}if(!He){x.current.style.display="none";return}x.current.innerHTML=ce,x.current.style.display="block";const Be=p.current.getBoundingClientRect(),Ge=x.current.getBoundingClientRect();let We=Be.left+de+15;We+Ge.width+20>window.innerWidth&&(We=Be.left+de-Ge.width-15+oe.bbox.left),We=Math.max(4,We);let ae=Be.top-Ge.height+20;ae<4&&(ae=Be.top+8),x.current.style.left=`${We}px`,x.current.style.top=`${ae}px`}]}};m.current&&m.current.destroy();const ee=new ps(J,D,V);m.current=ee;const ie=new ResizeObserver(oe=>{for(const de of oe){const{width:ye,height:ge}=de.contentRect;ee&&ye>0&&ge>0&&ee.setSize({width:ye,height:ge})}});return ie.observe(V),()=>{ie.disconnect(),ee.destroy(),m.current=null}},[D,L,R,t,O,o,N.unit,k,B,b,F,S,C,a,l]);const Y=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]);return d(f.jsxs("div",{className:bt("group/chart bg-background",l?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!l&&n&&"opacity-60"),children:[f.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[f.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.jsx("h4",{className:bt("font-medium truncate",l?"text-sm":"text-xs"),title:t,children:N.label}),b&&f.jsx(j1,{label:"Ignore Outliers",onRemove:()=>_(!1)}),S!==null&&f.jsx(j1,{label:`Min Y: ${S}`,onRemove:()=>M(null)}),C!==null&&f.jsx(j1,{label:`Max Y: ${C}`,onRemove:()=>A(null)})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(oo,{children:[f.jsx(ao,{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(bh,{className:"h-3 w-3"})})}),f.jsxs(lo,{align:"end",className:"min-w-[160px]",children:[f.jsx(Er,{checked:b,onCheckedChange:_,children:"Ignore Outliers"}),f.jsx(Bs,{}),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:S??"",onChange:V=>{const q=V.target.value;M(q===""?null:Number(q))},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:C??"",onChange:V=>{const q=V.target.value;A(q===""?null:Number(q))},onClick:V=>V.stopPropagation(),onKeyDown:V=>V.stopPropagation()})]})]})]}),f.jsx(XZ,{isFullscreen:l,onClick:c})]})]}),L?f.jsxs("div",{className:bt("relative bg-background rounded",l?"flex-1 min-h-0":"h-[200px]"),ref:p,onMouseLeave:Y,children:[r&&f.jsx(Zl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),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"}})]}):f.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",l?"flex-1 min-h-0":"h-[200px]"),children:n?"Loading...":`No data for ${N.label}`})]}))}function qNe({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=w.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:hs[l%hs.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:bt("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?iw(s.color,.25):s.color}}),f.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function XNe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=w.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=$F.filter(p=>c.has(p));for(const p of c)d.includes(p)||d.push(p);return d},[t,e]),l=w.useMemo(()=>a.length>0?a:n?$F: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($Ne,{metricName:c,data:d,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o},c)})})}function YNe({nodeId:t,gpuCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return f.jsxs(Pi,{open:r,onOpenChange:i,children:[f.jsx(Di,{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(kr,{className:bt("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(Ii,{children:f.jsx("div",{className:"mt-3",children:n})})]})}function qF({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]=w.useState(!0),[b,_]=w.useState("combined"),S=a??m,M=l??x,C=c??b,A=d??_,[N,D]=w.useState(null),[R,L]=w.useState([]),k=i.size>1,O=w.useMemo(()=>{const K=[],re=Array.from(i.keys()).sort((U,H)=>U-H);for(const U of re){const H=[...i.get(U)??[]].sort((X,j)=>X-j);for(const X of H)K.push({nodeId:U,gpuIndex:X})}return K.map((U,H)=>({seriesKey:lT(U.nodeId,U.gpuIndex,k),node_id:U.nodeId,gpu_index:U.gpuIndex,label:k?`Node ${U.nodeId} GPU ${U.gpuIndex}`:`GPU ${U.gpuIndex}`,color:k?hs[H%hs.length]:hs[U.gpuIndex%hs.length]}))},[i,k]),F=w.useMemo(()=>{const K=QR(e,k);return K.length>0?K:O},[e,k,O]),B=w.useMemo(()=>{const K=new Set;for(const re of e)K.add(re.gpu_index);return Array.from(K).sort((re,U)=>re-U)},[e]),Y=w.useMemo(()=>{const K=[],re=Array.from(i.keys()).sort((U,H)=>U-H);for(const U of re){const H=i.get(U),X=e.filter(se=>(typeof se.node_id=="number"?se.node_id:null)===U&&H.includes(se.gpu_index)),j=QR(X,!1),le=j.length>0?j:H.map(se=>({seriesKey:lT(U,se,!1),node_id:U,gpu_index:se,label:`GPU ${se}`,color:hs[se%hs.length]}));K.push({nodeId:U,gpuIndices:H,data:X,labels:le})}return K},[e,i]),V=w.useMemo(()=>{const K=new Set;return C==="combined"||!k?(F.forEach(re=>K.add(re.seriesKey)),K):(Y.forEach(re=>{re.labels.forEach(U=>K.add(U.seriesKey))}),K)},[C,k,F,Y]),q=w.useCallback(K=>{L(re=>{const U=re.filter(se=>!V.has(se)),H=re.filter(se=>V.has(se)),j=H.includes(K)?H.filter(se=>se!==K):[...H,K],le=V.size>0&&j.length===V.size?[]:j;return[...U,...le]})},[V]),G=w.useMemo(()=>V.size===0?R:R.filter(K=>V.has(K)),[R,V]),$=w.useMemo(()=>N&&(V.size===0||V.has(N))?N:null,[N,V]),Q=w.useMemo(()=>G.length>0?new Set(G):$?new Set([$]):null,[G,$]);return f.jsxs(Pi,{open:S,onOpenChange:M,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Di,{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(kr,{className:bt("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&&k&&f.jsxs(dm,{type:"single",variant:"selecting",size:"sm",value:C,onValueChange:K=>{K&&A(K)},children:[f.jsx(Xa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),f.jsx(Xa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-6",children:C==="combined"||!k?f.jsxs(f.Fragment,{children:[f.jsx(JR,{series:F,activeSeriesKeys:Q,onSeriesHover:D,onSeriesToggle:q}),f.jsx(e7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:B,seriesMode:k?"node_gpu":"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:Q,xOffset:p})]}):Y.map(K=>f.jsxs(YNe,{nodeId:K.nodeId,gpuCount:K.gpuIndices.length,children:[f.jsx(JR,{series:K.labels,activeSeriesKeys:Q,onSeriesHover:D,onSeriesToggle:q}),f.jsx(e7,{data:K.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:K.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:Q,xOffset:p})]},K.nodeId))})})]})}function KNe({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:M,trainerSectionOpen:C,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:D,trainerNodeMode:R,onTrainerNodeModeChange:L,inferenceNodeMode:k,onInferenceNodeModeChange:O,overrideTimeRange:F,xOffset:B=0}){const[Y,V]=w.useState(!0),[q,G]=w.useState(!0),[$,Q]=w.useState(!0),[K,re]=w.useState("separated"),U=d??Y,H=p??V,X=m??q,j=x??G,le=b??$,se=_??Q,J=S??K,ee=M??re,[ie,oe]=w.useState(null),[de,ye]=w.useState([]),[ge,Me]=w.useState(null),[fe,Se]=w.useState([]),me=w.useMemo(()=>F||BNe(t),[t,F]),Pe=w.useMemo(()=>{const Ee=new Set(r),Ze=ZR.filter(ut=>Ee.has(ut)),Ie=GF.filter(ut=>Ee.has(ut)),Ue=new Set([...ZR,...GF]),rt=r.filter(ut=>!Ue.has(ut)).sort();return[...Ze,...Ie,...rt]},[r]),ce=w.useMemo(()=>new Set(o.map(Ee=>`${Ee.node_id}:${Ee.gpu_index}`)),[o]),He=w.useMemo(()=>new Set(a.map(Ee=>`${Ee.node_id}:${Ee.gpu_index}`)),[a]),Be=w.useMemo(()=>ce.size===0?[]:t.filter(Ee=>{const Ze=typeof Ee.node_id=="number"&&Number.isFinite(Ee.node_id)?Ee.node_id:null;return Ze===null?!1:ce.has(`${Ze}:${Ee.gpu_index}`)}),[t,ce]),Ge=w.useMemo(()=>He.size===0?[]:t.filter(Ee=>{const Ze=typeof Ee.node_id=="number"&&Number.isFinite(Ee.node_id)?Ee.node_id:null;return Ze===null?!1:He.has(`${Ze}:${Ee.gpu_index}`)}),[t,He]),We=w.useMemo(()=>{const Ee=new Map;for(const Ze of o){const Ie=Ee.get(Ze.node_id)??[];Ie.includes(Ze.gpu_index)||Ie.push(Ze.gpu_index),Ee.set(Ze.node_id,Ie)}for(const[Ze,Ie]of Ee)Ee.set(Ze,Ie.sort((Ue,rt)=>Ue-rt));return Ee},[o]),ae=w.useMemo(()=>{const Ee=new Map;for(const Ze of a){const Ie=Ee.get(Ze.node_id)??[];Ie.includes(Ze.gpu_index)||Ie.push(Ze.gpu_index),Ee.set(Ze.node_id,Ie)}for(const[Ze,Ie]of Ee)Ee.set(Ze,Ie.sort((Ue,rt)=>Ue-rt));return Ee},[a]),Z=w.useMemo(()=>{const Ee=new Set;for(const Ze of t)Ee.add(Ze.gpu_index);return Array.from(Ee).sort((Ze,Ie)=>Ze-Ie)},[t]),he=w.useMemo(()=>{const Ee=new Set;for(const Ze of t){const Ie=typeof Ze.node_id=="number"&&Number.isFinite(Ze.node_id)?Ze.node_id:null;Ee.add(Ie)}return Ee.size>1},[t]),be=w.useMemo(()=>QR(t,he),[t,he]),we=w.useMemo(()=>{if(o.length===0&&a.length===0)return[];const Ee=[...o,...a],Ze=new Set(Ee.map(Ie=>Ie.node_id)).size>1;return HNe(Ee,Ze)},[o,a]),ve=w.useMemo(()=>{const Ee=be.length>0?be:we,Ze=new Set(o.map(Ie=>`${Ie.node_id}:${Ie.gpu_index}`));return Ee.filter(Ie=>{const Ue=`${Ie.node_id??"?"}:${Ie.gpu_index}`;return Ze.has(Ue)||Ze.has(`${Ie.node_id}:${Ie.gpu_index}`)})},[be,we,o]),Re=w.useMemo(()=>{const Ee=be.length>0?be:we,Ze=new Set(a.map(Ie=>`${Ie.node_id}:${Ie.gpu_index}`));return Ee.filter(Ie=>{const Ue=`${Ie.node_id??"?"}:${Ie.gpu_index}`;return Ze.has(Ue)||Ze.has(`${Ie.node_id}:${Ie.gpu_index}`)})},[be,we,a]),Ae=w.useMemo(()=>{const Ee={},Ze=new Set(o.map(Ue=>`${Ue.node_id}:${Ue.gpu_index}`)),Ie=new Set(a.map(Ue=>`${Ue.node_id}:${Ue.gpu_index}`));if(he)for(const Ue of t){const rt=typeof Ue.node_id=="number"&&Number.isFinite(Ue.node_id)?Ue.node_id:null,ut=`${rt??"?"}:${Ue.gpu_index}`,Dt=`${rt}:${Ue.gpu_index}`;Ze.has(Dt)||Ze.has(ut)?Ee[ut]="Trainer":(Ie.has(Dt)||Ie.has(ut))&&(Ee[ut]="Inference")}else{for(const Ue of o)Ee[`gpu:${Ue.gpu_index}`]="Trainer";for(const Ue of a)Ee[`gpu:${Ue.gpu_index}`]="Inference"}return Ee},[t,o,a,he]),Oe=o.length>0||a.length>0,qe=Be.length>0||!!l&&o.length>0,Fe=Ge.length>0||!!l&&a.length>0,Ke=w.useMemo(()=>{if(!Oe)return be;const Ee=new Map;for(const Ze of ve)Ee.set(Ze.seriesKey,Ze);for(const Ze of Re)Ee.set(Ze.seriesKey,Ze);return Array.from(Ee.values())},[Oe,be,ve,Re]),je=w.useMemo(()=>new Set(Ke.map(Ee=>Ee.seriesKey)),[Ke]),Te=w.useMemo(()=>je.size===0?de:de.filter(Ee=>je.has(Ee)),[de,je]),Xe=w.useCallback(Ee=>{ye(Ze=>{const Ie=Ze.filter(Rt=>!je.has(Rt)),Ue=Ze.filter(Rt=>je.has(Rt)),ut=Ue.includes(Ee)?Ue.filter(Rt=>Rt!==Ee):[...Ue,Ee],Dt=je.size>0&&ut.length===je.size?[]:ut;return[...Ie,...Dt]})},[je]),ht=w.useMemo(()=>ie&&(je.size===0||je.has(ie))?ie:null,[ie,je]),ke=w.useMemo(()=>Te.length>0?je.size>0&&Te.length===je.size?null:new Set(Te):ht?new Set([ht]):null,[Te,ht,je]),et=w.useMemo(()=>{const Ee=new Set;for(const Ze of n??[])Ee.add(Ze.server);return Ee},[n]),ct=w.useMemo(()=>et.size===0?fe:fe.filter(Ee=>et.has(Ee)),[fe,et]),yt=w.useCallback(Ee=>{Se(Ze=>{const Ie=Ze.filter(Rt=>!et.has(Rt)),Ue=Ze.filter(Rt=>et.has(Rt)),ut=Ue.includes(Ee)?Ue.filter(Rt=>Rt!==Ee):[...Ue,Ee],Dt=et.size>0&&ut.length===et.size?[]:ut;return[...Ie,...Dt]})},[et]),lt=w.useMemo(()=>ge===null?null:et.size===0||et.has(ge)?ge:null,[ge,et]),Je=w.useMemo(()=>ct.length>0?et.size>0&&ct.length===et.size?null:new Set(ct):lt!==null?new Set([lt]):null,[ct,lt,et]);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(Pi,{open:U,onOpenChange:H,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),U&&Oe&&f.jsxs(dm,{type:"single",variant:"selecting",size:"sm",value:J,onValueChange:Ee=>{Ee&&ee(Ee)},children:[f.jsx(Xa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),f.jsx(Xa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),f.jsx(Ii,{children:f.jsx("div",{className:"space-y-6 mt-3 mb-4",children:J==="combined"||!Oe?f.jsxs(f.Fragment,{children:[Oe?f.jsx(VNe,{trainerLabels:ve,inferenceLabels:Re,activeSeriesKeys:ke,onSeriesHover:oe,onSeriesToggle:Xe}):f.jsx(JR,{series:be,activeSeriesKeys:ke,onSeriesHover:oe,onSeriesToggle:Xe}),f.jsx(e7,{data:t,metricNames:Pe,intervalStart:me.start,intervalEnd:me.end,gpuIndices:Z,seriesMode:he?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:Oe?Ae:void 0,activeSeriesKeys:ke,xOffset:B})]}):f.jsxs(f.Fragment,{children:[qe&&f.jsx(qF,{title:"Trainer",gpuData:Be,gpuMetricNames:Pe,timeRange:me,nodeGpuMap:We,isLoading:l,isRefetching:c,open:C,onOpenChange:A,nodeMode:R,onNodeModeChange:L,xOffset:B}),Fe&&f.jsxs(f.Fragment,{children:[qe&&f.jsx("div",{className:"border-t border-border my-3"}),f.jsx(qF,{title:"Inference",gpuData:Ge,gpuMetricNames:Pe,timeRange:me,nodeGpuMap:ae,isLoading:l,isRefetching:c,open:N,onOpenChange:D,nodeMode:k,onNodeModeChange:O,xOffset:B})]}),!l&&Be.length===0&&Ge.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(Pi,{open:X,onOpenChange:j,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!X&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),f.jsx(Ii,{children:f.jsx("div",{className:"mt-3 mb-4",children:f.jsx(WNe,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:F,xOffset:B})})})]}),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(Pi,{open:le,onOpenChange:se,children:[f.jsx(Di,{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(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!le&&"-rotate-90")}),f.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),f.jsx(Ii,{children:f.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[f.jsx(qNe,{data:n??[],activeServerIds:Je,onServerHover:Me,onServerToggle:yt}),f.jsx(XNe,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:Je,overrideTimeRange:F,xOffset:B})]})})]})]}):null]})}function ZNe(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=ON(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 M=l[4];const C=i[i.length-1];if(M.endsWith(")")){M=M.slice(0,-1);const A={name:b,type:S,args:M,children:[],depth:i.length,repeatCount:_,estimatedParams:0};A.estimatedParams=ON(S,M),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=ON(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 YZ(r),ZZ(r),r}function XF(t){return/^\d+(-\d+)?$/.test(t)}function YZ(t){for(const r of t.children)YZ(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&&XF(r.name)&&XF(t.children[n+i].name)&&KZ(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 KZ(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(!KZ(t.children[n],e.children[n]))return!1;return!0}function ZZ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=ZZ(n);return t.estimatedParams=e,e*(t.repeatCount||1)}function ON(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 QNe(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 QZ(t,e,1),e}function QZ(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=JNe(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)QZ(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 JNe(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 Ey(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 JZ(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 YF={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"}},KF={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 _E(t){return t?KF[t]?KF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function eke(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 cT(){return f.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function tke({node:t}){const e=_E(t.name)||t.type,n=JZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Ey(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 nke({node:t}){const e=_E(t.name)||t.type,n=JZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Ey(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 rke({node:t}){const e=_E(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Ey(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(nke,{node:i},s))})]})}function bP({node:t}){return t.children.length===0?f.jsx(tke,{node:t}):t.repeatCount>1?f.jsx(ike,{node:t}):t.children.every(n=>n.children.length===0)?f.jsx(rke,{node:t}):f.jsx(ske,{node:t})}function ike({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(cT,{}),f.jsx(bP,{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 ske({node:t}){const e=_E(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Ey(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(cT,{}),f.jsx(bP,{node:i})]},s))})]})}function oke({root:t}){const e=w.useMemo(()=>eke(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(cT,{}),f.jsx(bP,{node:n})]},r)),f.jsx(cT,{}),f.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function ake({stats:t,rawRepr:e}){const[n,r]=w.useState(!1),i=t.totalParams,s=w.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,a])=>a>0).sort((a,l)=>l[1]-a[1]),[t.paramsByCategory]),o=w.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:["~",Ey(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(KM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&f.jsx(KM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&f.jsx(KM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&f.jsx(KM,{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:`${YF[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 ${YF[a].bar}`}),f.jsx("span",{className:"capitalize text-muted-foreground",children:a}),f.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[Ey(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(Pi,{open:n,onOpenChange:r,children:[f.jsxs(Di,{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(kr,{className:"size-3"}):f.jsx(tm,{className:"size-3"}),"Raw repr"]}),f.jsx(Ii,{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 KM({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 lke({modelRepr:t}){const e=w.useMemo(()=>ZNe(t),[t]),n=w.useMemo(()=>e?QNe(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(Due,{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(oke,{root:e})}),f.jsx(ake,{stats:n,rawRepr:t})]})}function eQ(t){return pP(t==null?void 0:t.setup)}function cke(t){const e=eQ(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=Lr(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=Lr(d.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}function uke(t){const e=eQ(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=Lr(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=Lr(d.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}const dke=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],fke=[1,5,10,30,60,120,300],LN=Ko;function hke(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 ZM(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 pke(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 mke(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 gke(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 xke(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 vke({value:t,onChange:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(""),o=w.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=hke(i);c!==null&&(e(c),r(!1))};return f.jsxs(YT,{open:n,onOpenChange:a,children:[f.jsx(KT,{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(kr,{className:"size-3 text-muted-foreground"})]})}),f.jsxs(ZT,{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:fke.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 yke(){var Rt;const[t,e]=w.useState(null),n=w.useRef(0),r=qn(bl),i=!0,[s,o]=hn(Ice),[a,l]=hn(Oce),[c,d]=hn(Lce),[p,m]=hn(jce),[x,b]=hn(zce),[_,S]=hn(Fce),[M,C]=hn(Uce),[A,N]=hn(Bce),[D,R]=hn(Hce),[L,k]=hn(Vce),[O,F]=hn(Xce),[B,Y]=hn(Gce),[V,q]=hn(Wce),[G,$]=hn($ce),[Q,K]=hn(qce),[re,U]=w.useState(ZM(_));w.useEffect(()=>{t&&(t.scrollTop=M,n.current=M)},[t]),w.useEffect(()=>{if(!t)return;const St=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",St,{passive:!0}),()=>{t.removeEventListener("scroll",St),C(n.current)}},[t]);const{data:H,error:X}=gd(r||"",!!r,i),j=w.useMemo(()=>LZ(H==null?void 0:H.summary),[H==null?void 0:H.summary]),{data:le,isFetching:se,isPlaceholderData:J}=Ade(r||"",a,c,p,!!r),ee=!!r&&le!==void 0,{data:ie,isFetching:oe,isPlaceholderData:de}=Nde(r||"",a,c,(le==null?void 0:le.global_min_time)??null,p,dke,ee),ye=!!r&&le!==void 0,{data:ge,isFetching:Me,isPlaceholderData:fe}=kde(r||"",a,c,(le==null?void 0:le.global_min_time)??null,p,null,ye),Se=(le==null?void 0:le.total_pages)??(ie==null?void 0:ie.total_pages)??null,me=le,Pe=ie,ce=ge,[He,Be]=w.useState([]),[Ge,We]=w.useState([]),[ae,Z]=w.useState([]);w.useEffect(()=>{me!=null&&me.available_metrics&&me.available_metrics.length>0&&Be(me.available_metrics)},[me==null?void 0:me.available_metrics]),w.useEffect(()=>{Pe!=null&&Pe.available_metrics&&Pe.available_metrics.length>0&&We(Pe.available_metrics)},[Pe==null?void 0:Pe.available_metrics]),w.useEffect(()=>{ce!=null&&ce.available_metrics&&ce.available_metrics.length>0&&Z(ce.available_metrics)},[ce==null?void 0:ce.available_metrics]);const[he,be]=w.useState(1),[we,ve]=w.useState(null),[Re,Ae]=w.useState(null),[Oe,qe]=w.useState(null);w.useEffect(()=>{Se!==null&&Se>0&&be(Se)},[Se]),w.useEffect(()=>{const St=(me==null?void 0:me.global_min_time)??(Pe==null?void 0:Pe.global_min_time)??null;St!==null&&ve(St)},[me==null?void 0:me.global_min_time,Pe==null?void 0:Pe.global_min_time]),w.useEffect(()=>{const St=(me==null?void 0:me.interval_start)??(Pe==null?void 0:Pe.interval_start)??null,Ht=(me==null?void 0:me.interval_end)??(Pe==null?void 0:Pe.interval_end)??null;St!==null&&Ht!==null&&Ae({start:St,end:Ht})},[me==null?void 0:me.interval_start,me==null?void 0:me.interval_end,Pe==null?void 0:Pe.interval_start,Pe==null?void 0:Pe.interval_end]),w.useEffect(()=>{be(1),ve(null),Ae(null),qe(null)},[r]);const Fe=Se??he,Ke=(me==null?void 0:me.interval_start)??(Pe==null?void 0:Pe.interval_start)??null,je=(me==null?void 0:me.interval_end)??(Pe==null?void 0:Pe.interval_end)??null,Te=(me==null?void 0:me.global_min_time)??(Pe==null?void 0:Pe.global_min_time)??we;w.useEffect(()=>{if(p&&Se!==null&&Se>0){const St=Se-1;a!==St&&l(St)}},[p,Se,a,l]);const Xe=St=>{m(!1),l(St)},ht=St=>{if(!p){const Ht=Math.floor(a*c/St);l(Ht)}d(St)},ke=()=>{p?m(!1):(m(!0),Se!==null&&Se>0&&l(Se-1))};w.useEffect(()=>{U(ZM(_))},[_]);const et=w.useMemo(()=>{const St=(me==null?void 0:me.metrics)??[];return!x||_<=0?St:mke(St,_)},[me==null?void 0:me.metrics,x,_]),ct=w.useMemo(()=>{const St=(Pe==null?void 0:Pe.metrics)??[];return!x||_<=0?St:gke(St,_)},[Pe==null?void 0:Pe.metrics,x,_]),yt=w.useMemo(()=>{const St=(ce==null?void 0:ce.metrics)??[];return!x||_<=0?St:xke(St,_)},[ce==null?void 0:ce.metrics,x,_]),lt=w.useMemo(()=>{if(p){const $e=[],dt=[];if((me==null?void 0:me.interval_start)!=null&&dt.push(me.interval_start),(me==null?void 0:me.interval_end)!=null&&$e.push(me.interval_end),(Pe==null?void 0:Pe.interval_start)!=null&&dt.push(Pe.interval_start),(Pe==null?void 0:Pe.interval_end)!=null&&$e.push(Pe.interval_end),(ce==null?void 0:ce.interval_start)!=null&&dt.push(ce.interval_start),(ce==null?void 0:ce.interval_end)!=null&&$e.push(ce.interval_end),$e.length===0)return null;const Tt=Math.min(...$e),Bt=Math.max(Te??Tt,Tt-c),Ct=dt.length>0?Math.max(...dt):Bt;return{start:Math.min(Tt,Math.max(Bt,Ct)),end:Tt}}const St=(Re==null?void 0:Re.start)??null,Ht=(Re==null?void 0:Re.end)??null,en=Ke??St,Ut=je??Ht;return en===null||Ut===null?null:{start:en,end:Ut}},[p,me==null?void 0:me.interval_end,me==null?void 0:me.interval_start,Pe==null?void 0:Pe.interval_end,Pe==null?void 0:Pe.interval_start,ce==null?void 0:ce.interval_end,ce==null?void 0:ce.interval_start,Te,c,Ke,je,Re==null?void 0:Re.start,Re==null?void 0:Re.end]);w.useEffect(()=>{lt&&qe(lt)},[lt]);const Je=lt??Oe,Ee=w.useMemo(()=>!Je||Te===null?0:Je.start-Te,[Je,Te]),Ze=se&&J||oe&&de||Me&&fe,Ie=se&&!me||ee&&oe&&!Pe||ye&&Me&&!ce,Ue=!Ze&&!Ie&&(se&&!!me||oe&&!!Pe||Me&&!!ce),rt=Ze||Ie,ut=w.useMemo(()=>cke(H==null?void 0:H.summary),[H==null?void 0:H.summary]),Dt=w.useMemo(()=>uke(H==null?void 0:H.summary),[H==null?void 0:H.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(dm,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:St=>{St&&o(St)},children:[f.jsx(Xa,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),f.jsx(Xa,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),f.jsx(Xa,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&f.jsxs(f.Fragment,{children:[f.jsx(p9,{currentPage:a,totalPages:Fe,onPageChange:Xe}),f.jsx(vke,{value:c,onChange:ht}),Je&&f.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[am(Je.start,Je.end-Je.start)," ","–"," ",am(Je.end,Je.end-Je.start)]}),f.jsx("button",{onClick:ke,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(AS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:x,onEnabledChange:b,value:re,onValueChange:U,onValueCommit:St=>{const Ht=pke(St);Ht!==null?(S(Ht),U(ZM(Ht))):U(ZM(_))},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:[X&&f.jsx(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",X instanceof Error?X.message:"Unknown error"]})})}),f.jsx(KNe,{gpuMetrics:et,cpuMetrics:ct,vllmMetrics:yt,availableGpuMetrics:(me==null?void 0:me.available_metrics)??He,availableCpuMetrics:(Pe==null?void 0:Pe.available_metrics)??Ge,availableVllmMetrics:(ce==null?void 0:ce.available_metrics)??ae,trainerGpus:ut,inferenceGpus:Dt,isLoading:rt,isRefetching:Ue,roleMode:A,onRoleModeChange:N,systemMetricsOpen:D,onSystemMetricsOpenChange:R,cpuMetricsOpen:L,onCpuMetricsOpenChange:k,vllmMetricsOpen:O,onVllmMetricsOpenChange:F,trainerSectionOpen:B,onTrainerSectionOpenChange:Y,inferenceSectionOpen:V,onInferenceSectionOpenChange:q,trainerNodeMode:G,onTrainerNodeModeChange:$,inferenceNodeMode:Q,onInferenceNodeModeChange:K,overrideTimeRange:Je,xOffset:Ee})]})}),s==="topology"&&f.jsx("div",{className:"flex-1 overflow-hidden",children:X?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:X instanceof Error?X.message:"Unknown error"})]})}):H?!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(zZ,{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:X?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:X instanceof Error?X.message:"Unknown error"})]})}):H?(Rt=H.summary)!=null&&Rt.model_architecture?f.jsx("div",{className:"h-full w-full",children:f.jsx(lke,{modelRepr:H.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(Rm,{description:"Select a run from the sidebar to view infrastructure metrics."})}const tQ=1e4;function E_(t,e){return t*tQ+e}function bke(){var ve,Re;const t=qn(bl),[e]=l7(),[n,r]=hn(SI),[i,s]=hn(Pce),[o,a]=hn(wI),[l,c]=hn(MI),d=qn(TI),[p]=hn(MA),[,m]=hn(CI),x=qn(TA),[b,_]=hn(UT),[S,M]=hn(BT),C=b.length+(S?1:0),A=Ae=>{_(Oe=>Oe.includes(Ae)?Oe.filter(qe=>qe!==Ae):[...Oe,Ae])},[N,D]=w.useState(0),[R,L]=w.useState(0),[k,O]=w.useState(!0),F=!0,B=w.useMemo(()=>{const Ae=e.get("step");if(!Ae)return null;const Oe=Number(Ae);return Number.isFinite(Oe)?Oe:null},[e]),Y=w.useRef(null);w.useEffect(()=>{if(!t){Y.current=null;return}if(B==null){Y.current=null;return}B!==Y.current&&(r(B),Y.current=B)},[B,t,r]);const{data:V,isLoading:q,error:G}=bde(t||"",n,i,!!t),{data:$}=gd(t||"",!!t,F),Q=((ve=$==null?void 0:$.summary)==null?void 0:ve.eval_env_details)??((Re=$==null?void 0:$.config)==null?void 0:Re.eval_env_details),K=w.useMemo(()=>Uw(Q),[Q]),re=w.useMemo(()=>{const Ae=Mp(Q),Oe=Bw($==null?void 0:$.data_metric_ranges);return Tp(Ae,Oe)},[Q,$==null?void 0:$.data_metric_ranges]),[U,H]=w.useState([]),X=V==null?void 0:V.available_rollout_metric_names,j=X&&X.length>0?X:U;X&&X.length>0&&X!==U&&H(X);const le=w.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:j,selectedSampleIdx:o}},[i,j,o]);w.useEffect(()=>{if(!V)return;const Ae=V.available_eval_names;Ae.length&&(i&&Ae.includes(i)||s(Ae[0]))},[V==null?void 0:V.available_eval_names,i,s,V]);const se=w.useMemo(()=>{var Ae;return(Ae=V==null?void 0:V.available_steps)!=null&&Ae.length&&n===null?V.available_steps[V.available_steps.length-1]:null},[V==null?void 0:V.available_steps,n]);w.useEffect(()=>{se!==null&&n===null&&B==null&&r(se)},[se,B,n,r]);const J=Ae=>{r(Ae)},[ee,ie]=w.useState([]),[oe,de]=w.useState(null);t!==oe&&(ie([]),de(t));const ye=V==null?void 0:V.available_steps,ge=w.useMemo(()=>{const Ae=ye??[];return[...new Set([...ee,...Ae])].sort((qe,Fe)=>qe-Fe)},[ye,ee]);ge.length>ee.length&&ie(ge);const Me=ge.length>0,fe=Me?ge[ge.length-1]:0,Se=w.useMemo(()=>{if(n==null)return ge.length-1;const Ae=ge.indexOf(n);return Ae>=0?Ae:ge.length-1},[ge,n]),me=Ae=>{Ae>=0&&Ae<ge.length&&J(ge[Ae])},Pe=w.useMemo(()=>{if(V!=null&&V.prompts)return V.prompts.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,env:Ae.env,system_prompt:Ae.system_prompt,tokens_system_prompt:Ae.tokens_system_prompt,prompt:Ae.prompt,tokens_prompt:Ae.tokens_prompt}))},[V]),ce=w.useMemo(()=>{if(V!=null&&V.rollouts)return V.rollouts.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,sample_idx:E_(Ae.sample_idx,Ae.completion_idx),turn_order:Ae.turn_order,turn_type:Ae.turn_type,content:Ae.content,tokens:Ae.tokens}))},[V]),He=w.useMemo(()=>{if(V!=null&&V.samples_data)return V.samples_data.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,sample_idx:E_(Ae.sample_idx,Ae.completion_idx),reward:null,advantage:null,turns:Ae.turns,total_tokens:null,raw_string:null}))},[V]),Be=w.useMemo(()=>{if(V!=null&&V.rollout_metrics)return V.rollout_metrics.map(Ae=>({step:Ae.step,sample_idx:E_(Ae.sample_idx,Ae.completion_idx),env:Ae.env,metric_name:Ae.metric_name,value:Ae.value}))},[V]),Ge=w.useMemo(()=>{if(V!=null&&V.golden_answers)return V.golden_answers.map(Ae=>({step:Ae.step,sample_idx:E_(Ae.sample_idx,Ae.completion_idx),env:Ae.env,key:Ae.key,value:Ae.value}))},[V]),We=w.useMemo(()=>{if(V!=null&&V.info_turns)return V.info_turns.map(Ae=>({step:Ae.step,sample_idx:E_(Ae.sample_idx,Ae.completion_idx),turn_order:Ae.turn_order,env:Ae.env,info_key:Ae.info_key,info_value:Ae.info_value,info_type:Ae.info_type}))},[V]),ae=w.useMemo(()=>{if(!(V!=null&&V.samples_data))return new Map;const Ae=new Map;for(const Oe of V.samples_data)Ae.set(Oe.sample_idx,(Ae.get(Oe.sample_idx)??0)+1);return Ae},[V]),Z=w.useCallback((Ae,Oe)=>{const qe=ae.get(Ae)??Oe.samples.length;if(a(Ae),qe<=1){const Fe=Oe.samples[0];Fe&&c(Fe.sample_idx)}else m("samples")},[ae,a,c,m]),he=w.useCallback(()=>{m("groups")},[m]),be=w.useCallback(({viewMode:Ae})=>f.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[Ae==="samples"&&f.jsx(En,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:he,children:f.jsx(HT,{className:"h-4 w-4"})}),f.jsxs(NS,{value:i??"",onValueChange:Oe=>{s(Oe),a(null),c(null),m("groups")},children:[f.jsx(RS,{className:"h-7 text-xs min-w-0 flex-1",children:f.jsx(kS,{placeholder:"Select eval..."})}),f.jsx(PS,{children:((V==null?void 0:V.available_eval_names)??[]).map(Oe=>f.jsx(DS,{value:Oe,className:"text-xs",children:Oe},Oe))})]})]}),[i,V==null?void 0:V.available_eval_names,s,a,c,m,he]),we=w.useMemo(()=>{var je;if(!d)return null;const Ae=((je=d.sample.turns[0])==null?void 0:je.step)??n,Oe=d.sample.group_id,Fe=d.sample.sample_idx%tQ,Ke=ae.get(Oe)??1;return{step:Ae,evalSampleIdx:Oe,completionIdx:Fe,numCompletions:Ke}},[d,n,ae]);return t?f.jsxs("div",{className:"flex h-full overflow-hidden",children:[f.jsx(yP,{prompts:Pe,data:ce,samplesData:He,rolloutMetrics:Be,availableMetricNames:j,isLoading:q,step:n??void 0,currentStepIndex:Se,totalSteps:ge.length,onStepChange:me,hasSteps:Me,stepValues:ge,openAtom:MA,selectedGroupIdAtom:wI,selectedSampleIdxAtom:MI,viewModeAtom:CI,renderLeftControls:be,onGroupClick:Z,hideRewardAdvantage:!0,envDetailsOverride:Q}),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(vP,{openAtom:MA}),we&&f.jsxs("div",{className:"text-sm text-muted-foreground",children:[f.jsxs("span",{children:["Step ",we.step]}),i&&f.jsxs(f.Fragment,{children:[" · ",f.jsx("span",{children:i})]})," · ",f.jsxs("span",{children:["Sample ",we.evalSampleIdx]}),we.numCompletions>1&&f.jsxs(f.Fragment,{children:[" · ",f.jsxs("span",{children:["Completion ",we.completionIdx]})]})]}),(d==null?void 0:d.sample.raw_string)&&f.jsx(RC,{rawString:d.sample.raw_string,totalTokens:d.sample.total_tokens,turns:d.sample.turns.length}),d&&f.jsxs(f.Fragment,{children:[f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{D(Ae=>Ae+1),O(!1)},children:"Collapse All"}),f.jsx(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{L(Ae=>Ae+1),O(!0)},children:"Expand All"}),f.jsxs(oo,{children:[f.jsx(ao,{asChild:!0,children:f.jsxs(En,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",C>0&&` (${C})`]})}),f.jsxs(lo,{align:"start",className:"w-auto",children:[f.jsx(Er,{checked:S,onCheckedChange:Ae=>M(!!Ae),onSelect:Ae=>Ae.preventDefault(),children:"Format Think"}),f.jsx(Er,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:Ae=>Ae.preventDefault(),children:"Markdown"}),f.jsx(Er,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:Ae=>Ae.preventDefault(),children:"LaTeX"}),f.jsx(Er,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:Ae=>Ae.preventDefault(),children:"Code"})]})]})]})]}),le&&f.jsx(gP,{openAtom:TA})]})})}),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:[G&&f.jsx(ld,{className:"border-destructive mb-6",children:f.jsx(lh,{className:"pt-6",children:f.jsxs("p",{className:"text-destructive",children:["Error:"," ",G instanceof Error?G.message:"Unknown error"]})})}),f.jsx(I1,{prompts:Pe,data:ce,samplesData:He,rolloutMetrics:Be,goldenAnswers:Ge,infoTurns:We,isLoading:q,step:n??void 0,filterGroupId:o,filterSampleIdx:l,lastValidSampleAtom:TI,collapseAllSignal:N,expandAllSignal:R,defaultSectionsOpen:k,envRewardRanges:K,envMetricRanges:re,renderOptions:b,formatThinkBlocks:S})]})})]}),le&&f.jsx(xP,{currentStep:n,maxSelectableStep:fe,openAtom:TA,selectedMetricsAtom:Dce,selectedStepAtom:SI,evalConfig:le})]}):f.jsx(Rm,{description:"Select a run from the sidebar to view evals."})}function _ke(){const t=qn(gs);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 Ske(){return f.jsxs(Kce,{children:[f.jsx(nfe,{}),f.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:f.jsxs(UJ,{children:[f.jsx(Gf,{path:"/",element:f.jsx(Dme,{})}),f.jsx(Gf,{path:"/metrics",element:f.jsx(Ome,{})}),f.jsx(Gf,{path:"/timeline",element:f.jsx(vNe,{})}),f.jsx(Gf,{path:"/rollouts",element:f.jsx(zNe,{})}),f.jsx(Gf,{path:"/rollouts-discarded",element:f.jsx(FNe,{})}),f.jsx(Gf,{path:"/topology",element:f.jsx(UNe,{})}),f.jsx(Gf,{path:"/infra",element:f.jsx(yke,{})}),f.jsx(Gf,{path:"/evals",element:f.jsx(bke,{})}),f.jsx(Gf,{path:"/about",element:f.jsx(_ke,{})})]})})]})}dU.createRoot(document.getElementById("root")).render(f.jsx(w.StrictMode,{children:f.jsx(dee,{children:f.jsx(Ske,{})})}));
